From 60dc831ec6fe8e22efa8d9635a175fbcc4a9c2dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Jun 2010 22:22:09 +0000 Subject: [PATCH] Qual: Make option to create automatic personal stock easier to setup --- htdocs/admin/stock.php | 15 ++++++++------- htdocs/langs/en_US/stocks.lang | 4 +++- htdocs/langs/fr_FR/stocks.lang | 6 ++++-- htdocs/user/class/user.class.php | 7 ++++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index f3a354d9065..2ad6e3eedb5 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -38,7 +38,7 @@ accessforbidden(); /* * Actions */ -if ($_POST["action"] == 'STOCK_USERSTOCK') +/*if ($_POST["action"] == 'STOCK_USERSTOCK') { dolibarr_set_const($db, "STOCK_USERSTOCK", $_POST["STOCK_USERSTOCK"],'chaine',0,'',$conf->entity); //On desactive l'autocreation si l'option "stock personnel" est desactivee @@ -49,7 +49,9 @@ if ($_POST["action"] == 'STOCK_USERSTOCK') Header("Location: stock.php"); exit; } -elseif ($_POST["action"] == 'STOCK_USERSTOCK_AUTOCREATE') +else +*/ +if ($_POST["action"] == 'STOCK_USERSTOCK_AUTOCREATE') { dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", $_POST["STOCK_USERSTOCK_AUTOCREATE"],'chaine',0,'',$conf->entity); Header("Location: stock.php"); @@ -133,10 +135,10 @@ print ''."\n"; // sousproduits activation/desactivation $var=!$var; -print ""; +/*print ""; print ''.$langs->trans("UserWarehouse").''; print ''; -print "
"; +print ""; print ''; print ""; print $html->selectyesno("STOCK_USERSTOCK",$conf->global->STOCK_USERSTOCK,1); @@ -146,7 +148,7 @@ print "
\n\n\n"; if ($conf->global->STOCK_USERSTOCK == 1) { $var=!$var; - +*/ print ""; print ''.$langs->trans("UserWarehouseAutoCreate").''; @@ -155,12 +157,11 @@ if ($conf->global->STOCK_USERSTOCK == 1) print ''; print ""; print $html->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); - print ''; print ''; print "\n"; print "\n"; -} +/*} */ // Title rule for stock decrease diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 66f47861bdf..578bc15d1a4 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -72,4 +72,6 @@ AverageUnitPricePMP=Average input price EstimatedStockValueShort=Estimated value of stock EstimatedStockValue=Estimated value of stock DeleteAWarehouse=Delete a warehouse -ConfirmDeleteWarehouse=Are you sure you want to delete the warehouse %s ? \ No newline at end of file +ConfirmDeleteWarehouse=Are you sure you want to delete the warehouse %s ? +PersonalStock=Personal stock %s +ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index d18a1b0e1b9..511478e4c9e 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -38,7 +38,7 @@ EnhancedValue=Valorisation PMPValue=Valorisation (PMP) PMPValueShort=PMP EnhancedValueOfWarehouses=Valorisation des stocks -UserWarehouseAutoCreate=Créer un stock automatiquement à la création d'un utilisateur +UserWarehouseAutoCreate=Créer un stock/entrepot propre à l'utilisateur automatiquement à la création de cet utilisateur QtyDispatched=Quantité ventilée OrderDispatch=Réception vers stocks RuleForStockManagementDecrease=Règle de gestion des décrémentations de stock @@ -72,4 +72,6 @@ AverageUnitPricePMP=Prix moyen pondéré (PMP) d'aquisition EstimatedStockValueShort=Valorisation (PMP) EstimatedStockValue=Valorisation acquisition stock (PMP) DeleteAWarehouse=Supprimer un entrepôt -ConfirmDeleteWarehouse=Êtes-vous sûr de vouloir supprimer l'entrepôt %s ? \ No newline at end of file +ConfirmDeleteWarehouse=Êtes-vous sûr de vouloir supprimer l'entrepôt %s ? +PersonalStock=Stock personnel %s +ThisWarehouseIsPersonalStock=Cet entrepôt représente le stock personnel de %s %s \ No newline at end of file diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 49e76e71a65..824e01dc5ad 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -750,12 +750,13 @@ class User extends CommonObject return -4; } - if (! empty($conf->global->STOCK_USERSTOCK) && ! empty($conf->global->STOCK_USERSTOCK_AUTOCREATE)) + if (! empty($conf->global->STOCK_USERSTOCK_AUTOCREATE)) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/entrepot.class.php"); + $langs->load("stocks"); $entrepot = new Entrepot($this->db); - $entrepot->libelle = 'Stock Personnel '.$this->nom; - $entrepot->description = 'Cet entrepot represente le stock personnel de '.$this->prenom.' '.$this->nom; + $entrepot->libelle = $langs->trans("PersonalStock",$this->nom); + $entrepot->description = $langs->trans("ThisWarehouseIsPersonalStock",$this->prenom,$this->nom); $entrepot->statut = 1; $entrepot->create($user); }