From 373d7db320bde7d548d6e39fab67fa8884775b68 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 ++++++- 1 file changed, 6 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';