Fixes for refunding archived invoices

This commit is contained in:
David Bomba 2021-08-08 11:02:41 +10:00
parent d29f1798a2
commit 3a9ca8e6e1

View File

@ -232,7 +232,7 @@ class RefundPayment
if (isset($this->refund_data['invoices']) && count($this->refund_data['invoices']) > 0) {
foreach ($this->refund_data['invoices'] as $refunded_invoice) {
$invoice = Invoice::find($refunded_invoice['invoice_id']);
$invoice = Invoice::withTrashed()->find($refunded_invoice['invoice_id']);
$invoice->service()->updateBalance($refunded_invoice['amount'])->save();
$invoice->ledger()->updateInvoiceBalance($refunded_invoice['amount'], "Refund of payment # {$this->payment->number}")->save();