summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorSimon Rettberg2017-06-02 16:44:21 +0200
committerSimon Rettberg2017-06-02 16:44:21 +0200
commit6ce997436486544f59cc2a7b2ff5cc6f7f2c3e4d (patch)
tree27c33d9b4f965707320707866898f621ee332f47 /modules-available
parent[dozmod] Show if templates are modified or have their defaults updated (diff)
downloadslx-admin-6ce997436486544f59cc2a7b2ff5cc6f7f2c3e4d.tar.gz
slx-admin-6ce997436486544f59cc2a7b2ff5cc6f7f2c3e4d.tar.xz
slx-admin-6ce997436486544f59cc2a7b2ff5cc6f7f2c3e4d.zip
[dozmod] Fix handling of "modified" state
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/dozmod/inc/pagemailtemplates.inc.php10
1 files changed, 8 insertions, 2 deletions
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');
}