Skip to content

Commit

Permalink
Fixed issue: Error on submission when survey is inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Apr 18, 2012
1 parent 6063210 commit 766384a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
19 changes: 9 additions & 10 deletions application/helpers/SurveyRuntimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,14 @@ function run($surveyid,$args) {
$_SESSION[$LEMsessid]['insertarray'][] = "refurl";
}
}

//COMMIT CHANGES TO DATABASE
resetTimers();
//END PAGE - COMMIT CHANGES TO DATABASE
if ($thissurvey['active'] != "Y") //If survey is not active, don't really commit
{
if ($thissurvey['assessments'] == "Y")
{
$assessments = doAssessment($surveyid);
}

sendCacheHeaders();
doHeader();

Expand All @@ -376,7 +375,7 @@ function run($surveyid,$args) {
$completed .= $clang->gT("Your survey responses have not been recorded. This survey is not yet active.") . "<br /><br />\n";
if ($thissurvey['printanswers'] == 'Y')
{
// ClearAll link is only relevant for survey with printanswers enabled
// 'Clear all' link is only relevant for survey with printanswers enabled
// in other cases the session is cleared at submit time
$completed .= "<a href='" . Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}/move/clearall") . "'>" . $clang->gT("Clear Responses") . "</a><br /><br />\n";
}
Expand Down Expand Up @@ -845,10 +844,10 @@ function checkconditions(value, name, type, evt_type)
ExprMgr_process_relevance_and_tailoring(evt_type,name,type);
END;

if ($previewgrp)
{
// force the group to be visible, even if irrelevant - will not always work
print <<<END
if ($previewgrp)
{
// force the group to be visible, even if irrelevant - will not always work
print <<<END
$('#relevanceG' + LEMgseq).val(1);
$(document).ready(function() {
$('#group-' + LEMgseq).show();
Expand All @@ -865,9 +864,9 @@ function checkconditions(value, name, type, evt_type)
});
END;
}
}

print <<<END
print <<<END
}
// -->
</script>
Expand Down
10 changes: 8 additions & 2 deletions application/helpers/frontend_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2818,9 +2818,15 @@ function killSurveySession($iSurveyID)
{
// Unset the session
unset($_SESSION['survey_'.$iSurveyID]);
}


// Delete the timers cookie
// @todo: Make cookie survey ID aware
/**
* Resets all question timers by expiring the related cookie - this needs to be called before any output is done
* @todo Make cookie survey ID aware
*/
function resetTimers()
{
$cookie=new CHttpCookie('limesurvey_timers', '');
$cookie->expire = time()- 3600;
Yii::app()->request->cookies['limesurvey_timers'] = $cookie;
Expand Down

0 comments on commit 766384a

Please sign in to comment.