From d6e48670e7800c88fbeda4ba8bedd830e517e4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 25 Jun 2015 11:10:28 +0200 Subject: [PATCH] Allow replacing the address block Since ba2c0a2651ead307ab9c779a16e6b4dbdb424bea changed the default hook mode from addreplace to output, this is needed to still be allowed to replace the displayed address from a hook --- htdocs/core/class/hookmanager.class.php | 37 +++++++++++++------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index ee7742660c171..b26f8c3c3d394 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -130,24 +130,25 @@ function executeHooks($method, $parameters=false, &$object='', &$action='') // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated). $hooktype='output'; - if (in_array( - $method, - array( - 'addMoreActionsButtons', - 'addStatisticLine', - 'deleteFile', - 'doActions', - 'formCreateThirdpartyOptions', - 'formObjectOptions', - 'formattachOptions', - 'formBuilddocLineOptions', - 'moveUploadedFile', - 'pdf_writelinedesc', - 'paymentsupplierinvoices', - 'printSearchForm', - 'formatEvent' - ) - )) $hooktype='addreplace'; + if (in_array( + $method, + array( + 'addMoreActionsButtons', + 'addStatisticLine', + 'deleteFile', + 'doActions', + 'formCreateThirdpartyOptions', + 'formObjectOptions', + 'formattachOptions', + 'formBuilddocLineOptions', + 'moveUploadedFile', + 'pdf_writelinedesc', + 'paymentsupplierinvoices', + 'printAddress', + 'printSearchForm', + 'formatEvent' + ) + )) $hooktype='addreplace'; // Deprecated hook types ('returnvalue') if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks. if ($method == 'insertExtraFields')