From 43428f622f789f07aead4cb494505bda2f4a86cd Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 31 Mar 2022 15:28:03 +0200 Subject: [PATCH] FIX : Add sub warehouse management on inventory.php file --- htdocs/product/inventory/inventory.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 6026e4316e4..ab3c0276051 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -435,6 +435,17 @@ if ($object->id > 0) { $action = 'view'; } + if ($action == 'validate') { + $form = new Form($db); + $formquestion = ''; + if ($conf->global->INVENTORY_INCLUDE_SUB_WAREHOUSE && !empty($object->fk_warehouse)) { + $formquestion = array( + array('type' => 'checkbox', 'name' => 'include_sub_warehouse', 'label' => $langs->trans("IncludeSubWarehouse"), 'value' => 0, 'size' => '10'), + ); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateInventory'), $langs->trans('IncludeSubWarehouseExplanation'), 'confirm_validate', $formquestion, '', 1); + } + } + // Call Hook formConfirm $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -541,7 +552,11 @@ if ($object->id > 0) { if (empty($reshook)) { if ($object->status == Inventory::STATUS_DRAFT) { if ($permissiontoadd) { - print ''.$langs->trans("Validate").' ('.$langs->trans("Start").')'."\n"; + if ($conf->global->INVENTORY_INCLUDE_SUB_WAREHOUSE && !empty($object->fk_warehouse)) { + print ''.$langs->trans("Validate").' ('.$langs->trans("Start").')'; + } else { + print ''.$langs->trans("Validate").' ('.$langs->trans("Start").')'; + } } else { print ''.$langs->trans('Validate').' ('.$langs->trans("Start").')'."\n"; }