NEW add selectThirdpartyListWhere hook

This commit is contained in:
Regis Houssin 2022-03-17 10:18:30 +01:00
parent e8b5fa45f2
commit dbd0dd7e97

View File

@ -1320,6 +1320,7 @@ class Form
{ {
// phpcs:enable // phpcs:enable
global $conf, $user, $langs; global $conf, $user, $langs;
global $hookmanager;
$out = ''; $out = '';
$num = 0; $num = 0;
@ -1367,6 +1368,10 @@ class Form
if (!empty($excludeids)) { if (!empty($excludeids)) {
$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $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 // Add criteria
if ($filterkey && $filterkey != '') { if ($filterkey && $filterkey != '') {
$sql .= " AND ("; $sql .= " AND (";
@ -3185,6 +3190,7 @@ class Form
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf, $user; global $langs, $conf, $user;
global $hookmanager;
$out = ''; $out = '';
$outarray = array(); $outarray = array();
@ -3234,6 +3240,10 @@ class Form
if (!empty($filtre)) { if (!empty($filtre)) {
$sql .= " ".$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 // Add criteria on ref/label
if ($filterkey != '') { if ($filterkey != '') {
$sql .= ' AND ('; $sql .= ' AND (';