mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Handle edge case when deleting/restoring invoices
This commit is contained in:
parent
8e12cfe4d5
commit
f009f08171
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user