fix: [alignments:add] Index individuals and orgs by ID instead of array index

develop-unstable
Sami Mokaddem 2023-01-17 09:25:11 +01:00
parent 025dcd9054
commit fc31ce8b08
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ class AlignmentsController extends AppController
} }
} }
if ($scope === 'organisations') { if ($scope === 'organisations') {
$individuals = $this->Individuals->find('list', ['valueField' => 'email']); $individuals = $this->Individuals->find('list', ['valueField' => 'email'])->toArray();
$this->set('individuals', $individuals); $this->set('individuals', $individuals);
$organisation = $this->Organisations->find()->where(['id' => $source_id])->first(); $organisation = $this->Organisations->find()->where(['id' => $source_id])->first();
if (empty($organisation)) { if (empty($organisation)) {
@ -113,7 +113,7 @@ class AlignmentsController extends AppController
} }
$this->set(compact('organisation')); $this->set(compact('organisation'));
} else { } else {
$organisations = $this->Organisations->find('list', ['valueField' => 'name']); $organisations = $this->Organisations->find('list', ['valueField' => 'name'])->toArray();
$this->set('organisations', $organisations); $this->set('organisations', $organisations);
$individual = $this->Individuals->find()->where(['id' => $source_id])->first(); $individual = $this->Individuals->find()->where(['id' => $source_id])->first();
if (empty($individual)) { if (empty($individual)) {