Fixes for recurring invoices

This commit is contained in:
David Bomba 2021-10-25 21:39:02 +11:00
parent e7a9576fd4
commit f2f52e05c7
3 changed files with 5 additions and 4 deletions

View File

@ -107,7 +107,7 @@ class RecurringInvoicesCron
SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db);
}
catch(\Exception $e){
nlog("Unable to sending recurring invoice {$recurring_invoice->id}");
nlog("Unable to sending recurring invoice {$recurring_invoice->id} ". $e->getMessage());
}
});

View File

@ -73,13 +73,14 @@ class SendRecurring implements ShouldQueue
$invoice->date = now()->format('Y-m-d');
$invoice->due_date = $this->recurring_invoice->calculateDueDate(now()->format('Y-m-d'));
$invoice->recurring_id = $this->recurring_invoice->id;
$invoice->saveQuietly();
if($invoice->client->getSetting('auto_email_invoice'))
{
$invoice = $invoice->service()
->markSent()
->applyNumber()
->createInvitations() //need to only link invitations to those in the recurring invoice
//->createInvitations() //need to only link invitations to those in the recurring invoice
->fillDefaults()
->save();

View File

@ -33,7 +33,7 @@ class MarkSent extends AbstractService
{
/* Return immediately if status is not draft */
if ($this->invoice->fresh()->status_id != Invoice::STATUS_DRAFT) {
if ($this->invoice && $this->invoice->fresh()->status_id != Invoice::STATUS_DRAFT) {
return $this->invoice;
}