Unverified Commit fa3404c9 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

: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
Showing with 6 additions and 5 deletions
+6 -5
<?php <?php
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org/) 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 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 it under the terms of the GNU General Public License as published by
...@@ -129,7 +129,7 @@ class template ...@@ -129,7 +129,7 @@ class template
} }
} }
function getNeeded () function getNeeded (): array
{ {
return $this->attributes; return $this->attributes;
} }
......
<?php <?php
/* /*
This code is part of FusionDirectory (http://www.fusiondirectory.org/) 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 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 it under the terms of the GNU General Public License as published by
...@@ -56,8 +56,9 @@ class templateDialog ...@@ -56,8 +56,9 @@ class templateDialog
} }
if (($this->target === NULL) && 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(); $this->template->save_object();
return $this->handle_finish(); return $this->handle_finish();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment