Skip to content

Commit

Permalink
lookupPersonByLogin vs lookupPersonForLogin fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Dec 15, 2024
1 parent 664a571 commit a391258
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/Lib/Traits/EnrollmentControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions app/src/Model/Table/IdentifiersTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a391258

Please sign in to comment.