From a2f1f4331e35549ce0ca76373f5493ef42f4bca1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 18 Mar 2022 11:11:25 +0100 Subject: [PATCH] NEW add selectCompaniesForNewContactListWhere hook --- htdocs/core/class/html.formcompany.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 5b3d07fe80f..fbaee3331c5 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -618,7 +618,7 @@ class FormCompany extends Form */ public function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '') { - global $conf, $langs; + global $conf, $hookmanager; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { // Use Ajax search @@ -718,6 +718,10 @@ class FormCompany extends Form if (is_array($limitto) && count($limitto)) { $sql .= " AND s.rowid IN (".$this->db->sanitize(join(',', $limitto)).")"; } + // Add where from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('selectCompaniesForNewContactListWhere', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; $sql .= " ORDER BY s.nom ASC"; $resql = $this->db->query($sql);