Fix: Pb in selecting rule for stock management
This commit is contained in:
parent
6238dd27ad
commit
d1c615ef14
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -51,46 +52,38 @@ elseif ($_POST["action"] == 'stock_userstock_autocreate')
|
||||
Header("Location: stock.php");
|
||||
exit;
|
||||
}
|
||||
elseif ($_POST["action"] == 'stock_bill')
|
||||
// Mode of stock changement
|
||||
elseif ( $_POST["action"] == 'stock_bill'
|
||||
|| $_POST["action"] == 'stock_validateorder'
|
||||
|| $_POST["action"] == 'stock_shipment')
|
||||
{
|
||||
dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", $_POST["stock_bill"]);
|
||||
//Si activ<69>e on d<>sactive la d<>cr<63>mentation du stock <20> la validation de commande et/ou <20> l'exp<78>dition
|
||||
if ($_POST["stock_bill"] == 1)
|
||||
{
|
||||
if ($conf->commande->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", 0);
|
||||
if ($conf->expedition->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", 0);
|
||||
}
|
||||
Header("Location: stock.php");
|
||||
exit;
|
||||
}
|
||||
elseif ($_POST["action"] == 'stock_validateorder')
|
||||
{
|
||||
dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", $_POST["stock_validateorder"]);
|
||||
//Si activ<69>e on d<>sactive la d<>cr<63>mentation du stock <20> la facturation et/ou <20> l'exp<78>dition
|
||||
if ($_POST["stock_validateorder"] == 1)
|
||||
{
|
||||
if ($conf->facture->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", 0);
|
||||
if ($conf->expedition->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", 0);
|
||||
}
|
||||
Header("Location: stock.php");
|
||||
exit;
|
||||
}
|
||||
elseif ($_POST["action"] == 'stock_shipment')
|
||||
{
|
||||
dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", $_POST["stock_shipment"]);
|
||||
//Si activ<69>e on d<>sactive la d<>cr<63>mentation du stock <20> la facturation et/ou <20> la validation de commande
|
||||
if ($_POST["stock_shipment"] == 1)
|
||||
{
|
||||
if ($conf->facture->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", 0);
|
||||
if ($conf->commande->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", 0);
|
||||
}
|
||||
Header("Location: stock.php");
|
||||
exit;
|
||||
}
|
||||
$count=0;
|
||||
$db->begin();
|
||||
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '');
|
||||
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '');
|
||||
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '');
|
||||
if ($_POST["action"] == 'stock_bill') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", $_POST["stock_bill"]);
|
||||
if ($_POST["action"] == 'stock_validateorder') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", $_POST["stock_validateorder"]);
|
||||
if ($_POST["action"] == 'stock_shipment') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", $_POST["stock_shipment"]);
|
||||
if ($count == 4)
|
||||
{
|
||||
$db->commit();
|
||||
Header("Location: stock.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dolibarr_print_error("Error in some requests", LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affiche page
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("StockSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
@ -100,10 +93,11 @@ print '<br>';
|
||||
$html=new Form($db);
|
||||
$var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("Parameters")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n";
|
||||
print " </tr>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
/*
|
||||
* Formulaire parametres divers
|
||||
@ -138,6 +132,13 @@ if ($conf->global->STOCK_USERSTOCK == 1)
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockManagement")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n";
|
||||
print '</tr>'."\n";
|
||||
$var=true;
|
||||
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
@ -38,6 +38,7 @@ EnhancedValueOfWarehouses=Warehouses value
|
||||
UserWarehouseAutoCreate=Create a stock automatically when creating a user
|
||||
QtyDispatched=Quantity dispatched
|
||||
OrderDispatch=Order dispatching
|
||||
RuleForStockManagement=Rule for stock management
|
||||
DeStockReStockOnBill=Decrease/increase real stocks on invoices/credit notes (warning, in this version, it's only in warehous number 1 that stock is modified)
|
||||
DeStockReStockOnValidateOrder=Decrease/increase real stocks on orders notes
|
||||
DeStockReStockOnShipment=Decrease/increase real stocks on shipment
|
||||
|
||||
@ -38,9 +38,10 @@ EnhancedValueOfWarehouses=Valorisation des stocks
|
||||
UserWarehouseAutoCreate=Créer un stock automatiquement à la création d'un utilisateur
|
||||
QtyDispatched=Quantité ventilée
|
||||
OrderDispatch=Ventilation commande
|
||||
DeStockReStockOnBill=Décrémente/Incrémente les stocks réels sur les factures/avoirs (attention, dans cette version, c'est toujours dans le premier entrepot numero 1 que se fait l'ajustement)
|
||||
DeStockReStockOnValidateOrder=Décrémente/Incrémente les stocks réels sur les commandes
|
||||
DeStockReStockOnShipment=Décrémente/Incrémente les stocks réels sur les expéditions
|
||||
RuleForStockManagement=Règle de gestion de stock
|
||||
DeStockReStockOnBill=Décrémente/Incrémente les stocks physiques sur les factures/avoirs (attention, dans cette version, c'est toujours dans le premier entrepot numero 1 que se fait l'ajustement)
|
||||
DeStockReStockOnValidateOrder=Décrémente/Incrémente les stocks physiques sur les commandes
|
||||
DeStockReStockOnShipment=Décrémente/Incrémente les stocks physiques sur les expéditions
|
||||
StockDiffPhysicTeoric=Raison écart stock physique-théorique
|
||||
StockLimitShort=Seuil
|
||||
StockLimit=Seuil alerte stock
|
||||
|
||||
@ -302,7 +302,7 @@ function dolibarr_get_const($db, $name)
|
||||
\param type Type de constante (chaine par défaut)
|
||||
\param visible La constante est elle visible (0 par défaut)
|
||||
\param note Explication de la constante
|
||||
\return int <0 si ko, >0 si ok
|
||||
\return int -1 if KO, 1 if OK
|
||||
*/
|
||||
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user