From f67e52f42a953dbc539dd11476fd61ed1d550877 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Jul 2013 21:40:45 +0200 Subject: [PATCH] Start to clean hook code --- ChangeLog | 10 +++++++++- htdocs/core/class/hookmanager.class.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3f9db52ac9..a14ca245af2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,15 @@ For developers: key to use a specific language file. - New: Make some changes to allow usage of several alternative $dolibarr_main_url_root variables. Fix also several bugs with old code. - + +WARNING: We started to clean hooks code. If your hook want to modify value of $actions, it's role +of your hook to modify it. Dolibarr hook code will not decide this for your module anymore. +If your action class for hook was returning a string or an array, instead your module must +set $actionclassinstance->results (to return array) +or $actionclassinstance->resprints (to return string) +to return same thing. The return value must be replaced by a "return 0"; +Goal is to fix old compatibility code that does not match hook +specification: http://wiki.dolibarr.org/index.php/Hooks_system ***** ChangeLog for 3.4 compared to 3.3.2 ***** For users: diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bef5d29516d..7227556d5ac 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -183,7 +183,7 @@ class HookManager if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; // TODO. remove this. array result must be set into $actionclassinstance->results //if (is_array($result)) $this->resArray = array_merge($this->resArray, $result); - // TODO. remove this. result must not be a string. we must use $actionclassinstance->resprint to return a string + // TODO. remove this. result must not be a string. we must use $actionclassinstance->resprints to return a string //if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result; }