From a06c5b251e11454873a78180fa81e35633c591a7 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 17 Dec 2014 15:49:51 +0100 Subject: [PATCH 1/3] Fix: check warehouse on product batch Only check warehouse when on actions 'create' and 'add' --- htdocs/expedition/card.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 4e795005abb..f7c27e129d1 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -90,18 +90,19 @@ $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'); From f7d2d0e81f0bb3836829ed4af24f5c48c52fc1a7 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 17 Dec 2014 15:51:12 +0100 Subject: [PATCH 2/3] Revert "Fix: check warehouse on product batch" This reverts commit a06c5b251e11454873a78180fa81e35633c591a7. --- htdocs/expedition/card.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f7c27e129d1..4e795005abb 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -90,19 +90,18 @@ $hookmanager->initHooks(array('expeditioncard','globalcard')); */ $warehousecanbeselectedlater=1; -if ($action == 'create' || $action == 'add') +if (! empty($conf->productbatch->enabled)) { - if (! empty($conf->productbatch->enabled)) + if (! (GETPOST('entrepot_id','int') > 0)) { - 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; - } + $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'); From 722fdaa4eb69aab664774b663c23a4cfc19c26cc Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 17 Dec 2014 15:58:48 +0100 Subject: [PATCH 3/3] Fix: check warehouse on product batch Only check warehouse on actions 'create' and 'add' --- htdocs/expedition/card.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 4e795005abb..6ee45778d18 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -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');