diff --git a/include/management/class_templateDialog.inc b/include/management/class_templateDialog.inc index 1ac23736401f3bde43b44a233408f2d1412df741..f0c8fecbeeb9f13a415f0be9fe7ef3cf8cc0297d 100644 --- a/include/management/class_templateDialog.inc +++ b/include/management/class_templateDialog.inc @@ -122,11 +122,23 @@ class templateDialog implements FusionDirectoryDialog return $display; } - protected function handleFinish () - { - $this->management->closeDialogs(); - $this->management->openTabObject($this->template->apply()); - } + /** + * @return void + * Note : The idea is to handle the save directly at the end of the validation of the template data. + * Allowing direct saving in case of no error and opening the UI at the exact tab in case of error. + */ + protected function handleFinish () + { + $this->management->closeDialogs(); + $tab = $this->template->apply(); + $errors = $tab->save(); + + if (!empty($errors)) { + $this->management->openTabObject($tab); + msg_dialog::displayChecks($errors); + } + } + protected function handleCancel () {