diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index ab270b8f0c05..3a320ef237bf 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -390,7 +390,6 @@ class LoginController extends BaseController $truth = app()->make(TruthSource::class); - $truth->setCompanyUser($cu->first()); $truth->setUser(auth()->user()); $truth->setCompany(auth()->user()->account->default_company); diff --git a/app/Services/Invoice/ApplyPaymentAmount.php b/app/Services/Invoice/ApplyPaymentAmount.php index 51ec7995955d..092d3e01a147 100644 --- a/app/Services/Invoice/ApplyPaymentAmount.php +++ b/app/Services/Invoice/ApplyPaymentAmount.php @@ -84,6 +84,13 @@ class ApplyPaymentAmount extends AbstractService ->deletePdf() ->save(); + $this->invoice + ->client + ->service() + ->updateBalance($payment->amount * -1) + ->updatePaidToDate($payment->amount) + ->save(); + if ($this->invoice->client->getSetting('client_manual_payment_notification')) $payment->service()->sendEmail(); @@ -92,13 +99,6 @@ class ApplyPaymentAmount extends AbstractService $payment->ledger() ->updatePaymentBalance($payment->amount * -1); - $this->invoice - ->client - ->service() - ->updateBalance($payment->amount * -1) - ->updatePaidToDate($payment->amount) - ->save(); - $this->invoice->service()->workFlow()->save(); event('eloquent.created: App\Models\Payment', $payment);