Merge pull request #20386 from hregis/new_add_hook_in_select_product

NEW add hooks select product list and select thirdparty list function
This commit is contained in:
Laurent Destailleur 2022-03-17 13:26:01 +01:00 committed by GitHub
commit 7d60eefb9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1320,6 +1320,7 @@ class Form
{
// phpcs:enable
global $conf, $user, $langs;
global $hookmanager;
$out = '';
$num = 0;
@ -1367,6 +1368,10 @@ class Form
if (!empty($excludeids)) {
$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")";
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('selectThirdpartyListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Add criteria
if ($filterkey && $filterkey != '') {
$sql .= " AND (";
@ -1679,6 +1684,10 @@ class Form
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
$sql .= " AND sp.statut <> 0";
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('selectContactListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " ORDER BY sp.lastname ASC";
dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
@ -2462,6 +2471,7 @@ class Form
{
// phpcs:enable
global $langs, $conf;
global $hookmanager;
$out = '';
$outarray = array();
@ -2607,6 +2617,10 @@ class Form
} elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$sql .= " AND p.fk_product_type = 0";
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Add criteria on ref/label
if ($filterkey != '') {
$sql .= ' AND (';
@ -3180,6 +3194,7 @@ class Form
{
// phpcs:enable
global $langs, $conf, $user;
global $hookmanager;
$out = '';
$outarray = array();
@ -3229,6 +3244,10 @@ class Form
if (!empty($filtre)) {
$sql .= " ".$filtre;
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('selectSuppliersProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Add criteria on ref/label
if ($filterkey != '') {
$sql .= ' AND (';