Permalink
Browse files

Fixed issue : Unable to save a survey again after reload a survey

Dev: scid (pk from saved_control) from session is used to know if user have save his survey
Dev: Yii join don't return the joined attribute then call just the saved_control again
  • Loading branch information...
1 parent 6c50614 commit de24fadfbbf726fe1b123611e8cec606b30181f7 @Shnoulle Shnoulle committed Jul 19, 2014
Showing with 13 additions and 14 deletions.
  1. +13 −14 application/helpers/frontend_helper.php
@@ -67,6 +67,18 @@ function loadanswers()
//A match has been found. Let's load the values!
//If this is from an email, build surveysession first
$_SESSION['survey_'.$surveyid]['LEMtokenResume']=true;
+
+ // If survey come from reload (GET or POST); some value need to be found on saved_control, not on survey
+ if (Yii::app()->request->getParam('loadall') == "reload")
+ {
+ $oSavedSurvey=SavedControl::model()->find("identifier=:identifier AND access_code=:access_code",array(":identifier"=>$sLoadName,":access_code"=>md5($sLoadPass)));
+ // We don't need to control if we have one, because we do the test before
+ $_SESSION['survey_'.$surveyid]['scid'] = $oSavedSurvey->scid;
+ $_SESSION['survey_'.$surveyid]['step'] = ($oSavedSurvey->saved_thisstep>1)?$oSavedSurvey->saved_thisstep:1;
+ $thisstep=$_SESSION['survey_'.$surveyid]['step']-1;// deprecated ?
+ $_SESSION['survey_'.$surveyid]['srid'] = $oSavedSurvey->srid;// Seems OK without
+ }
+
// Get if survey is been answered
$submitdate=$oResponses->submitdate;
$aRow=$oResponses->attributes;
@@ -77,12 +89,7 @@ function loadanswers()
$clienttoken=$value;
$token=$value;
}
- elseif ($column == "saved_thisstep" && $thissurvey['alloweditaftercompletion'] != 'Y' )
- {
- $_SESSION['survey_'.$surveyid]['step']=($value>1? $value:1) ;
- $thisstep=$_SESSION['survey_'.$surveyid]['step']-1;
- }
- elseif ($column =='lastpage' && isset($_GET['token']))
+ elseif ($column =='lastpage' && !isset($_SESSION['survey_'.$surveyid]['step']))
{
if(is_null($submitdate) || $submitdate=="N")
{
@@ -104,14 +111,6 @@ function loadanswers()
UpdateSessionGroupList($value); // to refresh the language strings in the group list session variable
UpdateFieldArray(); // to refresh question titles and question text
}*/
- elseif ($column == "scid")
- {
- $_SESSION['survey_'.$surveyid]['scid']=$value;
- }
- elseif ($column == "srid")
- {
- $_SESSION['survey_'.$surveyid]['srid']=$value;
- }
elseif ($column == "datestamp")
{
$_SESSION['survey_'.$surveyid]['datestamp']=$value;

0 comments on commit de24fad

Please sign in to comment.