diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index f76d439e49f..170b400b2a0 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2614,7 +2614,15 @@ class Form
}
$sql = "SELECT ";
- $sql .= $selectFields . $selectFieldsGrouped;
+
+ // Add select from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectProductsListSelect', $parameters); // Note that $action and $object may have been modified by hook
+ if (empty($reshook)) {
+ $sql .= $selectFields.$selectFieldsGrouped.$hookmanager->resPrint;
+ } else {
+ $sql .= $hookmanager->resPrint;
+ }
if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
//Product category
@@ -2660,7 +2668,13 @@ class Form
$sql .= " DESC LIMIT 1) as price_by_qty";
$selectFields .= ", price_rowid, price_by_qty";
}
- $sql .= " FROM " . $this->db->prefix() . "product as p";
+
+ $sql .= " FROM ".$this->db->prefix()."product as p";
+ // Add from (left join) from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook
+ $sql .= $hookmanager->resPrint;
+
if (count($warehouseStatusArray)) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
@@ -2932,6 +2946,7 @@ class Form
protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '', $novirtualstock = 0)
{
global $langs, $conf, $user;
+ global $hookmanager;
$outkey = '';
$outval = '';
@@ -3217,6 +3232,14 @@ class Form
}
}
+ $parameters = array('objp'=>$objp);
+ $reshook = $hookmanager->executeHooks('constructProductListOption', $parameters); // Note that $action and $object may have been modified by hook
+ if (empty($reshook)) {
+ $opt .= $hookmanager->resPrint;
+ } else {
+ $opt = $hookmanager->resPrint;
+ }
+
$opt .= "\n";
$optJson = array(
'key' => $outkey,