Jump to content

AWOL Action Hook


ZeroGravity

Recommended Posts

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?

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 2 months later...

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