Fix: Pb in selecting rule for stock management
This commit is contained in:
parent
6238dd27ad
commit
d1c615ef14
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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
|
* 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
|
* 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");
|
Header("Location: stock.php");
|
||||||
exit;
|
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"]);
|
$count=0;
|
||||||
//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
|
$db->begin();
|
||||||
if ($_POST["stock_bill"] == 1)
|
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '');
|
||||||
{
|
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '');
|
||||||
if ($conf->commande->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", 0);
|
$count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '');
|
||||||
if ($conf->expedition->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", 0);
|
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"]);
|
||||||
Header("Location: stock.php");
|
if ($_POST["action"] == 'stock_shipment') $count+=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", $_POST["stock_shipment"]);
|
||||||
exit;
|
if ($count == 4)
|
||||||
}
|
{
|
||||||
elseif ($_POST["action"] == 'stock_validateorder')
|
$db->commit();
|
||||||
{
|
Header("Location: stock.php");
|
||||||
dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", $_POST["stock_validateorder"]);
|
exit;
|
||||||
//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)
|
else
|
||||||
{
|
{
|
||||||
if ($conf->facture->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", 0);
|
$db->rollback();
|
||||||
if ($conf->expedition->enabled) dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", 0);
|
dolibarr_print_error("Error in some requests", LOG_ERR);
|
||||||
}
|
}
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affiche page
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans("StockSetup"));
|
llxHeader('',$langs->trans("StockSetup"));
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
@ -100,10 +93,11 @@ print '<br>';
|
|||||||
$html=new Form($db);
|
$html=new Form($db);
|
||||||
$var=true;
|
$var=true;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print " <td>".$langs->trans("Parameters")."</td>\n";
|
print " <td>".$langs->trans("Parameters")."</td>\n";
|
||||||
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n";
|
print " <td align=\"right\" width=\"160\">".$langs->trans("Value")."</td>\n";
|
||||||
print " </tr>\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Formulaire parametres divers
|
* Formulaire parametres divers
|
||||||
@ -138,6 +132,13 @@ if ($conf->global->STOCK_USERSTOCK == 1)
|
|||||||
print "</tr>\n";
|
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)
|
if ($conf->facture->enabled)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ EnhancedValueOfWarehouses=Warehouses value
|
|||||||
UserWarehouseAutoCreate=Create a stock automatically when creating a user
|
UserWarehouseAutoCreate=Create a stock automatically when creating a user
|
||||||
QtyDispatched=Quantity dispatched
|
QtyDispatched=Quantity dispatched
|
||||||
OrderDispatch=Order dispatching
|
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)
|
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
|
DeStockReStockOnValidateOrder=Decrease/increase real stocks on orders notes
|
||||||
DeStockReStockOnShipment=Decrease/increase real stocks on shipment
|
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
|
UserWarehouseAutoCreate=Créer un stock automatiquement à la création d'un utilisateur
|
||||||
QtyDispatched=Quantité ventilée
|
QtyDispatched=Quantité ventilée
|
||||||
OrderDispatch=Ventilation commande
|
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)
|
RuleForStockManagement=Règle de gestion de stock
|
||||||
DeStockReStockOnValidateOrder=Décrémente/Incrémente les stocks réels sur les commandes
|
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)
|
||||||
DeStockReStockOnShipment=Décrémente/Incrémente les stocks réels sur les expéditions
|
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
|
StockDiffPhysicTeoric=Raison écart stock physique-théorique
|
||||||
StockLimitShort=Seuil
|
StockLimitShort=Seuil
|
||||||
StockLimit=Seuil alerte stock
|
StockLimit=Seuil alerte stock
|
||||||
|
|||||||
@ -302,7 +302,7 @@ function dolibarr_get_const($db, $name)
|
|||||||
\param type Type de constante (chaine par défaut)
|
\param type Type de constante (chaine par défaut)
|
||||||
\param visible La constante est elle visible (0 par défaut)
|
\param visible La constante est elle visible (0 par défaut)
|
||||||
\param note Explication de la constante
|
\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='')
|
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='')
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user