Fix: uniform code
This commit is contained in:
parent
d5131b0e16
commit
94ea9f3c55
@ -95,11 +95,11 @@ class User extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Constructor de la classe
|
* 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
|
// Preference utilisateur
|
||||||
$this->liste_limit = 0;
|
$this->liste_limit = 0;
|
||||||
@ -107,8 +107,6 @@ class User extends CommonObject
|
|||||||
|
|
||||||
$this->all_permissions_are_loaded = 0;
|
$this->all_permissions_are_loaded = 0;
|
||||||
$this->admin=0;
|
$this->admin=0;
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -43,10 +43,10 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
|||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
$id=GETPOST("id");
|
$id=GETPOST('id', 'int');
|
||||||
$action=GETPOST("action");
|
$action=GETPOST('action', 'alpha');
|
||||||
$confirm=GETPOST("confirm");
|
$confirm=GETPOST('confirm', 'alpha');
|
||||||
$userid=GETPOST("user","int");
|
$userid=GETPOST('user', 'int');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
|
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
|
||||||
@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
|
|||||||
{
|
{
|
||||||
if ($caneditperms)
|
if ($caneditperms)
|
||||||
{
|
{
|
||||||
$object->fetch($_GET["id"]);
|
$object->fetch($id);
|
||||||
$object->delete();
|
$object->delete();
|
||||||
Header("Location: index.php");
|
Header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
@ -95,12 +95,11 @@ if ($action == 'add')
|
|||||||
if (! $message)
|
if (! $message)
|
||||||
{
|
{
|
||||||
$object->nom = trim($_POST["nom"]);
|
$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"]);
|
$object->note = trim($_POST["note"]);
|
||||||
|
|
||||||
|
if($conf->multicompany->enabled && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
||||||
|
else $object->entity = $_POST["entity"];
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$id = $object->create();
|
$id = $object->create();
|
||||||
@ -176,12 +175,11 @@ if ($action == 'update')
|
|||||||
$object->oldcopy=dol_clone($object);
|
$object->oldcopy=dol_clone($object);
|
||||||
|
|
||||||
$object->nom = trim($_POST["group"]);
|
$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"]);
|
$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();
|
$ret=$object->update();
|
||||||
|
|
||||||
if ($ret >= 0 && ! count($object->errors))
|
if ($ret >= 0 && ! count($object->errors))
|
||||||
@ -507,5 +505,6 @@ else
|
|||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
if (is_object($db)) $db->close();
|
$db->close();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -40,12 +40,10 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
$socid=0;
|
$socid=0;
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||||
{
|
|
||||||
$socid = $user->societe_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fgroup = new Usergroup($db);
|
$fgroup = new Usergroup($db);
|
||||||
$fgroup->fetch($id);
|
$fgroup->fetch($id);
|
||||||
@ -56,7 +54,7 @@ $fgroup->getrights();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET["action"] == 'dolibarr2ldap')
|
if ($action == 'dolibarr2ldap')
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
|
|
||||||
@ -84,8 +82,6 @@ if ($_GET["action"] == 'dolibarr2ldap')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -208,10 +204,8 @@ else
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user