Jump to content

frankrio

Newbie
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About frankrio

  • Rank
    Junior Member
  1. InvoiceCreated Hook for auto invoices

    I just wanted to share my tests, hopefully they will be of help for others to verify the behaviour of hooks in cron executions. I've tested the cron execution of the InvoiceCreationPreEmail hook and it is working on WHMCS 7.2.3. Bear in mind that the cron.php script doesn't always process all the tasks, in particular the InvoiceCreation task is only executed once a day. The best way to test cron tasks individually is to run the cron script from terminal and make use of its different options: the docs for the cron script describe all of them (https://docs.whmcs.com/Crons#System_Cron_2). In my case I tried hooking to the InvoiceCreationPreEmail hook, with a simple script to output the hook's variables. add_hook('InvoiceCreationPreEmail', 1, function($vars) { print_r($vars); die(); }); To then test the execution from cron, I ran the cron.php script with these options: php -q ./crons/cron.php do --CreateInvoices -v The do option skips all the cron tasks except --CreateInvoices, while the -v option is obviously for a verbose output. This is the result in my case: # php -q ./crons/cron.php do --CreateInvoices -v ea-php-cli Copyright 2017 cPanel, Inc. WHMCS Automation Task Utility: do ================================= Queuing Tasks ------------- Task queues ready Executing Application Queue --------------------------- 0/1 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0% < 1 secArray ( [source] => autogen [user] => system [invoiceid] => 95 [status] => Unpaid )
  2. Welcome to WHMCS.Community frankrio! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines