Alberto464 Posted July 11, 2021 Share Posted July 11, 2021 Hi, I created a function that when called via Hook renames the invoices that are created, this allows me to have my own name without using the IDs. This function almost always works correctly, except in one case: when I enter the customer profile from the administrator area, and click on "Create Add Funds Invoice". In this case the function does not start. What Hook should I use in this case? I am attaching my function and also the hooks I used to call it. function DN_writeNUMproforma($vars) { $inv_id = $vars['invoiceid']; $invoicenum_db = Capsule::table('tblinvoices')->where('id', $inv_id)->value('invoicenum'); if ($invoicenum_db == null) { $proforma_num = 'FP-' . date('Y') . '-' . date('m') . $inv_id . rand(0,9); Capsule::table('tblinvoices') ->where('id', $inv_id) ->update( [ 'invoicenum' => $proforma_num, ] ); } } // ========================================================================= // Hook // ========================================================================= add_hook('InvoiceCreated',1,'DN_writeNUMproforma'); add_hook('InvoiceCreation',1,'DN_writeNUMproforma'); add_hook('InvoiceCreationPreEmail',1,'DN_writeNUMproforma'); add_hook('InvoiceCreationAdminArea', 1,'DN_writeNUMproforma'); 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.