* Copyright (C) 2008-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/admin/stock.php * \ingroup stock * \brief Page d'administration/configuration du module gestion de stock */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load("admin"); $langs->load("stocks"); // Securit check if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); /* * Actions */ if ($action == 'STOCK_USERSTOCK_AUTOCREATE') { $db->begin(); $res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity); } // Mode of stock decrease if ($action == 'STOCK_CALCULATE_ON_BILL' || $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER' || $action == 'STOCK_CALCULATE_ON_SHIPMENT') { $db->begin(); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity); } // Mode of stock increase if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL' || $action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER' || $action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') { $db->begin(); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", '','chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_BILL", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_BILL','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity); } if($action == 'USE_VIRTUAL_STOCK') { $db->begin(); $res = dolibarr_set_const($db, "USE_VIRTUAL_STOCK", GETPOST('USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity); } if($action) { if (! $res > 0) $error++; if (! $error) { $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); setEventMessage($langs->trans("Error"),'errors'); } } /* * View */ llxHeader('',$langs->trans("StockSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup'); print '
'; $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/stock.php"; $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'general'; $hselected=$h; $h++; dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); $form=new Form($db); $var=true; print ''; print ''; print " \n"; print " \n"; print ''."\n"; /* * Formulaire parametres divers */ $var=!$var; print ""; print ''; print '\n"; print "\n"; print '
'; print '
".$langs->trans("Parameters")." 
'.$langs->trans("UserWarehouseAutoCreate").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); print ''; print '
'; print "
'; print '
'; // Title rule for stock decrease print ''; print ''; print " \n"; print " \n"; print ''."\n"; $var=true; if (! empty($conf->facture->enabled)) { $var=!$var; print ""; print ''; print '\n\n"; } if (! empty($conf->commande->enabled)) { $var=!$var; print ""; print ''; print '\n\n"; } if (! empty($conf->expedition->enabled)) { $var=!$var; print ""; print ''; print '\n\n"; } print '
".$langs->trans("RuleForStockManagementDecrease")." 
'.$langs->trans("DeStockOnBill").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1); print ''; print "
\n
'.$langs->trans("DeStockOnValidateOrder").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1); print ''; print "
\n
'.$langs->trans("DeStockOnShipment").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1); print ''; print "
\n
'; print '
'; // Title rule for stock increase print ''; print ''; print " \n"; print " \n"; print ''."\n"; $var=true; if (! empty($conf->fournisseur->enabled)) { $var=!$var; print ""; print ''; print '\n\n"; } if (! empty($conf->fournisseur->enabled)) { $var=!$var; print ""; print ''; print '\n\n"; } if (! empty($conf->fournisseur->enabled)) { $var=!$var; print ""; print ''; print '\n\n"; } print '
".$langs->trans("RuleForStockManagementIncrease")." 
'.$langs->trans("ReStockOnBill").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1); print ''; print "
\n
'.$langs->trans("ReStockOnValidateOrder").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1); print ''; print "
\n
'.$langs->trans("ReStockOnDispatchOrder").''; print "
"; print ''; print ""; print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1); print ''; print "
\n
'; print '
'; print ''; print ''; print " \n"; print " \n"; print ''."\n"; $var = !$var; print ""; print ''; print '\n"; print "\n"; print '
".$langs->trans("RuleForStockReplenishment")." 
'.$langs->trans("UseVirtualStock").''; print "
"; print ''; print ""; print $form->selectyesno("USE_VIRTUAL_STOCK",$conf->global->USE_VIRTUAL_STOCK,1); print ''; print '
'; print "
'; $db->close(); llxFooter(); ?>