diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index 5deb3127d7a..ff58088c945 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -976,12 +976,13 @@ private function saveAllIfNeeded() // Don't test if save is allowed if ($this->aSurveyInfo['active'] == "Y" && Yii::app()->request->getPost('saveall')) { + $bAnonymized = $this->aSurveyInfo["anonymized"] == 'Y'; $bTokenAnswerPersitance = $this->aSurveyInfo['tokenanswerspersistence'] == 'Y' && $this->iSurveyid != null && tableExists('tokens_'.$this->iSurveyid); // must do this here to process the POSTed values $this->aMoveResult = LimeExpressionManager::JumpTo($_SESSION[$this->LEMsessid]['step'], false); // by jumping to current step, saves data so far - if (!isset($_SESSION[$this->LEMsessid]['scid']) && !$bTokenAnswerPersitance) { + if (!isset($_SESSION[$this->LEMsessid]['scid']) && (!$bTokenAnswerPersitance || $bAnonymized)) { Yii::import("application.libraries.Save"); $cSave = new Save(); // $cSave->showsaveform($this->aSurveyInfo['sid']); // generates a form and exits, awaiting input diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index 80da86e68a1..53f42fb5f42 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -1486,6 +1486,7 @@ function getNavigatorDatas() App()->getClientScript()->registerScript("activateActionLink", "activateActionLink();\n", LSYii_ClientScript::POS_POSTSCRIPT); // Fill some test here, more clear .... + $bAnonymized = $thissurvey["anonymized"] == 'Y'; $bTokenanswerspersistence = $thissurvey['tokenanswerspersistence'] == 'Y' && tableExists('tokens_'.$surveyid); $bAlreadySaved = isset($_SESSION['survey_'.$surveyid]['scid']); $iSessionStep = (isset($_SESSION['survey_'.$surveyid]['step']) ? $_SESSION['survey_'.$surveyid]['step'] : false); @@ -1493,14 +1494,14 @@ function getNavigatorDatas() // Find out if the user has any saved data if ($thissurvey['format'] == 'A') { - if (!$bTokenanswerspersistence && !$bAlreadySaved) { + if ((!$bTokenanswerspersistence || $bAnonymized) && !$bAlreadySaved) { $aNavigator['load']['show'] = true; } $aNavigator['save']['show'] = true; } elseif (!$iSessionStep) { //Welcome page, show load (but not save) - if (!$bTokenanswerspersistence && !$bAlreadySaved) { + if ((!$bTokenanswerspersistence || $bAnonymized) && !$bAlreadySaved) { $aNavigator['load']['show'] = true; } @@ -1509,7 +1510,7 @@ function getNavigatorDatas() } } elseif ($iSessionMaxStep == 1 && $thissurvey['showwelcome'] == "N") { //First page, show LOAD and SAVE - if (!$bTokenanswerspersistence && !$bAlreadySaved) { + if ((!$bTokenanswerspersistence || $bAnonymized) && !$bAlreadySaved) { $aNavigator['load']['show'] = true; } @@ -1517,7 +1518,7 @@ function getNavigatorDatas() } elseif (getMove() != "movelast") { // Not on last page or submited survey $aNavigator['save']['show'] = true; - } + } } return $aNavigator;