From 408683da06de984ecf3fa360b0779bd75e36fab9 Mon Sep 17 00:00:00 2001 From: Denis Chenu Date: Mon, 6 Jul 2020 15:51:45 +0200 Subject: [PATCH] Fixed issue #16460: Unable to update format or questionindex by plugin Dev : all attributes allowed --- application/models/Survey.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/application/models/Survey.php b/application/models/Survey.php index 1ed62cc652b..67c84f0300a 100755 --- a/application/models/Survey.php +++ b/application/models/Survey.php @@ -506,14 +506,10 @@ public function afterFindSurvey() $event = new PluginEvent('afterFindSurvey'); $event->set('surveyid', $this->sid); App()->getPluginManager()->dispatchEvent($event); - // set the attributes we allow to be fixed - $allowedAttributes = array('template', 'usecookie', 'allowprev', - 'showxquestions', 'shownoanswer', 'showprogress', 'questionindex', - 'usecaptcha', 'showgroupinfo', 'showqnumcode', 'navigationdelay', - 'expires','startdate','admin','adminemail','emailnotificationto','emailresponseto'); - foreach ($allowedAttributes as $attribute) { + $aAttributes = array_keys($this->getAttributes()); + foreach ($aAttributes as $attribute) { if (!is_null($event->get($attribute))) { - $this->{$attribute} = $event->get($attribute); + $this->setAttribute($attribute,$event->get($attribute)); } } $this->template = Template::templateNameFilter($this->template);