Skip to content

Commit

Permalink
Fix: uniform code
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Jan 13, 2012
1 parent d5131b0 commit 94ea9f3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
8 changes: 3 additions & 5 deletions htdocs/user/class/user.class.php
Expand Up @@ -95,20 +95,18 @@ 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;
$this->clicktodial_loaded = 0;

$this->all_permissions_are_loaded = 0;
$this->admin=0;

return 1;
}

/**
Expand Down
27 changes: 13 additions & 14 deletions htdocs/user/group/fiche.php
Expand Up @@ -43,10 +43,10 @@
$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');
Expand All @@ -66,7 +66,7 @@
{
if ($caneditperms)
{
$object->fetch($_GET["id"]);
$object->fetch($id);
$object->delete();
Header("Location: index.php");
exit;
Expand Down Expand Up @@ -95,11 +95,10 @@
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();

Expand Down Expand Up @@ -176,11 +175,10 @@
$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();

Expand Down Expand Up @@ -507,5 +505,6 @@

llxFooter();

if (is_object($db)) $db->close();
$db->close();

?>
14 changes: 4 additions & 10 deletions htdocs/user/group/ldap.php
Expand Up @@ -40,12 +40,10 @@
}

$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);
Expand All @@ -56,7 +54,7 @@
* Actions
*/

if ($_GET["action"] == 'dolibarr2ldap')
if ($action == 'dolibarr2ldap')
{
$message="";

Expand Down Expand Up @@ -84,8 +82,6 @@
}




/*
* View
*/
Expand Down Expand Up @@ -208,10 +204,8 @@

print '</table>';



llxFooter();

$db->close();

llxFooter();
?>

0 comments on commit 94ea9f3

Please sign in to comment.