mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Refactor client country assignment
This commit is contained in:
parent
ce2ad45015
commit
989f5c9210
@ -28,7 +28,7 @@ class ClientFactory
|
|||||||
$client->public_notes = '';
|
$client->public_notes = '';
|
||||||
$client->balance = 0;
|
$client->balance = 0;
|
||||||
$client->paid_to_date = 0;
|
$client->paid_to_date = 0;
|
||||||
$client->country_id = 840;
|
$client->country_id = null;
|
||||||
$client->is_deleted = 0;
|
$client->is_deleted = 0;
|
||||||
$client->client_hash = Str::random(40);
|
$client->client_hash = Str::random(40);
|
||||||
$client->settings = ClientSettings::defaults();
|
$client->settings = ClientSettings::defaults();
|
||||||
|
@ -58,11 +58,11 @@ class ClientRepository extends BaseRepository
|
|||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$client->id && auth()->user() && auth()->user()->company() && (!array_key_exists('country_id', $data) || empty($data['country_id']))){
|
|
||||||
$data['country_id'] = auth()->user()->company()->settings->country_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$client->fill($data);
|
$client->fill($data);
|
||||||
|
|
||||||
|
if(!$client->country_id)
|
||||||
|
$client->country_id = auth()->user()->company()->settings->country_id;
|
||||||
|
|
||||||
$client->save();
|
$client->save();
|
||||||
|
|
||||||
if (!isset($client->number) || empty($client->number) || strlen($client->number) == 0) {
|
if (!isset($client->number) || empty($client->number) || strlen($client->number) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user