mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for reversing invoice balances on archived invoice
This commit is contained in:
parent
1a21460626
commit
cdf8f04457
@ -263,6 +263,8 @@ class RefundPayment
|
||||
foreach ($this->refund_data['invoices'] as $refunded_invoice) {
|
||||
$invoice = Invoice::withTrashed()->find($refunded_invoice['invoice_id']);
|
||||
|
||||
$invoice->restore();
|
||||
|
||||
$invoice->service()->updateBalance($refunded_invoice['amount'])->save();
|
||||
$invoice->ledger()->updateInvoiceBalance($refunded_invoice['amount'], "Refund of payment # {$this->payment->number}")->save();
|
||||
$invoice->paid_to_date -= $refunded_invoice['amount'];
|
||||
@ -292,6 +294,9 @@ class RefundPayment
|
||||
|
||||
TransactionLog::dispatch(TransactionEvent::PAYMENT_REFUND, $transaction, $invoice->company->db);
|
||||
|
||||
if($invoice->is_deleted)
|
||||
$invoice->delete();
|
||||
|
||||
}
|
||||
|
||||
$client = $this->payment->client->fresh();
|
||||
|
Loading…
x
Reference in New Issue
Block a user