ZeroGravity Posted January 26, 2011 Share Posted January 26, 2011 I have been searching hours for a solution to this. I am using the code provided by Matt (http://forum.whmcs.com/showthread.php?t=26604) to create a custom invoice number. Nothing appears to be happening. I am trying to test in the admin panel. Do the hooks fire from the admin panel? When eactly does this hook fire and/or what triggers it? This is the code for the hook (I put it in the hooks folder). <?php /* *** Create Custom Invoice Number *** This module will check create a custom invoice number using the invoice number created by default and adding a prefix. */ function custom_invoice_number($vars) { $invoiceid = $vars['invoiceid']; // generate invoice number and save $customnumber = date("ym") . $invoiceid; // = yymmInv# update_query("tblinvoices",array("invoicenum"=>$customnumber),array("id"=>$invoiceid)); } add_hook("InvoiceCreationPreEmail",1,"custom_invoice_number"); ?> Any help would be appreciated even a link to a thread I may have missed. I am new to WHMCS, are there logs somewhere that I can check? 0 Quote Link to comment Share on other sites More sharing options...
ZeroGravity Posted February 4, 2011 Author Share Posted February 4, 2011 I tested the function via the admin panel by attaching the function to the InvoicePaid hook and changing an invoice to paid. The function worked, so it is the firing of the hooks that is the issue. I can't get the InvoiceCreationPreEmail or InvoiceCreated hooks to fire via the admin panel. Can someone please tell me if the hooks InvoiceCreationPreEmail and InvoiceCreated can be fired from actions in the admin panel? If so, what events/actions in the admin panel specifically trigger the action hooks I have mentioned above. Many Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Eduardo G. Posted May 3, 2011 Share Posted May 3, 2011 I can confirm InvoiceCreated is not fired from admin :-( I ended using "UpdateInvoiceTotal", so my hook is called every time an item is added or modified in an invoice from admin. Dirty solution, I know 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.