From b3e89e3a1c707f879471932faab578e25b9e0a2b Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Tue, 18 Feb 2025 13:11:12 +0200 Subject: [PATCH] Fix Enrollment Flow Step petition preview. Fix CAKEPHP deprecations. --- .../src/View/Cell/AttributeCollectorsCell.php | 13 ++++--- .../cell/AttributeCollectors/display.php | 7 ++++ .../templates/cell/EmailVerifiers/display.php | 38 +++++++++++-------- app/src/Controller/ApiV2Controller.php | 10 ++--- app/src/Controller/AppController.php | 20 +++++----- app/src/Controller/MVEAController.php | 4 +- app/src/Controller/StandardController.php | 24 ++++++------ .../Controller/StandardEnrollerController.php | 4 +- .../StandardPluggableController.php | 2 +- .../Controller/StandardPluginController.php | 4 +- app/src/Lib/Traits/IndexQueryTrait.php | 8 ++-- app/templates/EnrollmentFlows/start.inc | 2 +- .../ExternalIdentitySources/search.php | 2 +- app/templates/Standard/add-edit-view.php | 2 +- app/templates/Standard/deleted.php | 2 +- app/templates/Standard/dispatch.php | 2 +- app/templates/Standard/index.php | 2 +- app/templates/element/bulk/bulk.php | 2 +- app/templates/element/filter/dateSingle.php | 2 +- app/templates/element/filter/default.php | 2 +- app/templates/element/filter/filter.php | 2 +- app/templates/element/filter/options.php | 2 +- app/templates/element/filter/peoplePicker.php | 2 +- .../element/subnavigation/navBar.php | 2 +- 24 files changed, 88 insertions(+), 72 deletions(-) diff --git a/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php b/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php index bef6e3072..61665e0d1 100644 --- a/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php +++ b/app/plugins/CoreEnroller/src/View/Cell/AttributeCollectorsCell.php @@ -75,12 +75,15 @@ public function display(int $petitionId): void { $vv_enrollment_atttributes_ids = Hash::extract($this->vv_obj->petition_attributes, '{n}.enrollment_attribute_id'); $vv_enrollment_atttributes_ids = array_unique($vv_enrollment_atttributes_ids); + $vv_enrollment_attributes = []; - $vv_enrollment_attributes = $this->fetchTable('EnrollmentAttributes') - ->find() - ->where(fn(QueryExpression $exp, Query $q) => $exp->in('id', $vv_enrollment_atttributes_ids)) - ->order(['ordr' => 'ASC']) - ->toArray(); + if (!empty($vv_enrollment_atttributes_ids)) { + $vv_enrollment_attributes = $this->fetchTable('EnrollmentAttributes') + ->find() + ->where(fn(QueryExpression $exp, Query $q) => $exp->in('id', $vv_enrollment_atttributes_ids)) + ->order(['ordr' => 'ASC']) + ->toArray(); + } $this->set('vv_enrollment_attributes', $vv_enrollment_attributes); $this->set('vv_step', $this->vv_step); diff --git a/app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php b/app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php index e2d44c602..b59a82a41 100644 --- a/app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php +++ b/app/plugins/CoreEnroller/templates/cell/AttributeCollectors/display.php @@ -31,6 +31,13 @@ declare(strict_types = 1); +if (empty($vv_enrollment_attributes)) { + print $this->element('emptyPetitionFlowStep', [], [ + 'cache' => '_html_elements', + ]); + return; +} + ?>