From 50ae1b1f7693f53cc687c681a4cd716bb8822db0 Mon Sep 17 00:00:00 2001 From: kamel Date: Fri, 10 Jun 2022 10:19:56 +0200 Subject: [PATCH] NEW: Add new hook for show virtual stock details on product stock card --- htdocs/product/stock/product.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index b9fc1a201e5..e8622781a3f 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -734,6 +734,15 @@ if ($id > 0 || $ref) { $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); + $parameters = array(); + $reshook = $hookmanager->executeHooks('physicalStockTextStockOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) { + $text_stock_options = $hookmanager->resPrint; + } elseif ($reshook == 0) { + $text_stock_options .= $hookmanager->resPrint; + } else { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } print ''; print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); @@ -820,6 +829,15 @@ if ($id > 0 || $ref) { $helpondiff .= $langs->trans("ProductQtyToConsumeByMO").': '.$object->stats_mrptoconsume['qty'].'
'; $helpondiff .= $langs->trans("ProductQtyToProduceByMO").': '.$object->stats_mrptoproduce['qty']; } + $parameters = array('found' => &$found, 'id' => $object->id, 'includedraftpoforvirtual' => null); + $reshook = $hookmanager->executeHooks('virtualStockHelpOnDiff', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) { + $helpondiff = $hookmanager->resPrint; + } elseif ($reshook == 0) { + $helpondiff .= $hookmanager->resPrint; + } else { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } // Calculating a theorical value