From 6ce997436486544f59cc2a7b2ff5cc6f7f2c3e4d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 2 Jun 2017 16:44:21 +0200 Subject: [dozmod] Fix handling of "modified" state --- modules-available/dozmod/inc/pagemailtemplates.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules-available/dozmod') diff --git a/modules-available/dozmod/inc/pagemailtemplates.inc.php b/modules-available/dozmod/inc/pagemailtemplates.inc.php index 8136e1dc..dc41d8c6 100644 --- a/modules-available/dozmod/inc/pagemailtemplates.inc.php +++ b/modules-available/dozmod/inc/pagemailtemplates.inc.php @@ -74,9 +74,16 @@ class Page_mail_templates extends Page foreach ($this->templates as &$template) { if (isset($data[$template['name']])) { if ($this->forcmp($template['template']) !== $this->forcmp($data[$template['name']]['template'])) { + if (empty($template['original_template'])) { + $template['original_template'] = $template['template']; + } $template['edit_version'] = $template['version']; } - $template['original'] = $this->forcmp($template['original_template']) === $this->forcmp($data[$template['name']]['template']); + $template['original'] = (empty($template['original_template']) && $template['original']) + || $this->forcmp($template['original_template']) === $this->forcmp($data[$template['name']]['template']); + if ($template['original']) { + $template['original_template'] = ''; + } $template['template'] = $data[$template['name']]['template']; } } @@ -84,7 +91,6 @@ class Page_mail_templates extends Page $data = json_encode(array('templates' => $this->templates)); Database::exec("UPDATE sat.configuration SET value = :value WHERE parameter = 'templates'", array('value' => $data)); Message::addSuccess('templates-saved'); - } else { Message::addError('nothing-submitted'); } -- cgit v1.2.3-55-g7522