fix: [individual:edit] Select individuals based on their id and not their user_id

refacto/CRUDComponent
Sami Mokaddem 2023-09-07 16:43:30 +02:00
parent 5aefc37837
commit 367012af36
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ class IndividualsTable extends AppTable
public function getValidIndividualsToEdit(object $currentUser): array public function getValidIndividualsToEdit(object $currentUser): array
{ {
$validRoles = $this->Users->Roles->find('list')->select(['id'])->where(['perm_admin' => 0, 'perm_org_admin' => 0])->all()->toArray(); $validRoles = $this->Users->Roles->find('list')->select(['id'])->where(['perm_admin' => 0, 'perm_org_admin' => 0])->all()->toArray();
$validIndividualIds = $this->Users->find('list')->select(['individual_id'])->where( $validIndividualIds = $this->Users->find()->select(['individual_id'])->where(
[ [
'organisation_id' => $currentUser['organisation_id'], 'organisation_id' => $currentUser['organisation_id'],
'disabled' => 0, 'disabled' => 0,
@ -134,7 +134,7 @@ class IndividualsTable extends AppTable
['id' => $currentUser['id']], ['id' => $currentUser['id']],
] ]
] ]
)->all()->toArray(); )->all()->extract('individual_id')->toArray();
return array_keys($validIndividualIds); return $validIndividualIds;
} }
} }