From d23b44fce4326b191b68a6ad09fe022edd7b8fed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Tue, 2 Oct 2018 13:38:59 +0000
Subject: [PATCH] Merge branch
 '5797-cancel-button-has-no-effect-apply-template' into '1.2.2-fixes'

Resolve "cancel button has no effect (apply template)"

See merge request fusiondirectory/fd!412

(cherry picked from commit dcb38c577925d96749912fc9ab099a71459d9d5a)

58dd02ec :ambulance: fix(core) Fix cancel button on template dialog
---
 include/simpleplugin/class_simpleManagement.inc | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc
index fa24547d5..d1d525eaa 100644
--- a/include/simpleplugin/class_simpleManagement.inc
+++ b/include/simpleplugin/class_simpleManagement.inc
@@ -51,14 +51,15 @@ class templateDialog
 
   function save_object ()
   {
-    if ($this->target === NULL) {
-      if (isset($_POST[$this->post_cancel])) {
-        return $this->handle_cancel();
-      }
-      if ((isset($_POST[$this->post_finish]) || isset($_GET[$this->post_finish])) && is_object($this->template)) {
-        $this->template->save_object();
-        return $this->handle_finish();
-      }
+    if (isset($_POST[$this->post_cancel])) {
+      return $this->handle_cancel();
+    }
+
+    if (($this->target === NULL) &&
+        (isset($_POST[$this->post_finish]) || isset($_GET[$this->post_finish])) &&
+        is_object($this->template)) {
+      $this->template->save_object();
+      return $this->handle_finish();
     }
 
     if (
-- 
GitLab