From 68ded49cdd2cad18a2d69299bbc1d36342571f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Thu, 4 Aug 2016 15:55:33 +0200 Subject: [PATCH] Fixes #5021 check hook should be able to access errors number --- include/simpleplugin/class_simplePlugin.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index d2fa4935d..4503340a2 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -724,7 +724,7 @@ class simplePlugin extends plugin function check () { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'check'); - $message = parent::check(); + $message = array(); foreach ($this->attributesInfo as $sectionInfo) { foreach ($sectionInfo['attrs'] as $attr) { @@ -739,6 +739,20 @@ class simplePlugin extends plugin } } + $this->callHook('CHECK', array('nbCheckErrors' => count($message)), $returnOutput); + if (!empty($returnOutput)) { + $message[] = join("\n", $returnOutput); + } + + /* Check entryCSN */ + if (!empty($this->entryCSN)) { + $current_csn = getEntryCSN($this->dn); + if (($current_csn != $this->entryCSN) && !empty($current_csn)) { + $this->entryCSN = $current_csn; + $message[] = _('The object has changed since opened in FusionDirectory. All changes that may be done by others will get lost if you save this entry!'); + } + } + return $message; } -- GitLab