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:
commit
7d60eefb9a
@ -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 (";
|
||||||
@ -1679,6 +1684,10 @@ class Form
|
|||||||
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
|
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
|
||||||
$sql .= " AND sp.statut <> 0";
|
$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";
|
$sql .= " ORDER BY sp.lastname ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
|
dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
|
||||||
@ -2462,6 +2471,7 @@ class Form
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
global $hookmanager;
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
$outarray = array();
|
$outarray = array();
|
||||||
@ -2607,6 +2617,10 @@ class Form
|
|||||||
} elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
|
} elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
|
||||||
$sql .= " AND p.fk_product_type = 0";
|
$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
|
// Add criteria on ref/label
|
||||||
if ($filterkey != '') {
|
if ($filterkey != '') {
|
||||||
$sql .= ' AND (';
|
$sql .= ' AND (';
|
||||||
@ -3180,6 +3194,7 @@ class Form
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
|
global $hookmanager;
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
$outarray = array();
|
$outarray = array();
|
||||||
@ -3229,6 +3244,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 (';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user