1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Small fix for edge case where invoice may appear to be paid

This commit is contained in:
David Bomba 2021-08-29 21:17:27 +10:00
parent 0a25df317e
commit ac763b3a0a

View File

@ -192,6 +192,8 @@ class InvoiceService
public function handleCancellation()
{
$this->removeUnpaidGatewayFees();
$this->invoice = (new HandleCancellation($this->invoice))->run();
return $this;
@ -199,6 +201,8 @@ class InvoiceService
public function markDeleted()
{
$this->removeUnpaidGatewayFees();
$this->invoice = (new MarkInvoiceDeleted($this->invoice))->run();
return $this;
@ -213,6 +217,8 @@ class InvoiceService
public function reverseCancellation()
{
$this->removeUnpaidGatewayFees();
$this->invoice = (new HandleCancellation($this->invoice))->reverse();
return $this;
@ -278,11 +284,14 @@ class InvoiceService
public function updateStatus()
{
if ((int)$this->invoice->balance == 0) {
if($this->invoice->status_id == Invoice::STATUS_DRAFT)
return $this;
// if ((int)$this->invoice->balance == 0) {
$this->setStatus(Invoice::STATUS_PAID)->workFlow();
// InvoiceWorkflowSettings::dispatchNow($this->invoice);
}
// $this->setStatus(Invoice::STATUS_PAID)->workFlow();
// }
if ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
$this->setStatus(Invoice::STATUS_PARTIAL);