From aff6eb27016254ae57f0ba3cbb5943227787b28a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 20 Jul 2021 14:53:43 +1000 Subject: [PATCH] Fixes for bad country codes in client request --- app/Http/Requests/Client/StoreClientRequest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 1398dfc7eb77..3a3cd81b1654 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -116,7 +116,7 @@ class StoreClientRequest extends Request $input['settings'] = $settings; - if (isset($input['country_code'])) { + if (isset($input['country_code']) && strlen($input['country_code']) == 3) { $input['country_id'] = $this->getCountryCode($input['country_code']); } @@ -144,7 +144,10 @@ class StoreClientRequest extends Request return $item->iso_3166_2 == $country_code || $item->iso_3166_3 == $country_code; })->first(); - return (string) $country->id; + if($country) + return (string) $country->id; + + return ""; } private function getCurrencyCode($code)