Qual: Uniformize code
This commit is contained in:
parent
82d08001fe
commit
8eec591dd6
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -42,16 +43,27 @@ $action=GETPOST('action');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstproject=$_POST['maskconstproject'];
|
$maskconstproject=GETPOST("maskconstproject");
|
||||||
$maskproject=$_POST['maskproject'];
|
$maskproject=GETPOST("maskproject");
|
||||||
if ($maskconstproject) dolibarr_set_const($db,$maskconstproject,$maskproject,'chaine',0,'',$conf->entity);
|
if ($maskconstproject) $res = dolibarr_set_const($db,$maskconstproject,$maskproject,'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"] == 'specimen')
|
if ($action == 'specimen')
|
||||||
{
|
{
|
||||||
$modele=$_GET["module"];
|
$modele=GETPOST("module");
|
||||||
|
|
||||||
$project = new Project($db);
|
$project = new Project($db);
|
||||||
$project->initAsSpecimen();
|
$project->initAsSpecimen();
|
||||||
@ -84,13 +96,16 @@ if ($_GET["action"] == 'specimen')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
$label = GETPOST("label");
|
||||||
|
$scandir = GETPOST("scandir");
|
||||||
|
|
||||||
$type='project';
|
$type='project';
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||||
$sql.= " VALUES ('".$db->escape($_GET["value"])."','".$type."',".$conf->entity.", ";
|
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
|
||||||
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", ";
|
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||||
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null");
|
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
@ -98,7 +113,7 @@ if ($_GET["action"] == 'set')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'del')
|
if ($action == 'del')
|
||||||
{
|
{
|
||||||
$type='project';
|
$type='project';
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
@ -111,27 +126,30 @@ if ($_GET["action"] == 'del')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'setdoc')
|
if ($action == 'setdoc')
|
||||||
{
|
{
|
||||||
|
$label = GETPOST("label");
|
||||||
|
$scandir = GETPOST("scandir");
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity))
|
if (dolibarr_set_const($db, "PROJECT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||||
{
|
{
|
||||||
$conf->global->PROJECT_ADDON_PDF = $_GET["value"];
|
$conf->global->PROJECT_ADDON_PDF = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On active le modele
|
// On active le modele
|
||||||
$type='project';
|
$type='project';
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
$sql_del.= " WHERE nom = '".$db->escape($_GET["value"])."'";
|
$sql_del.= " WHERE nom = '".$db->escape($value)."'";
|
||||||
$sql_del.= " AND type = '".$type."'";
|
$sql_del.= " AND type = '".$type."'";
|
||||||
$sql_del.= " AND entity = ".$conf->entity;
|
$sql_del.= " AND entity = ".$conf->entity;
|
||||||
$result1=$db->query($sql_del);
|
$result1=$db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||||
$sql.= " VALUES ('".$db->escape($_GET["value"])."', '".$type."', ".$conf->entity.", ";
|
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
|
||||||
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", ";
|
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||||
$sql.= (! empty($_GET["scandir"])?"'".$db->escape($_GET["scandir"])."'":"null");
|
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$result2=$db->query($sql);
|
$result2=$db->query($sql);
|
||||||
if ($result1 && $result2)
|
if ($result1 && $result2)
|
||||||
@ -144,7 +162,7 @@ if ($_GET["action"] == 'setdoc')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'setmod')
|
if ($action == 'setmod')
|
||||||
{
|
{
|
||||||
// TODO Verifier si module numerotation choisi peut etre active
|
// TODO Verifier si module numerotation choisi peut etre active
|
||||||
// par appel methode canBeActivated
|
// par appel methode canBeActivated
|
||||||
@ -380,5 +398,9 @@ if (is_resource($handle))
|
|||||||
|
|
||||||
print '</table><br/>';
|
print '</table><br/>';
|
||||||
|
|
||||||
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user