Prevent draft invoice from being marked as partial

This commit is contained in:
Hillel Coren 2017-06-21 15:59:29 +03:00
parent 112fc57c1d
commit 4b291f6c7e

View File

@ -531,7 +531,7 @@ class Invoice extends EntityModel implements BalanceAffecting
$statusId = false; $statusId = false;
if ($this->amount != 0 && $this->balance == 0) { if ($this->amount != 0 && $this->balance == 0) {
$statusId = INVOICE_STATUS_PAID; $statusId = INVOICE_STATUS_PAID;
} elseif ($this->balance > 0 && $this->balance < $this->amount) { } elseif ($this->isSent() && $this->balance > 0 && $this->balance < $this->amount) {
$statusId = INVOICE_STATUS_PARTIAL; $statusId = INVOICE_STATUS_PARTIAL;
} elseif ($this->isPartial() && $this->balance > 0) { } elseif ($this->isPartial() && $this->balance > 0) {
$statusId = ($this->balance == $this->amount ? INVOICE_STATUS_SENT : INVOICE_STATUS_PARTIAL); $statusId = ($this->balance == $this->amount ? INVOICE_STATUS_SENT : INVOICE_STATUS_PARTIAL);