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; +} + ?>