Jump to content

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


izzo

Recommended Posts

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?

Link to comment
Share on other sites

I took out the hook, and its still doing the same behaviour,

upon running from the shell i get the following output:

 

[root@whmcs whmcs]# /usr/bin/php -q /var/www/html/whmcs/beheer/cron.php

Starting

Starting Updating Currency Exchange Rates

- Done

Starting Generating Invoices

Invoicing Loop Service ID 2120 - 1 of 2

Invoicing Loop Service ID 2122 - 2 of 2

Invoicing Loop Domain ID 1010 - 1 of 13

Invoicing Loop Domain ID 1120 - 2 of 13

Invoicing Loop Domain ID 1221 - 3 of 13

Invoicing Loop Domain ID 1024 - 4 of 13

Invoicing Loop Domain ID 1023 - 5 of 13

Invoicing Loop Domain ID 1028 - 6 of 13

Invoicing Loop Domain ID 1025 - 7 of 13

Invoicing Loop Domain ID 117 - 8 of 13

Invoicing Loop Domain ID 443 - 9 of 13

Invoicing Loop Domain ID 444 - 10 of 13

Invoicing Loop Domain ID 116 - 11 of 13

Invoicing Loop Domain ID 118 - 12 of 13

Invoicing Loop Domain ID 115 - 13 of 13

Generated Invoice #201491210

Generated Invoice #201491211

[root@whmcs whmcs]#

 

 

It just dies after the second invoice everytime, and that invoice doesn't get emailed. The first one does.

I'm stumped and can't find any related error messages.

Link to comment
Share on other sites

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