From 58dd02ecb95d1f1d56bebe06e79710b9ebdfa330 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Tue, 2 Oct 2018 15:28:58 +0200
Subject: [PATCH] :ambulance: fix(core) Fix cancel button on template dialog

issue #5797
---
 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 2a636ad52..52603afa2 100644
--- a/include/simpleplugin/class_simpleManagement.inc
+++ b/include/simpleplugin/class_simpleManagement.inc
@@ -48,14 +48,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