1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Start recurring invoice on send now

This commit is contained in:
David Bomba 2022-07-12 20:47:17 +10:00
parent 63eb2ca524
commit 7157c95ef4
2 changed files with 4 additions and 2 deletions

View File

@ -302,7 +302,7 @@ class BaseRepository
/* Perform model specific tasks */
if ($model instanceof Invoice) {
if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT && $model->status_id != Invoice::STATUS_PAID)) {
if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) {
//10-07-2022
$model->service()->updateStatus()->save();

View File

@ -123,8 +123,10 @@ class RecurringService
public function sendNow()
{
if($this->recurring_entity instanceof RecurringInvoice)
if($this->recurring_entity instanceof RecurringInvoice && $this->recurring_entity->status_id == RecurringInvoice::STATUS_DRAFT){
$this->start()->save();
SendRecurring::dispatchNow($this->recurring_entity, $this->recurring_entity->company->db);
}
return $this->recurring_entity;