2
0
forked from Wavyzz/dolibarr

NEW Add hook hookGetEntity.

Change name and param of hook
This commit is contained in:
Laurent Destailleur
2021-08-28 14:51:49 +02:00
parent 9bed2557f5
commit 0e38e1e2c4
2 changed files with 6 additions and 5 deletions

View File

@@ -189,7 +189,7 @@ class HookManager
'formConfirm', 'formConfirm',
'getAccessForbiddenMessage', 'getAccessForbiddenMessage',
'getDirList', 'getDirList',
'functionGetEntity', 'hookGetEntity',
'getFormMail', 'getFormMail',
'getFormatedCustomerRef', 'getFormatedCustomerRef',
'getFormatedSupplierRef', 'getFormatedSupplierRef',

View File

@@ -104,7 +104,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
*/ */
function getEntity($element, $shared = 1, $currentobject = null) function getEntity($element, $shared = 1, $currentobject = null)
{ {
global $conf, $mc, $hookmanager, $object; global $conf, $mc, $hookmanager, $object, $action;
// fix different element names (France to English) // fix different element names (France to English)
switch ($element) { switch ($element) {
@@ -129,12 +129,13 @@ function getEntity($element, $shared = 1, $currentobject = null)
// Manipulate entities to query on the fly // Manipulate entities to query on the fly
$parameters = array( $parameters = array(
'object' => $object,
'currentobject' => $currentobject,
'element' => $element, 'element' => $element,
'shared' => $shared, 'shared' => $shared,
'object' => $object,
'currentobject' => $currentobject,
'out' => $out
); );
$reshook = $hookmanager->executeHooks('functionGetEntity', $parameters, $out, $element); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('hookGetEntity', $parameters, $currentobject, $action); // Note that $action and $object may have been modified by some hooks
if (is_numeric($reshook)) { if (is_numeric($reshook)) {
if ($reshook == 0 && !empty($hookmanager->resprints)) { if ($reshook == 0 && !empty($hookmanager->resprints)) {