Skip to content

Commit

Permalink
Fixed issue #9322: E-mail template content lost when you trying to sa…
Browse files Browse the repository at this point in the history
…ve after session timeout
  • Loading branch information
c-schmitz committed Nov 22, 2014
1 parent 4da04c3 commit 7de44ef
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions application/controllers/admin/emailtemplates.php
Expand Up @@ -87,9 +87,9 @@ function update($iSurveyId)
$uploadUrl = Yii::app()->getBaseUrl(true) . substr(Yii::app()->getConfig('uploadurl'),strlen(Yii::app()->getConfig('publicurl'))-1);
// We need the real path since we check that the resolved file name starts with this path.
$uploadDir = realpath(Yii::app()->getConfig('uploaddir'));
$save=Yii::app()->request->getPost('save','');
$sSaveMethod=Yii::app()->request->getPost('save','');
$clang = $this->getController()->lang;
if (Permission::model()->hasSurveyPermission($iSurveyId, 'surveylocale','update'))
if (Permission::model()->hasSurveyPermission($iSurveyId, 'surveylocale','update') && $sSaveMethod!='')
{
$languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$languagelist[] = Survey::model()->findByPk($iSurveyId)->language;
Expand All @@ -116,7 +116,7 @@ function update($iSurveyId)
unset($attachments[$index]);
}
}
else
else
{
unset($attachments[$index]);
}
Expand All @@ -128,7 +128,7 @@ function update($iSurveyId)
{
$_POST['attachments'][$langname] = array();
}

$attributes = array(
'surveyls_email_invite_subj' => $_POST['email_invitation_subj_'.$langname],
'surveyls_email_invite' => $_POST['email_invitation_'.$langname],
Expand All @@ -147,8 +147,9 @@ function update($iSurveyId)
$usquery = SurveyLanguageSetting::model()->updateAll($attributes,'surveyls_survey_id = :ssid AND surveyls_language = :sl', array(':ssid' => $iSurveyId, ':sl' => $langname));
}
Yii::app()->session['flashmessage'] = $clang->gT("Email templates successfully saved.");
$this->getController()->redirect(array('admin/emailtemplates/sa/index/surveyid/'.$iSurveyId));
}
if($save=='saveclose')
if($sSaveMethod=='saveclose')
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/'.$iSurveyId));
else
self::index($iSurveyId);
Expand All @@ -163,7 +164,7 @@ function update($iSurveyId)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'emailtemplates', $aViewUrls = array(), $aData = array())
{
{
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'emailtemplates.js');

$aData['display']['menu_bars']['surveysummary'] = 'editemailtemplates';
Expand Down

0 comments on commit 7de44ef

Please sign in to comment.