From f80f43f0140602e118438e4c06d4a7f323010cc6 Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Wed, 5 Feb 2025 10:42:31 +0200 Subject: [PATCH] Rename view variable creating conflict --- app/src/Controller/MVEAController.php | 6 +++--- app/templates/element/subnavigation.php | 10 +++++----- app/templates/element/subnavigation/statusBadge.php | 2 +- app/templates/element/subnavigation/supertitle.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/Controller/MVEAController.php b/app/src/Controller/MVEAController.php index 52fb641c7..4a7ec6507 100644 --- a/app/src/Controller/MVEAController.php +++ b/app/src/Controller/MVEAController.php @@ -100,7 +100,7 @@ public function beforeFilter(\Cake\Event\EventInterface $event) { $personName = $Names->primaryName($externalIdentity->person_id); $this->set('vv_person_name', $personName); $this->set('vv_supertitle', $personName->full_name); - $this->set('vv_person_id', $externalIdentity->person_id); + $this->set('vv_mvea_person_id', $externalIdentity->person_id); break; case 'person_role_id': $PersonRoles = $this->getTableLocator()->get('PersonRoles'); @@ -113,13 +113,13 @@ public function beforeFilter(\Cake\Event\EventInterface $event) { $personName = $Names->primaryName($roleEntity->person_id); $this->set('vv_person_name', $personName); $this->set('vv_supertitle', $personName->full_name); - $this->set('vv_person_id', $roleEntity->person_id); + $this->set('vv_mvea_person_id', $roleEntity->person_id); break; case 'person_id': $personName = $Names->primaryName((int)$primaryLink->value); $this->set('vv_person_name', $personName); $this->set('vv_supertitle', $personName->full_name); - $this->set('vv_person_id', $primaryLink->value); + $this->set('vv_mvea_person_id', $primaryLink->value); break; default; break; diff --git a/app/templates/element/subnavigation.php b/app/templates/element/subnavigation.php index 138d38e38..cd453a966 100644 --- a/app/templates/element/subnavigation.php +++ b/app/templates/element/subnavigation.php @@ -42,9 +42,9 @@ $curId = $this->request->getQuery($vv_primary_link); $linkFilter = [$vv_primary_link => $curId]; // For top-level nav - if(!empty($vv_person_id)) { - $curId = $vv_person_id; - $linkFilter = ['person_id' => $vv_person_id]; + if(!empty($vv_mvea_person_id)) { + $curId = $vv_mvea_person_id; + $linkFilter = ['person_id' => $vv_mvea_person_id]; } } elseif (!empty($vv_obj)) { // This will work for most top-level edit views @@ -55,8 +55,8 @@ // these have been explicitly set in the $subnav array in fields-nav.inc, so just use them. $curId = $tabsId; $navController = $tabsController; - } elseif(!empty($vv_person_id)) { - $curId = $vv_person_id; + } elseif(!empty($vv_mvea_person_id)) { + $curId = $vv_mvea_person_id; } elseif( ($active == 'plugin' || (!empty($vv_primary_link) && $vv_primary_link == 'enrollment_flow_id')) && !empty($vv_primary_link_obj) diff --git a/app/templates/element/subnavigation/statusBadge.php b/app/templates/element/subnavigation/statusBadge.php index 16a0ae5ab..1cd6f6cb6 100644 --- a/app/templates/element/subnavigation/statusBadge.php +++ b/app/templates/element/subnavigation/statusBadge.php @@ -35,7 +35,7 @@ return; } -$personId = $vv_person_id +$personId = $vv_mvea_person_id ?? $this->request->getQuery('person_id') ?? $vv_obj?->person_id ?? $vv_obj?->id; diff --git a/app/templates/element/subnavigation/supertitle.php b/app/templates/element/subnavigation/supertitle.php index 840d09547..c7354fa47 100644 --- a/app/templates/element/subnavigation/supertitle.php +++ b/app/templates/element/subnavigation/supertitle.php @@ -38,7 +38,7 @@ * Person with deep nested dependency */ -$person_id = (int)($vv_person_id ?? $vv_obj?->person_id ?? $this->getRequest()->getQuery('person_id')); +$person_id = (int)($vv_mvea_person_id ?? $vv_obj?->person_id ?? $this->getRequest()->getQuery('person_id')); if ($person_id) { $personFullName = $this->Tab->getPersonPrimaryName($person_id); }