Do not allow restoration of a invoice with a deleted payment
This commit is contained in:
parent
9e69488254
commit
b831658da4
1 changed files with 5 additions and 4 deletions
|
|
@ -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…
Add table
Reference in a new issue