diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang new file mode 100644 index 00000000000..754f94e9d0b --- /dev/null +++ b/htdocs/langs/en_US/stocks.lang @@ -0,0 +1,13 @@ +# Dolibarr language file - en_US - stocks +WarehouseCard=Warehouse card +Warehouse=Warehouse +NewWarehouse=New warehouse +WarehouseOpened=Warehouse opened +WarehouseClosed=Warehouse closed +Stock=Stock +Stocks=Stocks +Movement=Movement +Movements=Movements +CorrectStock=Correct stock +ListOfStockMovements=List of stock movements +ErrorWarehouseLabelRequired=Warehouse label is required \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang new file mode 100644 index 00000000000..84192223327 --- /dev/null +++ b/htdocs/langs/fr_FR/stocks.lang @@ -0,0 +1,13 @@ +# Dolibarr language file - fr_FR - stocks +WarehouseCard=Fiche entrepôt +Warehouse=Entrepôt +NewWarehouse=Nouvel entrepôt +WarehouseOpened=Entrepôt ouvert +WarehouseClosed=Entrepôt fermé +Stock=Stock +Stocks=Stocks +Movement=Mouvement +Movements=Mouvements +CorrectStock=Corriger stock +ListOfStockMovements=Liste des mouvements de stock +ErrorWarehouseLabelRequired=Le libellé de l'entrepôt est obligatoire \ No newline at end of file diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index e2946fed611..f1bf15e6d7e 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -21,7 +21,8 @@ * */ -/** \file htdocs/product/stock/fiche.php +/** + \file htdocs/product/stock/fiche.php \ingroup stock \brief Page fiche entrepot \version $Revision$ @@ -30,6 +31,7 @@ require("./pre.inc.php"); $langs->load("products"); +$langs->load("stocks"); $mesg = ''; @@ -38,15 +40,21 @@ $mesg = ''; if ($_POST["action"] == 'add') { - $entrepot = new Entrepot($db); - - $entrepot->ref = $_POST["ref"]; - $entrepot->libelle = $_POST["libelle"]; - $entrepot->description = $_POST["desc"]; - $entrepot->statut = $_POST["statut"]; - - $id = $entrepot->create($user); - Header("Location: fiche.php?id=$id"); + $entrepot = new Entrepot($db); + + $entrepot->ref = trim($_POST["ref"]); + $entrepot->libelle = trim($_POST["libelle"]); + $entrepot->description = trim($_POST["desc"]); + $entrepot->statut = $_POST["statut"]; + + if ($entrepot->libelle) { + $id = $entrepot->create($user); + Header("Location: fiche.php?id=$id"); + } + else { + $mesg="
".$langs->trans("ErrorWarehouseLabelRequired")."
"; + $_GET["action"]="create"; // Force retour sur page création + } } if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) @@ -77,7 +85,9 @@ if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) } -llxHeader("","","Fiche entrepôt"); + +llxHeader("","",$langs->trans("WarehouseCard")); + if ($_GET["cancel"] == $langs->trans("Cancel")) { @@ -96,7 +106,11 @@ if ($_GET["action"] == 'create') print ''; print ''."\n"; print_titre($langs->trans("NewWarehouse")); - + + if ($mesg) { + print $mesg; + } + print ''; print ''; print '
'.$langs->trans("Label").'
'.$langs->trans("Description").'';