mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Merge pull request #6983 from turbo124/v5-develop
Minor refactor for update balance
This commit is contained in:
commit
5a6cc09b64
@ -136,7 +136,17 @@ class InvoiceService
|
|||||||
*/
|
*/
|
||||||
public function updateBalance($balance_adjustment, bool $is_draft = false)
|
public function updateBalance($balance_adjustment, bool $is_draft = false)
|
||||||
{
|
{
|
||||||
$this->invoice = (new UpdateBalance($this->invoice, $balance_adjustment, $is_draft))->run();
|
// $this->invoice = (new UpdateBalance($this->invoice, $balance_adjustment, $is_draft))->run();
|
||||||
|
|
||||||
|
if ($this->invoice->is_deleted) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->invoice->balance += $balance_adjustment;
|
||||||
|
|
||||||
|
if ($this->invoice->balance == 0 && !$is_draft) {
|
||||||
|
$this->invoice->status_id = Invoice::STATUS_PAID;
|
||||||
|
}
|
||||||
|
|
||||||
if ((int)$this->invoice->balance == 0) {
|
if ((int)$this->invoice->balance == 0) {
|
||||||
$this->invoice->next_send_date = null;
|
$this->invoice->next_send_date = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user