Qual: Make option to create automatic personal stock easier to setup

This commit is contained in:
Laurent Destailleur
2010-06-01 22:22:09 +00:00
parent d6984e7133
commit 60dc831ec6
4 changed files with 19 additions and 13 deletions

View File

@@ -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 '</tr>'."\n";
// sousproduits activation/desactivation
$var=!$var;
print "<tr ".$bc[$var].">";
/*print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("UserWarehouse").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK\">";
print $html->selectyesno("STOCK_USERSTOCK",$conf->global->STOCK_USERSTOCK,1);
@@ -146,7 +148,7 @@ print "</form>\n</td>\n</tr>\n";
if ($conf->global->STOCK_USERSTOCK == 1)
{
$var=!$var;
*/
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("UserWarehouseAutoCreate").'</td>';
@@ -155,12 +157,11 @@ if ($conf->global->STOCK_USERSTOCK == 1)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
print $html->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print "</td>\n";
print "</tr>\n";
}
/*} */
// Title rule for stock decrease

View File

@@ -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 <b>%s</b> ?
ConfirmDeleteWarehouse=Are you sure you want to delete the warehouse <b>%s</b> ?
PersonalStock=Personal stock %s
ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s

View File

@@ -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 <b>%s</b> ?
ConfirmDeleteWarehouse=Êtes-vous sûr de vouloir supprimer l'entrepôt <b>%s</b> ?
PersonalStock=Stock personnel %s
ThisWarehouseIsPersonalStock=Cet entrepôt représente le stock personnel de %s %s

View File

@@ -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);
}