Skip to content

Commit

Permalink
Fixed issue: Database error if email subject is too long
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Oct 19, 2020
1 parent 5db7d67 commit 2c8ccdd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion application/controllers/admin/emailtemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,17 @@ function update($iSurveyId)
'email_admin_responses' => $_POST['email_admin_detailed_notification_'.$langname],
'attachments' => serialize($_POST['attachments'][$langname])
);
$usquery = SurveyLanguageSetting::model()->updateAll($attributes, 'surveyls_survey_id = :ssid AND surveyls_language = :sl', array(':ssid' => $iSurveyId, ':sl' => $langname));

$aLanguageSetting = SurveyLanguageSetting::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :sl', array(':ssid' => $iSurveyId, ':sl' => $langname));
$aLanguageSetting->setAttributes($attributes);
if (!$aLanguageSetting->save()){
$sErrors = '<br/>';
foreach ($aLanguageSetting->getErrors() as $sError) {
$sErrors .= $sError[0].'<br/>';
}
Yii::app()->setFlashMessage(sprintf(gT("Failed to update email templates. Message: %s"),$sErrors),'error');
$this->getController()->redirect(array('admin/emailtemplates/sa/index/surveyid/'.$iSurveyId));
}
}
Yii::app()->session['flashmessage'] = gT("Email templates successfully saved.");
if (Yii::app()->request->getPost('close-after-save') == 'true') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class=''>
<?php
$sSubjectField=$details['field']['subject'];
echo CHtml::textField("email_{$tab}_subj_{$grouplang}",$esrow->$sSubjectField,array('class' => 'form-control', 'size'=>80)); ?>
echo CHtml::textField("email_{$tab}_subj_{$grouplang}",$esrow->$sSubjectField,array('class' => 'form-control', 'maxlength'=>255)); ?>
</div>
</div>
</div>
Expand Down

0 comments on commit 2c8ccdd

Please sign in to comment.