WHMCS CEO Matt Posted February 24, 2010 WHMCS CEO Share Posted February 24, 2010 In some countries, it is required by law that in addition to the Proforma/Sequential Paid Invoice Numbering that is natively supported by WHMCS, that the invoice numbers which are sequential must also have sequential dates. In order for this to happen it is necessary to update the invoice date when it gets paid and this can be done with a simple action hook. Below is the code for that hook. If you need this, just create a file in the includes/hooks/ folder (name is not important) with the code below in it: <?php function hook_update_invoice_date_on_payment($vars) { update_query("tblinvoices",array("date"=>"now()"),array("id"=>$vars['invoiceid'])); } add_hook("AddInvoicePayment",1,"hook_update_invoice_date_on_payment"); ?> Matt 0 Quote Link to comment Share on other sites More sharing options...
markos Posted February 25, 2010 Share Posted February 25, 2010 This hook is called after the user gets his email with PDF. Is there a possibility to call the hook before anything else? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted February 25, 2010 Share Posted February 25, 2010 Matt would need to confirm but maybe "AddInvoicePayment" would get there before the pdf is generated. 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted February 25, 2010 Share Posted February 25, 2010 Related to this, I just posted a thread about adding the customer's VAT number to the invoices (a legal requirement in my country too): http://forum.whmcs.com/showthread.php?t=27542 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted March 1, 2010 Share Posted March 1, 2010 Hi guys, Were you able to confirm where to call the hook? 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted March 2, 2010 Share Posted March 2, 2010 Matt confirmed that "AddInvoicePayment" does the trick for before the email 0 Quote Link to comment Share on other sites More sharing options...
hostandes Posted September 22, 2010 Share Posted September 22, 2010 hello. I'm trying to create the file that says matt, but when I upload to the server, I whmcs blank. 0 Quote Link to comment Share on other sites More sharing options...
dexus Posted November 14, 2010 Share Posted November 14, 2010 I also get a blank page on multiple locations in WHMCS when I trie to use hook that Matt suggested. Actually I tried with "AddInvoicePayment" hook. I don't see anything wrong with the code but still it brake WHMCS when used...?? Is this really working for someone? 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted December 21, 2010 Share Posted December 21, 2010 Here's my hook. It's working correctly: <?php function hook_update_invoice_date_on_payment($vars) { update_query("tblinvoices",array("date"=>"now()"),array("id"=>$vars['invoiceid'])); } add_hook("AddInvoicePayment",1,"hook_update_invoice_date_on_payment"); ?> 0 Quote Link to comment Share on other sites More sharing options...
inyerface Posted January 11, 2011 Share Posted January 11, 2011 This doesn't work in Canada. All we need is an exra line that says Paid on XXX date". I mean it already says PAID just need a date stamp 0 Quote Link to comment Share on other sites More sharing options...
fremeni Posted February 5, 2011 Share Posted February 5, 2011 Hi, After i insert the hook whmcs goes down, i can't access anywhere. Someone can check the code ? 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted February 5, 2011 Share Posted February 5, 2011 Hi, After i insert the hook whmcs goes down, i can't access anywhere. Someone can check the code ? The code is fine, you will have made a mistake, or added extra whitespace 0 Quote Link to comment Share on other sites More sharing options...
fremeni Posted February 7, 2011 Share Posted February 7, 2011 Here is the correct file attached, rename it in .php datamodificata.txt 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.