mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Set client id number when updating existing records
This commit is contained in:
parent
b831f2c989
commit
06acbe5460
@ -81,13 +81,15 @@ class ClientRepository extends BaseRepository
|
|||||||
// do nothing
|
// do nothing
|
||||||
} elseif (! $publicId || $publicId == '-1') {
|
} elseif (! $publicId || $publicId == '-1') {
|
||||||
$client = Client::createNew();
|
$client = Client::createNew();
|
||||||
if (Auth::check() && Auth::user()->account->client_number_counter && empty($data['id_number'])) {
|
|
||||||
$data['id_number'] = Auth::user()->account->getNextNumber();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$client = Client::scope($publicId)->with('contacts')->firstOrFail();
|
$client = Client::scope($publicId)->with('contacts')->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auto-set the client id number
|
||||||
|
if (Auth::check() && Auth::user()->account->client_number_counter && !$client->id_number && empty($data['id_number'])) {
|
||||||
|
$data['id_number'] = Auth::user()->account->getNextNumber();
|
||||||
|
}
|
||||||
|
|
||||||
if ($client->is_deleted) {
|
if ($client->is_deleted) {
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user