mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 18:07:35 -04:00 
			
		
		
		
	Release transactions on failures
This commit is contained in:
		
							parent
							
								
									bc76424fd7
								
							
						
					
					
						commit
						3a6258fd42
					
				| @ -309,6 +309,10 @@ class BaseImport | |||||||
| 					); | 					); | ||||||
| 				} | 				} | ||||||
| 			} catch (\Exception $ex) { | 			} catch (\Exception $ex) { | ||||||
|  | 				 | ||||||
|  | 				if(\DB::connection(config('database.default'))->transactionLevel() > 0) | ||||||
|  | 					\DB::connection(config('database.default'))->rollBack(); | ||||||
|  | 
 | ||||||
| 				if ($ex instanceof ImportException) { | 				if ($ex instanceof ImportException) { | ||||||
| 					$message = $ex->getMessage(); | 					$message = $ex->getMessage(); | ||||||
| 				} else { | 				} else { | ||||||
|  | |||||||
| @ -445,7 +445,7 @@ class StripePaymentDriver extends BaseDriver | |||||||
| 
 | 
 | ||||||
|         if(count($searchResults) == 1){ |         if(count($searchResults) == 1){ | ||||||
|             $customer = $searchResults->data[0]; |             $customer = $searchResults->data[0]; | ||||||
|             $this->updateStripeCustomer($customer); |            // $this->updateStripeCustomer($customer);
 | ||||||
|             return $customer;  |             return $customer;  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -105,7 +105,7 @@ class MarkPaid extends AbstractService | |||||||
|         /* Get the last record for the client and set the current balance*/ |         /* Get the last record for the client and set the current balance*/ | ||||||
|             $client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first(); |             $client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first(); | ||||||
|             $client->paid_to_date += $payment->amount; |             $client->paid_to_date += $payment->amount; | ||||||
|             $client->balance += $payment->amount * -1; |             $client->balance -= $payment->amount; | ||||||
|             $client->save(); |             $client->save(); | ||||||
| 
 | 
 | ||||||
|         }, 1); |         }, 1); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user