From a28402e3a0704e2c313434b0a63734927b7a7c24 Mon Sep 17 00:00:00 2001
From: antonin_tdj <50403308+ibuiv@users.noreply.github.com>
Date: Fri, 23 Apr 2021 18:03:16 +0200
Subject: [PATCH 1/2] Product Stock Card - add new standard Hooks
---
htdocs/product/stock/card.php | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 0a77a39a0df..0cd30ed827a 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -571,6 +571,9 @@ if ($action == 'create') {
print '
';
print "";
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
print_liste_field_titre("Product", "", "p.ref", "&id=".$id, "", "", $sortfield, $sortorder);
print_liste_field_titre("Label", "", "p.label", "&id=".$id, "", "", $sortfield, $sortorder);
print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&id=".$id, "", '', $sortfield, $sortorder, 'right ');
@@ -591,6 +594,10 @@ if ($action == 'create') {
if ($user->rights->stock->creer) {
print_liste_field_titre('');
}
+ // Hook fields
+ $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
print "
\n";
$totalunit = 0;
@@ -601,6 +608,13 @@ if ($action == 'create') {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ",fk_unit";
}
+ // Add fields from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
+ if($reshook > 0){ //Note that $sql is replaced if reshook > 0
+ $sql = "";
+ }
+ $sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE ps.fk_product = p.rowid";
$sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
@@ -635,6 +649,9 @@ if ($action == 'create') {
//print ''.dol_print_date($objp->datem).' | ';
print '';
+ $parameters = array('obj'=>$objp);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
print "| ";
$productstatic->id = $objp->rowid;
$productstatic->ref = $objp->ref;
From 9fbb5087b91f3fdaab4b6d7a331cc1ad896d81b1 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Fri, 23 Apr 2021 16:05:24 +0000
Subject: [PATCH 2/2] Fixing style errors.
---
htdocs/product/stock/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 0cd30ed827a..3ceb896741e 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -611,7 +611,7 @@ if ($action == 'create') {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
- if($reshook > 0){ //Note that $sql is replaced if reshook > 0
+ if ($reshook > 0) { //Note that $sql is replaced if reshook > 0
$sql = "";
}
$sql .= $hookmanager->resPrint;
|