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

Fresh client prior to updating

This commit is contained in:
David Bomba 2022-09-02 14:22:04 +10:00
parent 6bd300a49b
commit fee7d2c697
3 changed files with 5 additions and 0 deletions

View File

@ -88,6 +88,7 @@ class ApplyPayment extends AbstractService
$this->invoice
->client
->fresh()
->service()
->updateBalance($amount_paid)
->save();

View File

@ -17,6 +17,7 @@ use App\Factory\PaymentFactory;
use App\Jobs\Invoice\InvoiceWorkflowSettings;
use App\Jobs\Payment\EmailPayment;
use App\Libraries\Currency\Conversion\CurrencyApi;
use App\Models\Client;
use App\Models\Invoice;
use App\Models\Payment;
use App\Services\AbstractService;
@ -87,11 +88,13 @@ class ApplyPaymentAmount extends AbstractService
$this->invoice
->client
->fresh()
->service()
->updateBalance($payment->amount * -1)
->updatePaidToDate($payment->amount)
->save();
if ($this->invoice->client->getSetting('client_manual_payment_notification')) {
$payment->service()->sendEmail();
}

View File

@ -69,6 +69,7 @@ class MarkSent extends AbstractService
$client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
$client->balance += $adjustment;
$client->save();
}, 1);
$this->invoice->markInvitationsSent();