1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Release transactions on failures

This commit is contained in:
David Bomba 2022-04-26 11:46:33 +10:00
parent bc76424fd7
commit 3a6258fd42
3 changed files with 6 additions and 2 deletions

View File

@ -309,6 +309,10 @@ class BaseImport
);
}
} catch (\Exception $ex) {
if(\DB::connection(config('database.default'))->transactionLevel() > 0)
\DB::connection(config('database.default'))->rollBack();
if ($ex instanceof ImportException) {
$message = $ex->getMessage();
} else {

View File

@ -445,7 +445,7 @@ class StripePaymentDriver extends BaseDriver
if(count($searchResults) == 1){
$customer = $searchResults->data[0];
$this->updateStripeCustomer($customer);
// $this->updateStripeCustomer($customer);
return $customer;
}

View File

@ -105,7 +105,7 @@ class MarkPaid extends AbstractService
/* Get the last record for the client and set the current balance*/
$client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first();
$client->paid_to_date += $payment->amount;
$client->balance += $payment->amount * -1;
$client->balance -= $payment->amount;
$client->save();
}, 1);