Merge pull request #20472 from hregis/fix_avoid_hooks_conflict

NEW add hooks contact tab badge and hooks parameter for avoid conflicts
This commit is contained in:
Laurent Destailleur 2022-04-02 18:06:01 +02:00 committed by GitHub
commit f07e11179d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -8864,7 +8864,7 @@ class Form
// Add where from hooks
if (is_object($hookmanager)) {
$parameters = array();
$parameters = array('showrefnav' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$object->next_prev_filter .= $hookmanager->resPrint;
}

View File

@ -64,7 +64,15 @@ function societe_prepare_head(Societe $object)
} else {
$sql = "SELECT COUNT(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
// Add table from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE p.fk_soc = ".((int) $object->id);
// Add where from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);