Fix: check warehouse on product batch

Only check warehouse on actions 'create' and 'add'
This commit is contained in:
Francis Appels 2014-12-17 15:58:48 +01:00
parent f7d2d0e81f
commit 722fdaa4eb

View File

@ -90,18 +90,20 @@ $hookmanager->initHooks(array('expeditioncard','globalcard'));
*/
$warehousecanbeselectedlater=1;
if (! empty($conf->productbatch->enabled))
if (($action == 'create') || ($action == 'add'))
{
if (! (GETPOST('entrepot_id','int') > 0))
if (! empty($conf->productbatch->enabled))
{
$langs->load("errors");
setEventMessage($langs->trans("WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn"),'errors');
header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.$id);
exit;
if (! (GETPOST('entrepot_id','int') > 0))
{
$langs->load("errors");
setEventMessage($langs->trans("WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn"),'errors');
header("Location: ".DOL_URL_ROOT.'/expedition/shipment.php?id='.$id);
exit;
}
}
}
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');