From 5f32475cb051a6c12b8dd3203572b961dfce73d4 Mon Sep 17 00:00:00 2001 From: Jyhere Date: Fri, 21 Feb 2025 11:08:31 +0100 Subject: [PATCH] NEW: add hooks to modify select_produits_fournisseurs_list sql query As for the select_products_list() method, add hooks to add columns in select and sql joins. --- htdocs/core/class/html.form.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a93bf6b88b8..b830fa02d22 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3779,7 +3779,19 @@ class Form if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units"; } + + // Add select from hooks + $parameters = []; + $reshook = $hookmanager->executeHooks('selectSuppliersProductsListSelect', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + $sql .= " FROM " . $this->db->prefix() . "product as p"; + + // Add join from hooks + $parameters = []; + $reshook = $hookmanager->executeHooks('selectSuppliersProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; + $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; if ($socid > 0) { $sql .= " AND pfp.fk_soc = " . ((int) $socid);