Jump to content

Fixed Invoice Data


Recommended Posts

Hi,

I have started upgrading the WHMCS from version 5.2.17 to 7.6.0

My first problem is that Fixed Invoice Data does not work in the file viewinvoice.tpl

I've put the code in viewinvoice.tpl

{php}
# Begin Fixed Invoice Data Mod
$invoiceid = $this->_tpl_vars['invoiceid'];
$result = select_query("mod_invoicedata","",array("invoiceid"=>$invoiceid));
$data = mysql_fetch_array($result);
$match = $data[0];
if ($match) {
    $this->_tpl_vars['clientsdetails'] = unserialize($data[1]);
    $this->_tpl_vars['customfields'] = unserialize($data[2]);
}
# End Fixed Invoice Data Mod
{/php}

After that, a blank screen will appear when an invoice is displayed.

What did I do wrong ?

 

Link to comment
Share on other sites

19 minutes ago, wsd said:

What did I do wrong ?

it's a little naughty to still be using {php} in the templates with v7 (or v6 for that matter) - ideally you should be using a hook to pass the variables back to the template...

however, check out the v6 Template Migration documentation below and note what it says about changes to $this->_tpl_vars

https://docs.whmcs.com/Version_6_Template_Migration_Guide#.7Bphp.7D_Block_Syntax

Link to comment
Share on other sites

there is a in-built feature in WHMCS called "Store Client Data Snapshot"...

https://docs.whmcs.com/Invoice_Tab#Store_Client_Data_Snapshot

http://help.whmcs.com/m/payments/l/755345-fixing-preserving-customer-invoice-data

Quote

With this option ticked, clients name, address & custom field data (for example VAT Numbers) will all be recorded and saved at the time an invoice is generated, and then both the client area and PDF invoice views will display the name/address information as it was at the time of initial creation. So even if the clients profile is edited or the billing contact changed, only future invoices will reflect those changes, existing invoices will keep their current addressee.

Once the option is enabled invoice data will start being fixed, it does not apply to invoices generated prior to being enabled.

if that feature is just reproducing the functionality of your script, then perhaps you will no longer need the script going forward - at least not for new invoices.

there is also at least one module in Marketplace that can do this too...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated