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

Fixes for marking invoice as sent

This commit is contained in:
David Bomba 2021-11-10 16:41:33 +11:00
parent 2c289bbe4e
commit 193e473c8a

View File

@ -37,34 +37,37 @@ class MarkSent extends AbstractService
return $this->invoice;
}
$adjustment = $this->invoice->amount;
/*Set status*/
$this->invoice
->service()
->setStatus(Invoice::STATUS_SENT)
->updateBalance($adjustment, true)
->save();
$this->invoice
/*Adjust client balance*/
$this->client
->service()
->updateBalance($adjustment)
->save();
/*Update ledger*/
$this->invoice
->ledger()
->updateInvoiceBalance($adjustment, "Invoice {$this->invoice->number} marked as sent.");
/* Perform additional actions on invoice */
$this->invoice
->service()
->applyNumber()
->setDueDate()
->updateBalance($this->invoice->amount, true)
->deletePdf()
->setReminder()
->save();
$this->invoice->markInvitationsSent();
/*Adjust client balance*/
$this->client
->service()
->updateBalance($this->invoice->balance)
->save();
/*Update ledger*/
$this->invoice
->ledger()
->updateInvoiceBalance($this->invoice->balance, "Invoice {$this->invoice->number} marked as sent.");
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
return $this->invoice->fresh();