From fa3404c992f576820a1d61d9e0a24d5c65b2bd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chilliet@fusiondirectory.org> Date: Tue, 10 Mar 2020 12:05:41 +0100 Subject: [PATCH] :sparkles: feat(template) Skip empty dialog when using automated template If a template asked no fields, it should not show the field asking page and skips right away to object creation. issue #6076 --- include/class_template.inc | 4 ++-- include/management/class_templateDialog.inc | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/class_template.inc b/include/class_template.inc index ab89857c9..cf1bb339f 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -1,7 +1,7 @@ <?php /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2014-2016 FusionDirectory + Copyright (C) 2014-2020 FusionDirectory This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -129,7 +129,7 @@ class template } } - function getNeeded () + function getNeeded (): array { return $this->attributes; } diff --git a/include/management/class_templateDialog.inc b/include/management/class_templateDialog.inc index dc881e1b5..c6fa00500 100644 --- a/include/management/class_templateDialog.inc +++ b/include/management/class_templateDialog.inc @@ -1,7 +1,7 @@ <?php /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2013-2019 FusionDirectory + Copyright (C) 2013-2020 FusionDirectory This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -56,8 +56,9 @@ class templateDialog } if (($this->target === NULL) && - (isset($_POST[$this->post_finish]) || isset($_GET[$this->post_finish])) && - is_object($this->template)) { + is_object($this->template) && + (isset($_POST[$this->post_finish]) || isset($_GET[$this->post_finish]) || empty($this->template->getNeeded())) + ) { $this->template->save_object(); return $this->handle_finish(); } -- GitLab