From 354b784279984aca4d172f9a2db9f8fd1a1a38fe Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 24 Jan 2020 09:57:17 +0100 Subject: [PATCH] NEW: Add hook on margin list page --- htdocs/margin/agentMargins.php | 11 +++++++++-- htdocs/margin/customerMargins.php | 11 +++++++++-- htdocs/margin/productMargins.php | 3 +++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 4080822b9ef..852bf4934d5 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -74,6 +74,9 @@ if ($user->rights->margins->read->all) { } $result = restrictedArea($user, 'margins'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new User($db); +$hookmanager->initHooks(array('marginagentlist')); /* * Actions @@ -205,8 +208,11 @@ if ($result) else // value is 'costprice' or 'pmp' $labelcostprice = 'CostPrice'; + $moreforfilter = ''; + $i = 0; - print ""; + print '
'; + print '
'."\n"; print ''; if ($agentid > 0) @@ -299,7 +305,8 @@ if ($result) print "\n"; } } - print "
"; + print ""; + print ''; } else { diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 35dde9a2e62..ed0a2a01b34 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -62,6 +62,9 @@ if (!empty($_POST['startdatemonth'])) if (!empty($_POST['enddatemonth'])) $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new Societe($db); +$hookmanager->initHooks(array('margincustomerlist')); /* * View @@ -255,8 +258,11 @@ if ($result) else // value is 'costprice' or 'pmp' $labelcostprice = 'CostPrice'; + $moreforfilter = ''; + $i = 0; - print ""; + print '
'; + print '
'."\n"; print ''; if (!empty($client)) { @@ -359,7 +365,8 @@ if ($result) print "\n"; print "\n"; - print "
".(($markRate === '') ? 'n/a' : price($markRate, null, null, null, null, $rounding)."%")."
"; + print ""; + print ''; } else { diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 4b9c271cc5c..27354556910 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -76,6 +76,9 @@ if (!empty($_POST['startdatemonth'])) if (!empty($_POST['enddatemonth'])) $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new Product($db); +$hookmanager->initHooks(array('marginproductlist')); /* * View