Jump to content
  • 0

Is There A Way To Find Out What Will Happen If Cron Runs With Particular Settings?


lori

Question

Hi,

 

I have not yet checked the option in the Automation settings to have invoices delivered automatically when the cron job runs. I would like to turn that on, but I really need to know exactly what will be sent before I turn it on. I am coming from WHMCS and the data migration was not completely successful, resulting in unpredictable results for client services and past invoices sent from WHMCS.

 

Is there any way I can see a list of exactly what emails will be sent once I enable the option to deliver invoices automatically? 

 

Thanks.

Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

Thank you. Will they still be sent even if I have already sent them all manually? 

 

Are you sure those are the only ones that will be sent? I am worried that old invoices that were created in WHMCS will also be sent. 

 

I don't believe they will be if you did them manually? did you do them manually on Blesta or WHMCS, if they haven't sent on Blesta they most likely will be sent unless you uncheck the email box on each invoice.

Link to comment
Share on other sites

  • 0

The ones that were created in Blesta were sent by Blesta, in most cases by clicking the checkbox next to the invoice listing in the customers admin area profile page. The ones that were created on WHMCS were sent by WHMCS, but they are not marked as sent in Blesta. In the Invoice Delivery logs, there are dates in the Date Sent column of when the emails were sent by Blesta. Every other email (emails for invoices created in WHMCS) has nothing in the Date Sent column, so I really need to know that all of those emails will not be sent along with the emails for unpaid invoices that were created in Blesta.

Link to comment
Share on other sites

  • 0

Sending invoices manually is independent of the cron delivering invoices.

 

You can view what invoices are queued to be printed from [billing] -> [Print Queue], but there is no way to view what other invoices are queued for delivery (via email, Interfax, etc.) through the interface.

 

Instead, you can run a query on your database to fetch the invoices that the cron would send if that task were enabled:

SELECT * FROM `invoice_delivery` WHERE `method` != 'paper' AND `date_sent` IS NULL;
Link to comment
Share on other sites

  • 0

Thanks. I ran the query and got 113 results. There are not nearly that many invoices that should be sent. The invoice ids appear to correspond to invoices that were created and sent from WHMCS. Is there any way that I can control what will be sent when the cron job runs? I need to find some way around this so that I can turn on automatic invoice emails.

Link to comment
Share on other sites

  • 0

All of those results shouldn't be sent?

 

The cron would deliver invoices from that list, and there isn't a way to change this behavior short of deleting those records or marking them sent by setting a sent date.

 

No, there are only 30 open invoices. The rest were created in WHMCS and sent from WHMCS and have probably all been paid, although I haven't had the time to cross-reference each invoice. Unlikely I will find that much time, so hoping there is a way to fix this and only have the cron send the open invoices.

Link to comment
Share on other sites

  • 0

If you want to remove closed invoices that are still scheduled for delivery, then you can:

  1. Backup your database
  2. Run this query to delete them
    DELETE `invoice_delivery`.* FROM `invoice_delivery` INNER JOIN `invoices` ON `invoices`.`id` = `invoice_delivery`.`invoice_id` WHERE `invoice_delivery`.`method` != 'paper' AND `invoice_delivery`.`date_sent` IS NULL AND `invoices`.`date_closed` IS NOT NULL AND `invoices`.`date_billed` <= UTC_TIMESTAMP() AND `invoices`.`status` = 'active';
    
Link to comment
Share on other sites

  • 0

The cron sends invoices that are queued for delivery. The status of the invoice is irrelevant. For instance, if you create an invoice that you want to be automatically delivered to the client for their records, but the client pays for it immediately after you've created it, it will then be closed. Five minutes later when the cron runs, it will still deliver that closed invoice to the client. If it didn't do this, then the client wouldn't have a copy of the invoice which you explicitly said you wanted done when you created it.

 

The query I included above does not delete closed invoices, rather it removes them from the delivery queue. Those invoices will simply not be queued for delivery anymore, and thus, a copy of them won't be sent to the client when the cron runs. Based on the issue you've described, this sounds like what you want.

Link to comment
Share on other sites

  • 0

For some reason, the query only deleted 8 invoices. No time to really figure out why right now, but wondering if any negative effects can happen if I empty the invoice_delivery table and send the invoices that need to be sent manually this month, then turn on automated invoicing after those invoices are sent. Do you know of any problems that can possibly cause? Thanks.

Link to comment
Share on other sites

  • 0

By removing all records from the `invoice_delivery` table, you would be clearing the queue of all invoices set to be sent, and all invoices that have been sent in the past. There are two downsides which may already be obvious:

  1. Any invoices that were queued to be delivered will not be delivered
  2. The system will no longer have a record of when previously-queued invoices were marked as sent

If you were to empty the `invoice_delivery` table, I see no reason not to then enable the cron task to deliver invoices. Since no invoices would be queued to be delivered, nothing would get sent automatically. If you have existing invoices that should be sent, then you will need to send them manually. Sending them manually will send them immediately, effectively bypassing the queue.

Link to comment
Share on other sites

  • 0

Edited - previous question did not make any sense

 

I have deleted everything from the invoice_delivery table that had a date_sent value of NULL. All remaining rows have a sent date. Double checking to make sure that if I turn on auto-invoicing, only newly generated invoices will be emailed, and not all of the invoices that are in the invoice_delivery table.

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
Answer this question...

×   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.

Loading...
×
×
  • Create New...