From 207dc1df5528cf74dea92f82930645bf1da30d6f Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Tue, 8 Jun 2021 12:34:26 +0200 Subject: [PATCH 1/6] Adding hooks on product stat in order to allow to expand stat on other modules --- htdocs/core/lib/product.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 9825b2dac2c..a63871689b4 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -362,7 +362,7 @@ function show_stats_for_company($product, $socid) { global $conf, $langs, $user, $db; $form = new Form($db); - + $hookmanager->initHooks(array('productstats')); $nblines = 0; print ''; @@ -558,6 +558,10 @@ function show_stats_for_company($product, $socid) print ''; print ''; } + $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + print $hookmanager->resPrint; return $nblines++; } From 2e6650924560ee5eca40da063cf0b0b4aebdff01 Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Tue, 8 Jun 2021 15:47:20 +0200 Subject: [PATCH 2/6] Adding hooks on product stat in order to allow to expand stat on other modules --- htdocs/core/lib/product.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a63871689b4..b22207c5dda 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -360,7 +360,7 @@ function product_lot_admin_prepare_head() */ function show_stats_for_company($product, $socid) { - global $conf, $langs, $user, $db; + global $conf, $langs, $user, $db, $hookmanager; $form = new Form($db); $hookmanager->initHooks(array('productstats')); $nblines = 0; From 4b8dfc1abe8744df3f8a42c107894f58da948266 Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Tue, 8 Jun 2021 18:11:59 +0200 Subject: [PATCH 3/6] Adding hooks on product stat in order to allow to expand stat on other modules --- htdocs/core/lib/product.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index b22207c5dda..e87e63666ef 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -558,9 +558,10 @@ function show_stats_for_company($product, $socid) print ''; print ''; } - $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product); // Note that $action and $object may have been modified by some hooks + $parameters = array('socid'=>$socid); + $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product,$nblines); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print $hookmanager->resPrint; return $nblines++; From a141d722ad3477f3e1afa501c727278911e6f4e0 Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Wed, 9 Jun 2021 08:39:06 +0200 Subject: [PATCH 4/6] Adding hooks on product stat in order to allow to expand stat on other modules stickler-ci test corrections --- htdocs/core/lib/product.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index e87e63666ef..4b249a1cc9a 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -559,11 +559,12 @@ function show_stats_for_company($product, $socid) print ''; } $parameters = array('socid'=>$socid); - $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product,$nblines); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product, $nblines); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print $hookmanager->resPrint; + return $nblines++; } From 37ebedcafa6f4ea50f8d1a08a24c75e5758fabf8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 19:32:25 +0200 Subject: [PATCH 5/6] Update product.lib.php --- htdocs/core/lib/product.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 4b249a1cc9a..52c6ff3bd98 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -361,8 +361,9 @@ function product_lot_admin_prepare_head() function show_stats_for_company($product, $socid) { global $conf, $langs, $user, $db, $hookmanager; + $form = new Form($db); - $hookmanager->initHooks(array('productstats')); + $nblines = 0; print ''; From 5d2f5b230525395fb52adf1ab3ecb1a83f13cc4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Jun 2021 19:33:07 +0200 Subject: [PATCH 6/6] Update product.lib.php --- htdocs/core/lib/product.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 52c6ff3bd98..f3ebef1e49f 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -560,7 +560,7 @@ function show_stats_for_company($product, $socid) print ''; } $parameters = array('socid'=>$socid); - $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product, $nblines); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('addMoreProductStat', $parameters, $product, $nblines); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); print $hookmanager->resPrint;