diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index c06cdd6d6722b621e3a1031f453f767bf173eace..a160224eb2ec19d2a3df399aabd70094f1bea1a9 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -120,7 +120,7 @@ class msg_dialog /*! * \brief Display a message dialog * - * \param string $title The title of the message dialog + * \param string|object $title The title of the message dialog, or the error object * * \param string $message The message of the message dialog * @@ -128,8 +128,12 @@ class msg_dialog * * \param array $trace The trace from where the message was built */ - public static function display (string $title, string $message, int $type = INFO_DIALOG, array $trace = []) + public static function display ($title, string $message, int $type = INFO_DIALOG, array $trace = []) { + if ($title instanceof FusionDirectoryError) { + static::display(...$title->computeMsgDialogParameters()); + return; + } $dialog = new msg_dialog($title, $message, $type, $trace); $dialog->show(); } diff --git a/include/errors/class_SimplePluginLdapError.inc b/include/errors/class_SimplePluginLdapError.inc index f66b040d43d13b0900c1f137284a0381448046bf..1c7eb5ced87f8f919880204ca0e473834ae63b91 100644 --- a/include/errors/class_SimplePluginLdapError.inc +++ b/include/errors/class_SimplePluginLdapError.inc @@ -98,6 +98,6 @@ class SimplePluginLdapError extends SimplePluginError ] ); - return [_('Error'), $html, ERROR_DIALOG, $trace]; + return [_('LDAP error'), $html, LDAP_ERROR, $trace]; } } diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index 824f4b4b49cefc48f919a372b59d4baa2f7154aa..f762669042c1899e73f6e8b0cb4538bf0ef92b66 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -666,7 +666,11 @@ class OrderedArrayAttribute extends SetAttribute $this->attribute->loadPostValue(); $this->attribute->applyPostValue(); if ($error = $this->attribute->check()) { - msg_dialog::display(sprintf(_('Invalid value for %s'), $this->getLabel()), $error); + if (is_string($error)) { + msg_dialog::display(sprintf(_('Invalid value for %s'), $this->getLabel()), $error); + } else { + msg_dialog::display($error); + } } else { $this->addPostValue($this->attribute->getValue()); }