From 4faa58ec8c1cdb4b5dcb6765e8597917d1eae53f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 25 Mar 2022 14:49:51 +1100 Subject: [PATCH] minor fixes for client country in repo --- app/Repositories/ClientRepository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php index 811b43edaacf..cccf3d04d80f 100644 --- a/app/Repositories/ClientRepository.php +++ b/app/Repositories/ClientRepository.php @@ -59,11 +59,15 @@ class ClientRepository extends BaseRepository } $client->fill($data); + - if(!$client->country_id) + if(auth()->user() && !$client->country_id){ $client->country_id = auth()->user()->company()->settings->country_id; + + } $client->save(); + if (!isset($client->number) || empty($client->number) || strlen($client->number) == 0) { $client->number = $this->getNextClientNumber($client);