diff --git a/include/errors/class_FusionDirectoryError.inc b/include/errors/class_FusionDirectoryError.inc index 661e67b1d8f8bd8da328edd3be0c9c84991e921e..418c3164b05d7a2161f2dc0a4fa08c0ac35ba96c 100644 --- a/include/errors/class_FusionDirectoryError.inc +++ b/include/errors/class_FusionDirectoryError.inc @@ -45,6 +45,11 @@ class FusionDirectoryError extends Error ]; } + public function __toString () + { + return $this->getMessage(); + } + public function computeMsgDialogParameters (): array { return [_('Error'), $this->htmlMessage, ERROR_DIALOG, static::formatTrace($this)]; diff --git a/include/errors/class_SimplePluginError.inc b/include/errors/class_SimplePluginError.inc index 397077e3fba770a1d35421718ef4104a73e60c07..22b2f2cecf993b89cc459c29f19cb0b4f9ec7b8a 100644 --- a/include/errors/class_SimplePluginError.inc +++ b/include/errors/class_SimplePluginError.inc @@ -76,6 +76,30 @@ class SimplePluginError extends FusionDirectoryError return $array; } + public function __toString () + { + $msg = ''; + + if (isset($this->object)) { + $msg .= $this->object->getBaseObject()->dn.' > '; + } + + if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) { + $msg .= $this->tab->parent->by_name[get_class($this->tab)].' > '; + } + + if (isset($this->attribute)) { + $label = $this->attribute->getLabel(); + if (empty($label)) { + $msg .= $this->attribute->getLdapName(); + } else { + $msg .= $label; + } + } + + return $msg.': '.$this->getMessage(); + } + public function computeMsgDialogParameters (): array { $html = ''; diff --git a/include/simpleplugin/interface_SimpleTab.inc b/include/simpleplugin/interface_SimpleTab.inc index aab62ef2112ad0093e033a61cd774f4a6bbd6abb..d8428e6d8d6abb82847cc5849d57eba6f97a46f1 100644 --- a/include/simpleplugin/interface_SimpleTab.inc +++ b/include/simpleplugin/interface_SimpleTab.inc @@ -135,6 +135,8 @@ interface SimpleTab /*! * \brief Deserialize values + * + * Returns TRUE or error */ public function deserializeValues (array $values, bool $checkAcl = TRUE);