mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:54:41 -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) {
|
foreach ($this->refund_data['invoices'] as $refunded_invoice) {
|
||||||
$invoice = Invoice::withTrashed()->find($refunded_invoice['invoice_id']);
|
$invoice = Invoice::withTrashed()->find($refunded_invoice['invoice_id']);
|
||||||
|
|
||||||
|
$invoice->restore();
|
||||||
|
|
||||||
$invoice->service()->updateBalance($refunded_invoice['amount'])->save();
|
$invoice->service()->updateBalance($refunded_invoice['amount'])->save();
|
||||||
$invoice->ledger()->updateInvoiceBalance($refunded_invoice['amount'], "Refund of payment # {$this->payment->number}")->save();
|
$invoice->ledger()->updateInvoiceBalance($refunded_invoice['amount'], "Refund of payment # {$this->payment->number}")->save();
|
||||||
$invoice->paid_to_date -= $refunded_invoice['amount'];
|
$invoice->paid_to_date -= $refunded_invoice['amount'];
|
||||||
@ -292,6 +294,9 @@ class RefundPayment
|
|||||||
|
|
||||||
TransactionLog::dispatch(TransactionEvent::PAYMENT_REFUND, $transaction, $invoice->company->db);
|
TransactionLog::dispatch(TransactionEvent::PAYMENT_REFUND, $transaction, $invoice->company->db);
|
||||||
|
|
||||||
|
if($invoice->is_deleted)
|
||||||
|
$invoice->delete();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = $this->payment->client->fresh();
|
$client = $this->payment->client->fresh();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user