From 669c5b849f00e5ba1893158dda117f3e8ed4ddca Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Fri, 27 Jul 2018 16:26:54 +0200 Subject: [PATCH] Fixed issue #13915: Cannot submit survey with mandatory question and cookie to prevent repeated participation --- application/helpers/SurveyRuntimeHelper.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index 4bf05cdf5ff..68f9e12c8f0 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -576,15 +576,6 @@ private function setArgs() //field for limereplace stuff, and do transformations! $this->aSurveyInfo['surveyls_url'] = passthruReplace($this->aSurveyInfo['surveyls_url'], $this->aSurveyInfo); $this->aSurveyInfo['surveyls_url'] = templatereplace($this->aSurveyInfo['surveyls_url'], array(), $redata, 'URLReplace', false, null, array(), true); // to do INSERTANS substitutions - - //THE FOLLOWING DEALS WITH SUBMITTING ANSWERS AND COMPLETING AN ACTIVE SURVEY - //don't use cookies if tokens are being used - if (!empty($this->aSurveyInfo['active']) && $this->aSurveyInfo['active'] == "Y") { - global $tokensexist; - if ($this->aSurveyInfo['usecookie'] == "Y" && $tokensexist != 1 && ( array_key_exists('finished', $_SESSION['survey_'.$this->iSurveyid]) && $_SESSION['survey_'.$this->iSurveyid]['finished'] == true ) ) { - setcookie("LS_".$this->iSurveyid."_STATUS", "COMPLETE", time() + 31536000); //Cookie will expire in 365 days - } - } } } @@ -1151,6 +1142,14 @@ private function moveSubmitIfNeeded() $_SESSION[$this->LEMsessid]['finished'] = true; $_SESSION[$this->LEMsessid]['sid'] = $this->iSurveyid; + //THE FOLLOWING DEALS WITH SUBMITTING ANSWERS AND COMPLETING AN ACTIVE SURVEY + //don't use cookies if tokens are being used + if (!empty($this->aSurveyInfo['active']) && $this->aSurveyInfo['active'] == "Y") { + global $tokensexist; + if ($this->aSurveyInfo['usecookie'] == "Y" && $tokensexist != 1 && $this->aMoveResult['finished'] == true ) { + setcookie("LS_".$this->iSurveyid."_STATUS", "COMPLETE", time() + 31536000); //Cookie will expire in 365 days + } + } } $redata['completed'] = $this->completed;