diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index 14c99b5c50a..6c3bda3860e 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -1060,6 +1060,16 @@ private function moveSubmitIfNeeded() $this->aSurveyInfo['aAssessments'] = doAssessment($this->iSurveyid); } + // End text + if (trim(str_replace(array('

', '

'), '', $this->aSurveyInfo['surveyls_endtext'])) == '') { + $this->aSurveyInfo['aCompleted']['showDefault'] = true; + } else { + $this->aSurveyInfo['aCompleted']['showDefault'] = false; + // NOTE: this occurence of template replace should stay here. User from backend could use old replacement keyword + //$this->aSurveyInfo['aCompleted']['sEndText'] = templatereplace($this->aSurveyInfo['surveyls_endtext'], array(), $redata, 'SubmitAssessment', false, null, array(), true); + $this->aSurveyInfo['aCompleted']['sEndText'] = $this->processString($this->aSurveyInfo['surveyls_endtext']); + } + $redata = compact(array_keys(get_defined_vars())); // can't kill session before end message, otherwise INSERTANS doesn't work. $completed = templatereplace($this->aSurveyInfo['surveyls_endtext'], array(), $redata, 'SubmitEndtextI', false, null, array(), true); diff --git a/themes/survey/vanilla/views/subviews/content/submit_preview.twig b/themes/survey/vanilla/views/subviews/content/submit_preview.twig index 4615305f572..8071d71fd64 100644 --- a/themes/survey/vanilla/views/subviews/content/submit_preview.twig +++ b/themes/survey/vanilla/views/subviews/content/submit_preview.twig @@ -27,12 +27,19 @@
+ {% if (aSurveyInfo.aCompleted.showDefault == true) %} +

{{ "Thank you!" | t }}

+

{{ "Your survey responses have been recorded." | t }}

+ {% else %} + {{ aSurveyInfo.aCompleted.sEndText }} + {% endif %} + {# Assessments #} {% if (aSurveyInfo.aAssessments.show) %} {{ include('./subviews/messages/assessments.twig') }} {% endif %} -
+

{# TODO: rewrite this before master #}