Fix: uniform code

This commit is contained in:
Regis Houssin
2012-01-13 18:24:25 +01:00
parent d5131b0e16
commit 94ea9f3c55
3 changed files with 20 additions and 29 deletions

View File

@@ -95,11 +95,11 @@ class User extends CommonObject
/**
* Constructor de la classe
*
* @param DoliDb $DB Database handler
* @param DoliDb $db Database handler
*/
function User($DB)
function __construct($db)
{
$this->db = $DB;
$this->db = $db;
// Preference utilisateur
$this->liste_limit = 0;
@@ -107,8 +107,6 @@ class User extends CommonObject
$this->all_permissions_are_loaded = 0;
$this->admin=0;
return 1;
}
/**

View File

@@ -43,10 +43,10 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
$langs->load("users");
$langs->load("other");
$id=GETPOST("id");
$action=GETPOST("action");
$confirm=GETPOST("confirm");
$userid=GETPOST("user","int");
$id=GETPOST('id', 'int');
$action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
$userid=GETPOST('user', 'int');
// Security check
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
@@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
{
if ($caneditperms)
{
$object->fetch($_GET["id"]);
$object->fetch($id);
$object->delete();
Header("Location: index.php");
exit;
@@ -95,11 +95,10 @@ if ($action == 'add')
if (! $message)
{
$object->nom = trim($_POST["nom"]);
if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode))
$object->entity = 0;
else
$object->entity = $_POST["entity"];
$object->note = trim($_POST["note"]);
if($conf->multicompany->enabled && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
else $object->entity = $_POST["entity"];
$db->begin();
@@ -176,11 +175,10 @@ if ($action == 'update')
$object->oldcopy=dol_clone($object);
$object->nom = trim($_POST["group"]);
if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode))
$object->entity = 0;
else
$object->entity = $_POST["entity"];
$object->note = dol_htmlcleanlastbr($_POST["note"]);
if($conf->multicompany->enabled && !empty($conf->multicompany->transverse_mode)) $object->entity = 0;
else $object->entity = $_POST["entity"];
$ret=$object->update();
@@ -507,5 +505,6 @@ else
llxFooter();
if (is_object($db)) $db->close();
$db->close();
?>

View File

@@ -40,12 +40,10 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
}
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$socid=0;
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
}
if ($user->societe_id > 0) $socid = $user->societe_id;
$fgroup = new Usergroup($db);
$fgroup->fetch($id);
@@ -56,7 +54,7 @@ $fgroup->getrights();
* Actions
*/
if ($_GET["action"] == 'dolibarr2ldap')
if ($action == 'dolibarr2ldap')
{
$message="";
@@ -84,8 +82,6 @@ if ($_GET["action"] == 'dolibarr2ldap')
}
/*
* View
*/
@@ -208,10 +204,8 @@ else
print '</table>';
llxFooter();
$db->close();
llxFooter();
?>