Bertie Posted February 19, 2020 Share Posted February 19, 2020 (edited) Hi, Is there a way if a client disables auto-renew on a domain name which then removes it from an active invoice. That specific invoice is then re-sent out to the client? For example an invoice on a clients account had two items. One of them was removed as they disabled auto-renew on the domain name. Is it possible to make that invoice to be sent back to the client via email with the updated version? It would only make sense if the invoice had multiple products on them though so not sure if that makes it even harder to do. Have an awkward accounts department for a client who refuses to log into the portal to see the updated invoices. So seeing if there is an easier way to make this better for everyone involved. Cheers, Edited February 19, 2020 by Bertie 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted February 19, 2020 Share Posted February 19, 2020 (edited) I think you could use this hook: UpdateInvoiceTotal Quote Executes when an invoice is updated with changes to or additions of line items. Can be used to manipulate the invoice. Try this: <?php /** * WHMCS hook that will automatically send the 'Invoice Modified' once an invoice is modified * @author DennisHermannsen */ add_hook('UpdateInvoiceTotal', 1, function($vars) { $command = 'SendEmail'; $postData = array( 'messagename' => 'Invoice Modified', 'id' => $vars['invoiceid'], ); localAPI($command, $postData); }); I've tested it on my dev installation and it seems to work just fine. I'm using this API call: https://developers.whmcs.com/api-reference/sendemail/ Edit: A thing that is worth to mention is that laws in some countries doesn't allow you to change anything (not even the address or name of receiver) about an invoice once it has been sent. Unfortunately, WHMCS doesn't care for this at all and will still modify the invoices. It's a shame. Edited February 19, 2020 by DennisHermannsen 1 Quote Link to comment Share on other sites More sharing options...
Bertie Posted February 19, 2020 Author Share Posted February 19, 2020 46 minutes ago, DennisHermannsen said: I think you could use this hook: UpdateInvoiceTotal Try this: <?php /** * WHMCS hook that will automatically send the 'Invoice Modified' once an invoice is modified * @author DennisHermannsen */ add_hook('UpdateInvoiceTotal', 1, function($vars) { $command = 'SendEmail'; $postData = array( 'messagename' => 'Invoice Modified', 'id' => $vars['invoiceid'], ); localAPI($command, $postData); }); I've tested it on my dev installation and it seems to work just fine. I'm using this API call: https://developers.whmcs.com/api-reference/sendemail/ Edit: A thing that is worth to mention is that laws in some countries doesn't allow you to change anything (not even the address or name of receiver) about an invoice once it has been sent. Unfortunately, WHMCS doesn't care for this at all and will still modify the invoices. It's a shame. I shall give it a go and see what happens. Regarding your last comment: Yeah I've seen that a credit note function was requested 4 years ago and it's still in "Planned" status. Really not sure what is taking so long considering many countries require such things. 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted February 19, 2020 Share Posted February 19, 2020 1 hour ago, Bertie said: Really not sure what is taking so long considering many countries require such things. Time and effort. It takes time to learn accounting laws for a single country. It takes forever to learn the laws of every country. Sadly, that's not an excuse. The more I've learned about different countries' laws about accounting, the more it feels like WHMCS is made solely by developers without much input from accountants. 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.