mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Do not allow restoration of a invoice with a deleted payment
This commit is contained in:
parent
9e69488254
commit
b831658da4
@ -44,11 +44,12 @@ class HandleRestore extends AbstractService
|
||||
return $this->invoice;
|
||||
}
|
||||
|
||||
//determine whether we need to un-delete payments OR just modify the payment amount /applied balances.
|
||||
|
||||
//cannot restore an invoice with a deleted payment
|
||||
foreach ($this->invoice->payments as $payment) {
|
||||
//restore the payment record
|
||||
$this->invoice->restore();
|
||||
|
||||
if(($this->invoice->paid_to_date == 0) && $payment->is_deleted)
|
||||
return $this->invoice;
|
||||
|
||||
}
|
||||
|
||||
//adjust ledger balance
|
||||
|
Loading…
x
Reference in New Issue
Block a user