Start to clean hook code

This commit is contained in:
Laurent Destailleur 2013-07-09 21:40:45 +02:00
parent 1bff25bf28
commit f67e52f42a
2 changed files with 10 additions and 2 deletions

View File

@ -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:

View File

@ -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;
}