mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 00:04:29 -04:00
CLean up code paths for client balance
This commit is contained in:
parent
4e29459985
commit
28915d82a4
@ -88,7 +88,6 @@ class ApplyPayment extends AbstractService
|
|||||||
|
|
||||||
$this->invoice
|
$this->invoice
|
||||||
->client
|
->client
|
||||||
->fresh()
|
|
||||||
->service()
|
->service()
|
||||||
->updateBalance($amount_paid)
|
->updateBalance($amount_paid)
|
||||||
->save();
|
->save();
|
||||||
|
@ -43,7 +43,7 @@ class ApplyPaymentAmount extends AbstractService
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
||||||
$this->invoice->service()->markSent()->save();
|
$this->invoice = $this->invoice->service()->markSent()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Don't double pay*/
|
/*Don't double pay*/
|
||||||
@ -88,10 +88,8 @@ class ApplyPaymentAmount extends AbstractService
|
|||||||
|
|
||||||
$this->invoice
|
$this->invoice
|
||||||
->client
|
->client
|
||||||
->fresh()
|
|
||||||
->service()
|
->service()
|
||||||
->updateBalance($payment->amount * -1)
|
->updateBalanceAndPaidToDate($payment->amount * -1, $payment->amount)
|
||||||
->updatePaidToDate($payment->amount)
|
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class MarkPaid extends AbstractService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
||||||
$this->invoice->service()->markSent()->save();
|
$this->invoice = $this->invoice->service()->markSent()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
\DB::connection(config('database.default'))->transaction(function () {
|
\DB::connection(config('database.default'))->transaction(function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user