diff --git a/app/Services/Invoice/ApplyPayment.php b/app/Services/Invoice/ApplyPayment.php index eea48ba3974e..fd818c726428 100644 --- a/app/Services/Invoice/ApplyPayment.php +++ b/app/Services/Invoice/ApplyPayment.php @@ -88,6 +88,7 @@ class ApplyPayment extends AbstractService $this->invoice ->client + ->fresh() ->service() ->updateBalance($amount_paid) ->save(); diff --git a/app/Services/Invoice/ApplyPaymentAmount.php b/app/Services/Invoice/ApplyPaymentAmount.php index 564d84f37b2a..3e5db3db72d0 100644 --- a/app/Services/Invoice/ApplyPaymentAmount.php +++ b/app/Services/Invoice/ApplyPaymentAmount.php @@ -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(); } diff --git a/app/Services/Invoice/MarkSent.php b/app/Services/Invoice/MarkSent.php index a8b6d17b2481..d95d7365bd6c 100644 --- a/app/Services/Invoice/MarkSent.php +++ b/app/Services/Invoice/MarkSent.php @@ -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();