warning message if you try to create orders without selecting any product

This commit is contained in:
Cédric Salvador 2013-07-05 12:10:45 +02:00
parent 9ff183d432
commit d4052f7b9c
3 changed files with 7 additions and 0 deletions

View File

@ -94,3 +94,4 @@ Replenishment=Replenishment
ReplenishmentOrders=Replenishment orders
UseVirtualStock=Use virtual stock instead of physical stock
RuleForStockReplenishment=Rule for stocks replenishment
SelectProduct=Select at least one product

View File

@ -94,3 +94,4 @@ Replenishment=Réapprovisionnement
ReplenishmentOrders=Commandes de réapprovisionnement
UseVirtualStock=Utiliser le stock théorique à la place du stock physique
RuleForStockReplenishment=Règle de gestion du réapprovisionnement des stocks
SelectProduct=Sélectionnez au moins un produit

View File

@ -71,12 +71,14 @@ $offset = $limit * $page ;
//could go in the lib
if ($action == 'order') {
$linecount = GETPOST('linecount', 'int');
$box = 0;
unset($_POST['linecount']);
if ($linecount > 0) {
$suppliers = array();
for ($i = 0; $i < $linecount; $i++) {
if(GETPOST($i, 'alpha') === 'on'
&& GETPOST('fourn' . $i, 'int') > 0) { //one line
$box = $i;
$supplierpriceid = GETPOST('fourn'.$i, 'int');
//get all the parameters needed to create a line
$qty = GETPOST('tobuy'.$i, 'int');
@ -135,6 +137,9 @@ if ($action == 'order') {
header('Location: replenishorders.php');
exit;
}
}
if ($box == 0){
setEventMessage($langs->trans('SelectProduct'), 'warnings');
}
}