mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Checks inside transactions
This commit is contained in:
parent
7768f714e1
commit
1720baccc8
@ -57,6 +57,8 @@ class MarkPaid extends AbstractService
|
||||
|
||||
$this->invoice = Invoice::withTrashed()->where('id', $this->invoice->id)->lockForUpdate()->first();
|
||||
|
||||
if($this->invoice)
|
||||
{
|
||||
$this->payable_balance = $this->invoice->balance;
|
||||
|
||||
$this->invoice
|
||||
@ -66,6 +68,7 @@ class MarkPaid extends AbstractService
|
||||
->updatePaidToDate($this->payable_balance)
|
||||
->setStatus(Invoice::STATUS_PAID)
|
||||
->save();
|
||||
}
|
||||
|
||||
}, 1);
|
||||
|
||||
|
@ -40,7 +40,7 @@ class DeletePayment
|
||||
|
||||
$this->payment = Payment::withTrashed()->where('id', $this->payment->id)->lockForUpdate()->first();
|
||||
|
||||
if (!$this->payment->is_deleted) {
|
||||
if ($this->payment && !$this->payment->is_deleted) {
|
||||
|
||||
$this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
|
||||
->updateCreditables() //return the credits first
|
||||
|
Loading…
x
Reference in New Issue
Block a user