mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 17:04:45 -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
|
||||
->client
|
||||
->fresh()
|
||||
->service()
|
||||
->updateBalance($amount_paid)
|
||||
->save();
|
||||
|
@ -43,7 +43,7 @@ class ApplyPaymentAmount extends AbstractService
|
||||
public function run()
|
||||
{
|
||||
if ($this->invoice->status_id == Invoice::STATUS_DRAFT) {
|
||||
$this->invoice->service()->markSent()->save();
|
||||
$this->invoice = $this->invoice->service()->markSent()->save();
|
||||
}
|
||||
|
||||
/*Don't double pay*/
|
||||
@ -88,10 +88,8 @@ class ApplyPaymentAmount extends AbstractService
|
||||
|
||||
$this->invoice
|
||||
->client
|
||||
->fresh()
|
||||
->service()
|
||||
->updateBalance($payment->amount * -1)
|
||||
->updatePaidToDate($payment->amount)
|
||||
->updateBalanceAndPaidToDate($payment->amount * -1, $payment->amount)
|
||||
->save();
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ class MarkPaid extends AbstractService
|
||||
}
|
||||
|
||||
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 () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user