From a391258345a293493bcd828484e1dcea70457e3a Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Tue, 24 Sep 2024 10:01:38 +0300 Subject: [PATCH] lookupPersonByLogin vs lookupPersonForLogin fix --- app/src/Lib/Traits/EnrollmentControllerTrait.php | 7 ++++++- app/src/Model/Table/IdentifiersTable.php | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/Lib/Traits/EnrollmentControllerTrait.php b/app/src/Lib/Traits/EnrollmentControllerTrait.php index 6e0b4a6d6..5941528b4 100644 --- a/app/src/Lib/Traits/EnrollmentControllerTrait.php +++ b/app/src/Lib/Traits/EnrollmentControllerTrait.php @@ -29,6 +29,7 @@ namespace App\Lib\Traits; +use Cake\Datasource\Exception\RecordNotFoundException; use Cake\ORM\TableRegistry; use \App\Lib\Enum\EnrollmentActorEnum; use \App\Model\Entity\Petition; @@ -64,7 +65,11 @@ protected function getCurrentActor(?int $petitionId=null): array { $Identifiers = TableRegistry::getTableLocator()->get('Identifiers'); - $ret['person_id'] = $Identifiers->lookupPersonForLogin($ret['identifier'], $this->getCOID()); + try { + $ret['person_id'] = $Identifiers->lookupPersonByLogin($this->getCOID(), $ret['identifier']); + } catch(RecordNotFoundException $e) { + $ret['person_id'] = null; + } if(!empty($ret['person_id'])) { $ret['type'] = 'person'; diff --git a/app/src/Model/Table/IdentifiersTable.php b/app/src/Model/Table/IdentifiersTable.php index b856dac97..51cece8e3 100644 --- a/app/src/Model/Table/IdentifiersTable.php +++ b/app/src/Model/Table/IdentifiersTable.php @@ -264,6 +264,7 @@ public function lookupPersonByLogin(int $coId, string $identifier): int { return $id->person_id; } +<<<<<<< HEAD /** * Application Rule to determine if an Identifier is already in use. @@ -357,6 +358,8 @@ public function lookupPersonForLogin(string $identifier, int $coId): ?int { return $id->person_id ?? null; } +======= +>>>>>>> 23bac8de (lookupPersonByLogin vs lookupPersonForLogin fix) /** * Perform a keyword search.