Quantcast
Channel: WHMCS Community Forums
Viewing all articles
Browse latest Browse all 13458

Cronjob only generating 2 invoices and quits and only the first gets mailed to the client

$
0
0
Hi Guys,

I'm having a strange problem with whmcs.
On the dialy cronjob it creates only 2 invoices and then quits the cronjob, not making the backups etc.
After creating the first email, it sends it to the client, after makeing the second invoice it just stops.

here is part is the activity log:
16/05/2014 03:35 Created Invoice - Invoice ID: 201491200
16/05/2014 03:35 Email Sent to ****** (******) - User ID: *******
16/05/2014 03:35 Cron Job: Hook Completed - Returned False
16/05/2014 03:35 Cron Job: Running Hook Point EmailPreSend:disable_00_invoices
16/05/2014 03:35 Created Invoice - Invoice ID: 201491199
16/05/2014 03:35 Cron Job: Starting Generating Invoices
16/05/2014 03:35 Cron Job: Done
16/05/2014 03:35 Cron Job: Starting Updating Currency Exchange Rates
16/05/2014 03:35 Cron Job: Starting

After generating the 201491200 invoice, the cronjob dies, if i rerun it it continues , and only does 2 invoices again, i suspect it might have something to do with the disable_00_invoices hook, but i cannot disable this as my customers do not want invoices for domains that they got free with their product.

Here is the hook (its from the forums)
<?php

function disable_00_invoices($vars) {

$email_template_name = $vars['messagename']; # Email template name being sent
$relid = $vars['relid']; # Related ID it's being sent for - client ID, invoice ID, etc...

//Checking for certain template name, if so - this is our case
if ($email_template_name == "Invoice Created" || $email_template_name == "Invoice Payment Confirmation")
{
//getting total of the invoice
$result = select_query('tblinvoices', 'total', array("id" => $relid));
$data = mysql_fetch_assoc($result);
//if it is equal to '0.00' we disable email sending
if (isset($data['total']) && $data['total'] == '0.00')
$merge_fields['abortsend'] = true;
}

return $merge_fields;
}

add_hook("EmailPreSend",1,"disable_00_invoices");

Any ideas or anyone having the same issues?

Viewing all articles
Browse latest Browse all 13458

Trending Articles