diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index ad4acbe362a..7038c745364 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin @@ -115,8 +115,9 @@ if ($action == "correct_stock" && ! $cancel) $object = new Product($db); $result=$object->fetch($id); - if ($object->hasbatch() && (! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors'); + if ($object->hasbatch() && ! GETPOST("batch_number")) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); $error++; $action='correction'; } @@ -202,7 +203,19 @@ if ($action == "transfert_stock" && ! $cancel) $error++; $action='transfert'; } - + if (! empty($conf->productbatch->enabled)) + { + $object = new Product($db); + $result=$object->fetch($id); + + if ($object->hasbatch() && ! GETPOST("batch_number")) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); + $error++; + $action='transfert'; + } + } + if (! $error) { if ($id) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index b1121731293..90a7468a351 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -80,11 +80,11 @@ print ''; print ''; - // Eat-by date + // Serial / Eat-by date if ((! empty($conf->productbatch->enabled)) && is_object($product) && $product->hasbatch()) { print ''; - print ''.$langs->trans("batch_number").''; + print ''.$langs->trans("batch_number").''; print ''; print ''; print ''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 93c3135e5f1..0f13a5452da 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -75,7 +75,7 @@ if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { print ''; - print ''.$langs->trans("batch_number").''; + print ''.$langs->trans("batch_number").''; print ' 0 ? ' disabled':'').' value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">'; // If form was opened for a specific pdluoid, field is disabled print ''; print '';