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 'id.'&action=confirm_validate&confirm=yes&token='.newToken().'">'.$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";
}