Uniformize code
This commit is contained in:
parent
63c25787b1
commit
7b5469007c
@ -33,9 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("orders");
|
||||
$langs->load("errors");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
@ -49,8 +47,9 @@ $value = GETPOST("value");
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder=$_POST['maskconstorder'];
|
||||
$maskorder=$_POST['maskorder'];
|
||||
$maskconstorder=GETPOST("maskconstorder");
|
||||
$maskorder=GETPOST("maskorder");
|
||||
|
||||
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
@ -67,7 +66,7 @@ if ($action == 'updateMask')
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=$_GET["module"];
|
||||
$modele=GETPOST("module");
|
||||
|
||||
$commande = new Commande($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
@ -26,13 +26,14 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php');
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("contracts");
|
||||
$langs->load("errors");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST("action");
|
||||
$value = GETPOST("value");
|
||||
|
||||
if (empty($conf->global->CONTRACT_ADDON))
|
||||
{
|
||||
$conf->global->CONTRACT_ADDON='mod_contract_serpis';
|
||||
@ -43,24 +44,36 @@ if (empty($conf->global->CONTRACT_ADDON))
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'updateMask')
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst=$_POST['maskconstcontract'];
|
||||
$maskvalue=$_POST['maskcontract'];
|
||||
if ($maskconst) dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
|
||||
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'setmod')
|
||||
if ($action == 'setmod')
|
||||
{
|
||||
dolibarr_set_const($db, "CONTRACT_ADDON",$_GET["value"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
/*
|
||||
// constants of magre model
|
||||
if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity);
|
||||
if ($_POST["action"] == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity);
|
||||
if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity);
|
||||
if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity);
|
||||
|
||||
if ($action == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity);
|
||||
if ($action == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity);
|
||||
if ($action == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity);
|
||||
if ($action == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity);
|
||||
*/
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -127,12 +140,12 @@ if (is_resource($handle))
|
||||
print '<td align="center">';
|
||||
if ($conf->global->CONTRACT_ADDON == "$file")
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'on');
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Disabled"),'off');
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
@ -170,6 +183,9 @@ if (is_resource($handle))
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -33,9 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("bills");
|
||||
$langs->load("propal");
|
||||
$langs->load("other");
|
||||
$langs->load("errors");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
@ -35,6 +35,7 @@ if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST("action");
|
||||
$value = GETPOST("value");
|
||||
|
||||
|
||||
/*
|
||||
@ -42,7 +43,7 @@ $action=GETPOST("action");
|
||||
*/
|
||||
if ($action == 'setcodeclient')
|
||||
{
|
||||
if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$_GET["value"],'chaine',0,'',$conf->entity) > 0)
|
||||
if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
@ -55,7 +56,7 @@ if ($action == 'setcodeclient')
|
||||
|
||||
if ($action == 'setcodecompta')
|
||||
{
|
||||
if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$_GET["value"],'chaine',0,'',$conf->entity) > 0)
|
||||
if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
@ -68,7 +69,8 @@ if ($action == 'setcodecompta')
|
||||
|
||||
if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_COMPANY_USE_SEARCH_TO_SELECT"],'chaine',0,'',$conf->entity);
|
||||
$companysearch = GETPOST("activate_COMPANY_USE_SEARCH_TO_SELECT");
|
||||
$res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if (! $error)
|
||||
{
|
||||
@ -114,11 +116,14 @@ if ($action == 'setModuleOptions')
|
||||
// Activate a document generator module
|
||||
if ($action == 'set')
|
||||
{
|
||||
$label = GETPOST("label");
|
||||
$scandir = GETPOST("scandir");
|
||||
|
||||
$type='company';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$db->escape($_GET["value"])."','".$type."',".$conf->entity.", ";
|
||||
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", ";
|
||||
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null");
|
||||
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||
$sql.= ")";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
@ -132,7 +137,7 @@ if ($action== 'del')
|
||||
{
|
||||
$type='company';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE nom='".$db->escape($_GET["value"])."' AND type='".$type."' AND entity=".$conf->entity;
|
||||
$sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
@ -143,11 +148,14 @@ if ($action== 'del')
|
||||
// Define default generator
|
||||
if ($action == 'setdoc')
|
||||
{
|
||||
$label = GETPOST("label");
|
||||
$scandir = GETPOST("scandir");
|
||||
|
||||
$db->begin();
|
||||
|
||||
if (dolibarr_set_const($db, "COMPANY_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity))
|
||||
if (dolibarr_set_const($db, "COMPANY_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
$conf->global->COMPANY_ADDON_PDF = $_GET["value"];
|
||||
$conf->global->COMPANY_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
@ -160,9 +168,9 @@ if ($action == 'setdoc')
|
||||
$result1=$db->query($sql_del);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$db->escape($_GET["value"])."', '".$type."', ".$conf->entity.", ";
|
||||
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", ";
|
||||
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null");
|
||||
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||
$sql.= ")";
|
||||
dol_syslog("societe.php ".$sql);
|
||||
$result2=$db->query($sql);
|
||||
@ -180,8 +188,10 @@ if ($action == 'setdoc')
|
||||
//Activate ProfId
|
||||
if ($action == 'setprofid')
|
||||
{
|
||||
$idprof="SOCIETE_IDPROF".$_GET["value"]."_UNIQUE";
|
||||
if (dolibarr_set_const($db, $idprof,$_GET["status"],'chaine',0,'',$conf->entity) > 0)
|
||||
$status = GETPOST("status");
|
||||
|
||||
$idprof="SOCIETE_IDPROF".$value."_UNIQUE";
|
||||
if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user