From 98c59477048fb7a349e7daa0589e14a5d29d8351 Mon Sep 17 00:00:00 2001 From: Denis Chenu Date: Sun, 14 Dec 2014 17:43:12 +0100 Subject: [PATCH] Fixed issue #09404: No alert are shown when error is made Fixed issue #09403: Save after error submitted show unneeded alert Dev: loadall must be reworked, maybe in another controller is better ? Dev: Same for saveall (same controller ?) --- application/controllers/survey/index.php | 4 ++-- application/helpers/SurveyRuntimeHelper.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/application/controllers/survey/index.php b/application/controllers/survey/index.php index 4168fda36e8..7327b2143fc 100644 --- a/application/controllers/survey/index.php +++ b/application/controllers/survey/index.php @@ -316,8 +316,8 @@ function action() LimeExpressionManager::SetDirtyFlag(); buildsurveysession($surveyid); if (loadanswers()){ - Yii::app()->setConfig('move','movenext'); - $move = "movenext";// 140113 : deprecated ? + Yii::app()->setConfig('move','reload'); + $move = "reload";// veyRunTimeHelper use $move in $arg } else { $errormsg .= gT("There is no matching saved survey"); } diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index e9ad65b0588..a26e764ccdb 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -314,13 +314,20 @@ function run($surveyid,$args) { $moveResult = LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false, true, false, true); //$backpopup=gT("Clear all need confirmation."); } - if (!(isset($_POST['saveall']) || isset($_POST['saveprompt']) || isset($_GET['sid']) || $LEMskipReprocessing || (isset($move) && (preg_match('/^changelang_/',$move))))) + if (isset($move)) { - $_SESSION[$LEMsessid]['prevstep'] = $_SESSION[$LEMsessid]['step']; + if(!in_array($move,array("clearall","changelang","saveall","reload"))) + $_SESSION[$LEMsessid]['prevstep'] = $_SESSION[$LEMsessid]['step']; + else // Accepted $move without error + $_SESSION[$LEMsessid]['prevstep']= $move; + } + else + { + //$_SESSION[$LEMsessid]['prevstep'] = $_SESSION[$LEMsessid]['step']-1; // Is this needed ? } if (!isset($_SESSION[$LEMsessid]['prevstep'])) { - $_SESSION[$LEMsessid]['prevstep']=-1; // this only happens on re-load + $_SESSION[$LEMsessid]['prevstep']=$_SESSION[$LEMsessid]['step']-1; // this only happens on re-load } if (isset($_SESSION[$LEMsessid]['LEMtokenResume'])) @@ -451,7 +458,7 @@ function run($surveyid,$args) { $cSave = new Save(); } if ($thissurvey['active'] == "Y" && Yii::app()->request->getPost('saveall')) // Don't test if save is allowed - { + { $bTokenAnswerPersitance = $thissurvey['tokenanswerspersistence'] == 'Y' && isset($surveyid) && tableExists('tokens_'.$surveyid); // must do this here to process the POSTed values $moveResult = LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false); // by jumping to current step, saves data so far