From 4b291f6c7ec5b588e24c03b218254876f0d13ce7 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 21 Jun 2017 15:59:29 +0300 Subject: [PATCH] Prevent draft invoice from being marked as partial --- app/Models/Invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 6bb238bf2aa4..aa482be1ff5d 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -531,7 +531,7 @@ class Invoice extends EntityModel implements BalanceAffecting $statusId = false; if ($this->amount != 0 && $this->balance == 0) { $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; } elseif ($this->isPartial() && $this->balance > 0) { $statusId = ($this->balance == $this->amount ? INVOICE_STATUS_SENT : INVOICE_STATUS_PARTIAL);