From f009f081711585c2ccbb34737293b2b66ffe7df3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 12 Jul 2023 09:04:27 +1000 Subject: [PATCH] Handle edge case when deleting/restoring invoices --- app/Services/Invoice/HandleRestore.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/Invoice/HandleRestore.php b/app/Services/Invoice/HandleRestore.php index 18502189f485..4dc9621f4acf 100644 --- a/app/Services/Invoice/HandleRestore.php +++ b/app/Services/Invoice/HandleRestore.php @@ -44,6 +44,7 @@ class HandleRestore extends AbstractService //cannot restore an invoice with a deleted payment foreach ($this->invoice->payments as $payment) { if (($this->invoice->paid_to_date == 0) && $payment->is_deleted) { + $this->invoice->delete(); //set it back to deleted so that it can be restored from repository return $this->invoice; } }