1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for client balances

This commit is contained in:
David Bomba 2021-08-21 14:01:32 +10:00
parent f7b7732f04
commit 71b243bace

View File

@ -184,8 +184,12 @@ class ReminderJob implements ShouldQueue
$invoice->fresh(); $invoice->fresh();
$invoice->service()->deletePdf(); $invoice->service()->deletePdf();
/* Refresh the client here to ensure the balance is fresh */
$client = $invoice->client;
$client = $client->fresh();
nlog("adjusting client balance and invoice balance by ". ($invoice->balance - $temp_invoice_balance)); nlog("adjusting client balance and invoice balance by ". ($invoice->balance - $temp_invoice_balance));
$invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save(); $client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save();
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}"); $invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
return $invoice; return $invoice;