mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 09:24:33 -04:00
Fixes for recurring invoices sending to clients that are not checked
This commit is contained in:
parent
60d05ab331
commit
f95ed170ed
@ -56,6 +56,17 @@ class SendRecurring implements ShouldQueue
|
||||
*/
|
||||
public function handle() : void
|
||||
{
|
||||
//reset all contacts here
|
||||
$this->recurring_invoice->client->contacts()->update(['send_email' => false]);
|
||||
|
||||
$this->recurring_invoice->invitations->each(function ($invitation){
|
||||
|
||||
$contact = $invitation->contact;
|
||||
$contact->send_email = true;
|
||||
$contact->save();
|
||||
|
||||
});
|
||||
|
||||
// Generate Standard Invoice
|
||||
$invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client);
|
||||
|
||||
@ -67,7 +78,7 @@ class SendRecurring implements ShouldQueue
|
||||
$invoice = $invoice->service()
|
||||
->markSent()
|
||||
->applyNumber()
|
||||
->createInvitations()
|
||||
->createInvitations() //need to only link invitations to those in the recurring invoice
|
||||
->fillDefaults()
|
||||
->save();
|
||||
|
||||
|
@ -49,16 +49,15 @@ class RecurringService
|
||||
|
||||
public function start()
|
||||
{
|
||||
//make sure next_send_date is either now or in the future else return.
|
||||
// if(Carbon::parse($this->recurring_entity->next_send_date)->lt(now()))
|
||||
// return $this;
|
||||
|
||||
if ($this->recurring_entity->remaining_cycles == 0) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->createInvitations()->setStatus(RecurringInvoice::STATUS_ACTIVE);
|
||||
// $this->createInvitations()->setStatus(RecurringInvoice::STATUS_ACTIVE);
|
||||
|
||||
$this->setStatus(RecurringInvoice::STATUS_ACTIVE);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user