Skip to content

Commit

Permalink
Dev: Fixed survey saving options
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Mar 13, 2018
1 parent 11af680 commit 8382937
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -5415,9 +5415,9 @@ private function _UpdateValuesInDatabase($finished=false)

$sdata = array_filter($sdata);
SurveyDynamic::sid($this->sid);
$oSurvey = new SurveyDynamic;
$oSurveyDynamic = new SurveyDynamic;

$iNewID = $oSurvey->insertRecords($sdata);
$iNewID = $oSurveyDynamic->insertRecords($sdata);
if ($iNewID) // Checked
{
$srid = $iNewID;
Expand Down Expand Up @@ -5510,15 +5510,15 @@ private function _UpdateValuesInDatabase($finished=false)
if (isset($_SESSION[$this->sessid]['srid']) && $this->surveyOptions['active'])
{
$oSurveyResponse = SurveyDynamic::model($this->sid)->findByAttributes(['id' => $_SESSION[$this->sessid]['srid']]);

$oSurvey = Survey::model()->findByPk($this->sid);
//If the responses already have been submitted once they are marked as completed already, so they shouldn't be changed.
if($oSurveyResponse->lastpage != 1){
if($oSurveyResponse->submitdate == null || $oSurvey->alloweditaftercompletion == 'Y'){
array_walk($setter, function($value, $key) use (&$oSurveyResponse) {
$oSurveyResponse->setAttribute($key, $value);
});
$saveResult = $oSurveyResponse->save();
}

$saveResult = $oSurveyResponse->save();

if ( !$saveResult || $oSurveyResponse == null)
{
Expand Down

0 comments on commit 8382937

Please sign in to comment.