mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #709 from turbo124/master
Table locking for public_id integrity
This commit is contained in:
commit
3b1bfe1013
@ -27,6 +27,7 @@ class EntityModel extends Eloquent
|
||||
$lastEntity = $className::withTrashed()
|
||||
->scope(false, $entity->account_id)
|
||||
->orderBy('public_id', 'DESC')
|
||||
->lockForUpdate()
|
||||
->first();
|
||||
|
||||
if ($lastEntity) {
|
||||
|
@ -66,6 +66,8 @@ class ClientRepository extends BaseRepository
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
if (!$publicId || $publicId == '-1') {
|
||||
$client = Client::createNew();
|
||||
} else {
|
||||
@ -75,6 +77,9 @@ class ClientRepository extends BaseRepository
|
||||
$client->fill($data);
|
||||
$client->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
|
||||
/*
|
||||
if ( ! isset($data['contact']) && ! isset($data['contacts'])) {
|
||||
return $client;
|
||||
|
Loading…
x
Reference in New Issue
Block a user