diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index b8525022c476..d0f4ee68f5da 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -732,6 +732,15 @@ class BaseImport protected function findUser($user_hash) { + if(is_numeric($user_hash)) { + + $user = User::query()->find($user_hash); + + } + + if($user) + return $user->id; + $user = User::where('account_id', $this->company->account->id) ->where( \DB::raw('CONCAT_WS(" ", first_name, last_name)')->getValue(\DB::connection()->getQueryGrammar()), diff --git a/app/Import/Transformer/BaseTransformer.php b/app/Import/Transformer/BaseTransformer.php index a979a85082e8..1ae726605d57 100644 --- a/app/Import/Transformer/BaseTransformer.php +++ b/app/Import/Transformer/BaseTransformer.php @@ -238,14 +238,15 @@ class BaseTransformer */ public function hasClient($name) { + nlog("has client"); return Client::query()->where('company_id', $this->company->id) ->where('is_deleted', false) - ->whereRaw("LOWER(REPLACE(`name`, ' ' ,'')) = ?", [ + ->whereRaw("LOWER(REPLACE(`name`, ' ' , '')) = ?", [ strtolower(str_replace(' ', '', $name)), ]) ->exists(); } - + public function hasClientIdNumber($id_number) { return Client::query()->where('company_id', $this->company->id) diff --git a/tests/Integration/EventTest.php b/tests/Integration/EventTest.php index 37100f380b7d..e26560691042 100644 --- a/tests/Integration/EventTest.php +++ b/tests/Integration/EventTest.php @@ -903,7 +903,7 @@ class EventTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->postJson('/api/v1/purchase_orders/bulk?action=approve', $data) + ])->postJson('/api/v1/purchase_orders/bulk?action=mark_sent', $data) ->assertStatus(200); $response = $this->withHeaders([