From 97a1774bf3a55fec7e92e563f934103f5027fc7a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 26 Mar 2022 12:57:30 +0100 Subject: [PATCH] NEW add hooks contact tab badge and hooks parameter for avoid conflicts --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/company.lib.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eca88386656..0f8a55960c9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 8ebf2e02047..a98931ab79f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -65,6 +65,15 @@ function societe_prepare_head(Societe $object) $sql = "SELECT COUNT(p.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".((int) $object->id); + // 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 = ".$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);