Author Topic: [Custom Code] Small change to the client area balance (Modern Panel Theme Only!)  (Read 2275 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrick

  • 620
  • 17
  • Active Participant
  • *****
  • HBF Volunteer
Please look at the pictures as to how it looks now.  This is an absolutely optional addition for those looking to add a little more to their design. This is heavily modified,  so don't expect Hostbill to ever add this stuff.  Ensure you create backups of these modifications if you want to keep them. 

NOTE: I replaced the custom language variables i created with some text in the example text below.  Feel free to create your own language variables in the languages section of your admin area.  Example: Available Credit would be replaced with {$lang.variable}.  I only put demo text there to demonstrate how it would look. 

File: /hostbill_install/templates/modernpanel/submenu/dashboard.submenu.tpl

ORIGINAL DEFAULT HOSTBILL CODE:
Code: [Select]
        <div class="header {if $acc_credit_balance < 0}due-alert{/if}">

            <p>{$lang.curbalance}</p>

            <span>{if $acc_credit_balance < 0}- {/if}{if $currency.sign}<small>{$currency.sign}</small>{/if}{$acc_credit_balance|abs|price:$currency:false}{if $currency.code} {$currency.code}{/if}</span>

REPLACED WITH:

Replace from line: 13 to 17

Code: [Select]
        <div class="header {if $acc_credit_balance < 0}due-alert{/if}" style="{if $acc_balance == 0}background-color:#999999;{/if}{if $acc_credit_balance > 0}background-color:#33CC66;{/if}">
       
            <p>{if $acc_balance > 0}{$lang.curbalance}{/if}{if $acc_balance eq 0 && $acc_credit_balance eq 0} Account Balance: {/if}{if $acc_credit_balance > 0 && $acc_balance eq 0}Available Credit:{/if}</p>

            <span>{if $acc_credit_balance > 0}+ {/if}{if $acc_credit_balance < 0}- {/if}{if $currency.sign}<small>{$currency.sign}</small>{/if}{$acc_credit_balance|abs|price:$currency:false}{if $currency.code} {$currency.code}{/if}</span>


Be sure to create backup of this file in case you would ever like to revert back.

Edit:

Final changes:

Ok, made final changes.  The screenshots don't reflect the exact and final change but the final change was the alternative text based on positive, 0 or negative balance.  I've cleaned up some of the code and tested it with unpaid invocies + credit, no credit, only credit and finally no open invoices and no credit.  Everything functions perfectly.
« Last Edit: May 21, 2013, 01:04:19 AM by patrick »
Patrick - Forum Rules
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein

Offline Patrick

  • 620
  • 17
  • Active Participant
  • *****
  • HBF Volunteer
I've made a lot of edits to this code as it's completely custom.  These are the final changes.  Use them how you like as they work very well and looks very good

edit: I'm a perfectionist.  I don't like leaving things that aren't displayed or explained properly.  My many edits should now be complete and you can use the code as you please.
« Last Edit: May 21, 2013, 12:43:53 AM by patrick »
Patrick - Forum Rules
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein

Offline thetrusteeco

  • 257
  • 11
  • Active Participant
  • *****
    • The Trustee Co.
That's brilliant Patrick.  It will definitely help with customers that don't speak English well.  My site is not multilingual.
"No man really becomes a fool until he stops asking questions"
Charles Proteus Steinmetz

Offline tallship

  • 619
  • 19
  • Active Participant
  • *****
  • Manager Network Services
    • Skype - tallship
    • Business Internet and Telephony since 1985.
Oh man, Thanks Patrick :)

What's your advice on how to prevent updates from squashing any of these fixes? I'm using modernpanel and like the look, but would like to implement a "best practices" for ensuring I preserve changes I make from version to version.

I saw your bug report at kbkp too, and was waiting to hear back from you on whether it really needed to be voted up or not. Perhaps one good bug report would be to allow people to append to bug reports and also the ability of the reporter to remove their submissions, but I'm not going to do Kris's job for him, I guess he'll learn the hard way and eventually figure out that he needs to implement that functionality in his bug tracker.

Kindest regards,
Bradley D. Thornton - Manager Network Services, NorthTech Computer   TEL: +1.310.388.9469 (US) | +44.203.318.2755 (UK) | +61.390.088.072 (AU) | +41.43.508.05.10 (CH)
Registered Linux User #190795 - "Ask Bill why the string in [MS-DOS] function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that." - Dr. Gary Kildall.

Offline Lawrence

  • 574
  • 22
  • Community Manager
  • Active Participant
  • *****
    • Lawrence Wright
What's your advice on how to prevent updates from squashing any of these fixes? I'm using modernpanel and like the look, but would like to implement a "best practices" for ensuring I preserve changes I make from version to version.

It's pretty easy to prevent updates from trashing changes you make to your HostBill.

  • Create a folder to be zipped when done.
  • Create a directory structure similar to your HostBill install, including only folders you intend on keeping the same.
  • Download any file you've changed into a similar path within your soon-to-be extractable folder.
  • Zip / Tar it!

When you update HostBill, all you have to do is extract the archive in your HostBill directory. Just make sure it only contains files you really want to preserve, and naturally add files you want to preserve for future updates.

Adding the file in the first place is probably.... the hardest part.. because you have to manually create their respective directories. :P Other than that, it's the easiest thing to do. The only downside is if there's a template update / specific file update that you have in your folder, you won't benefit from this method as your HostBill install will not contain the latest updates for that particular file.
Skype: sociallarry | AIM: larry.aim@aim.com | Forum Rules & Information

These forums are hosted by me with no intentions to ever monetize them. These forums are here solely for the benfit of the HostBill community.

Offline Patrick

  • 620
  • 17
  • Active Participant
  • *****
  • HBF Volunteer
It's pretty easy to prevent updates from trashing changes you make to your HostBill.

  • Create a folder to be zipped when done.
  • Create a directory structure similar to your HostBill install, including only folders you intend on keeping the same.
  • Download any file you've changed into a similar path within your soon-to-be extractable folder.
  • Zip / Tar it!

When you update HostBill, all you have to do is extract the archive in your HostBill directory. Just make sure it only contains files you really want to preserve, and naturally add files you want to preserve for future updates.

Adding the file in the first place is probably.... the hardest part.. because you have to manually create their respective directories. :P Other than that, it's the easiest thing to do. The only downside is if there's a template update / specific file update that you have in your folder, you won't benefit from this method as your HostBill install will not contain the latest updates for that particular file.

Pretty much exactly how he said it.  We store ours differently.  My business uses google business apps and we utilize google drive among all staff.  Like Lawrence said, we do the same by creating an exact directory structure and any files we've modified, we keep a copy of those in google drive.  We update hostbill then just drag and drop the folder and it does the rest.  That or use the option to exclude files from changes during update feature in hostbill if yours works.

I just know one thing is for sure and i'm guilty of it a few times.  I've made changes to files, forgot to save them, updated and lost those changes.  The code i provided above was completely custom and if i lost it, i'd be pissed lol.  So at least things like this will remain on the forums. 

I do enjoy doing these types of changes so as time goes i'll continue doing it.  Issue you have to keep in mind though is if Kris makes any changes to the client area and you keep your backup files, you'll obviously have to re-edit the files so as to receive the new changes from Hostbill
Patrick - Forum Rules
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein