Merge pull request #21198 from OPEN-DSI/develop_new_hook_virtual_product_stock

NEW: Add new hook for show virtual stock details on product stock card
This commit is contained in:
Laurent Destailleur 2022-07-11 01:53:51 +02:00 committed by GitHub
commit 11fa745caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -734,6 +734,15 @@ if ($id > 0 || $ref) {
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'<br>' : '');
$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 '<tr><td>';
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'].'<br>';
$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