From 4782a11086d0b57ec1d3b131e5a193f08d44a4db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Jan 2005 20:35:01 +0000 Subject: [PATCH] Fix: Debuggage et corrections diverses sur la gestion des groupes Trad: Traduction de la gestion des groupes --- htdocs/user/addon.php | 15 +++++--- htdocs/user/clicktodial.php | 23 +++++++---- htdocs/user/fiche.php | 72 +++++++++++++++++++++++------------ htdocs/user/group/fiche.php | 36 +++++++++++------- htdocs/user/group/index.php | 32 ++++++++++++++-- htdocs/user/group/pre.inc.php | 15 ++++++-- htdocs/user/pre.inc.php | 10 ++--- 7 files changed, 139 insertions(+), 64 deletions(-) diff --git a/htdocs/user/addon.php b/htdocs/user/addon.php index 4041277bb89..7bc0319da5e 100644 --- a/htdocs/user/addon.php +++ b/htdocs/user/addon.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur * * 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 @@ -20,7 +20,7 @@ * $Source$ */ -/*! +/** \file htdocs/user/addon.php \brief Onglet addon de la fiche utilisateur \version $Revision$ @@ -82,19 +82,22 @@ if ($_GET["id"]) $h++; } + if ($conf->bookmark4u->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Addons"); + $head[$h][1] = $langs->trans("Bookmark4u"); $hselected=$h; $h++; + } - if (defined("MAIN_MODULE_CLICKTODIAL") && MAIN_MODULE_CLICKTODIAL==1) + if ($conf->clicktodial->enabled) { $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; $head[$h][1] = $langs->trans("ClickToDial"); $h++; } - dolibarr_fiche_head($head, $hselected, $fuser->fullname); + dolibarr_fiche_head($head, $hselected, $langs->trans("User")." : ".$fuser->fullname); /* * Fiche en mode visu diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 1dea1108947..ca097cfe07b 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005 Laurent Destailleur * * 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 @@ -19,7 +20,7 @@ * $Source$ */ -/*! +/** \file htdocs/user/clicktodial.php \brief Gestion des infos de click to dial \version $Revision$ @@ -82,16 +83,22 @@ if ($_GET["id"]) $h++; } + if ($conf->bookmark4u->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Addons"); + $head[$h][1] = $langs->trans("Bookmark4u"); $h++; + } - $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("ClickToDial"); - $hselected=$h; - $h++; - - dolibarr_fiche_head($head, $hselected, $fuser->fullname); + if ($conf->clicktodial->enabled) + { + $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("ClickToDial"); + $hselected=$h; + $h++; + } + + dolibarr_fiche_head($head, $hselected, $langs->trans("User")." : ".$fuser->fullname); /* * Fiche en mode visu diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index ab8e1db1eba..e33c3b7ae30 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -38,6 +38,9 @@ $form = new Form($db); $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; +/** + * Actions + */ if ($_GET["subaction"] == 'addrights' && $user->admin) { $edituser = new User($db,$_GET["id"]); @@ -97,7 +100,7 @@ if ($_POST["action"] == 'add' && $user->admin) Header("Location: fiche.php?id=$id"); } else { - $message='
'.$langs->trans("LoginAlreadyExists",$edituser->login).'
'; + $message='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; $action="create"; // Go back to create page } } @@ -133,7 +136,7 @@ if ($_GET["action"] == 'password' && $user->admin) if ($edituser->password('',$conf->password_encrypted)) { - $message = "Mot de passe changé et envoyé à $edituser->email"; + $message = $langs->trans("PasswordChangedAndSentTo",$edituser->email); } } @@ -152,7 +155,8 @@ if ($action == 'create') print_titre($langs->trans("NewUser")); - if ($message) { print "
".$message."
"; } + print "
"; + if ($message) { print $message."
"; } print '
'; print ''; @@ -228,11 +232,14 @@ else $h++; } + if ($conf->bookmark4u->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id; - $head[$h][1] = $langs->trans("Addons"); + $head[$h][1] = $langs->trans("Bookmark4u"); $h++; - - dolibarr_fiche_head($head, $hselected, $fuser->fullname); + } + + dolibarr_fiche_head($head, $hselected, $langs->trans("User")." : ".$fuser->fullname); /* @@ -291,10 +298,13 @@ else // Droits possédés print ''; print ''; + $sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur"; $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.module, r.id ASC"; $var = True; - if ($db->query($sql)) + $result=$db->query($sql); + + if ($result) { $num = $db->num_rows(); $i = 0; @@ -314,6 +324,9 @@ else $i++; } } + else { + dolibarr_print_error($db); + } print '
 '.$langs->trans("OwnedRights").''.$langs->trans("Module").'
'; print ''; } @@ -328,8 +341,8 @@ else print ''; print ''; - print ''; - print ''; + print ''; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print "\n"; print ''; - print ''; + print ''; print "\n"; print "".''; @@ -375,18 +388,17 @@ else print ''; print "\n"; - if ($fuser->societe_id > 0) { $societe = new Societe($db); $societe->fetch($fuser->societe_id); print "".''; - print ''; + print ''; print "\n"; } print "".''; - print ''; + print ''; print "\n"; // Autres caractéristiques issus des autres modules @@ -394,7 +406,7 @@ else { $langs->load("other"); print ''; - print ''; + print ''; print "\n"; } @@ -435,12 +447,22 @@ else */ if ($_GET["action"] == 'edit' && $user->admin) { - print ''; + + print ''; print ''; print '
'.$langs->trans("Lastname").''.$fuser->nom.''; + print ''.$fuser->nom.''; if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) { print ''; @@ -340,26 +353,26 @@ else print '
'.$langs->trans("Firstname").''.$fuser->prenom.''.$fuser->prenom.'
'.$langs->trans("Login").''.$fuser->login.'
'.$fuser->login.'
'.$langs->trans("EMail").''.$fuser->email.''.$fuser->email.'
'.$langs->trans("Administrator").''.yn($fuser->admin).''.yn($fuser->admin).'
'.$langs->trans("DateCreation").''.dolibarr_print_date($fuser->datec).''.dolibarr_print_date($fuser->datec).'
'.$langs->trans("DateModification").''.dolibarr_print_date($fuser->datem).''.dolibarr_print_date($fuser->datem).'
'.$langs->trans("ContactCard").'
'.$langs->trans("Company").''.$societe->nom.' '.$societe->nom.' 
'.$langs->trans("Note").''.nl2br($fuser->note).' '.nl2br($fuser->note).' 
'.$langs->trans("LoginWebcal").''.$fuser->webcal_login.' '.$fuser->webcal_login.' 
'; - print "".''; - print ''; + print ''; + print ''; + print ''; print "".''; print ''; @@ -473,12 +495,14 @@ else // Autres caractéristiques issus des autres modules $langs->load("other"); print "".''; - print ''; + print ''; - print "".''; + print ''; print '
'.$langs->trans("Lastname").'
'.$langs->trans("Lastname").''; + if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) + { + print ''; + } + else { + print ''; + } + print '
'.$langs->trans("Firstname").'
'.$langs->trans("LoginWebcal").'

'; print '
'; + + } } diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index 2703970e231..1754eac9f4c 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005 Laurent Destailleur * * 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 @@ -20,8 +21,8 @@ */ /** - \file htdocs/user/fiche.php - \brief Onglet user et permissions de la fiche utilisateur + \file htdocs/user/group/fiche.php + \brief Onglet groupes utilisateurs \version $Revision$ */ @@ -57,7 +58,7 @@ if ($_POST["action"] == 'add' && $user->admin) } else { - $message='
'.$langs->trans("LoginAlreadyExists",$edituser->login).'
'; + $message='
'.$langs->trans("ErrorGroupAlreadyExists",$editgroup->nom).'
'; $action="create"; // Go back to create page } } @@ -97,8 +98,9 @@ llxHeader(); if ($action == 'create') { print_titre($langs->trans("NewGroup")); + print "
"; - if ($message) { print "
".$message."
"; } + if ($message) { print $message."
"; } print '
'; print ''; @@ -140,7 +142,7 @@ else $hselected=$h; $h++; - dolibarr_fiche_head($head, $hselected, $group->nom); + dolibarr_fiche_head($head, $hselected, $langs->trans("Group")." : ".$group->nom); /* * Confirmation suppression @@ -148,7 +150,7 @@ else if ($action == 'delete') { $html = new Form($db); - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_delete"); + $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAGroup"),$langs->trans("ConfirmDisableGroup",$fuser->login),"confirm_delete"); } @@ -168,8 +170,11 @@ else $uss = array(); + // On sélectionne les user qui ne sont pas déjà dans le groupe $sql = "SELECT u.rowid, u.name, u.firstname, u.code "; - $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql .= " FROM ".MAIN_DB_PREFIX."user as u "; + $sql .= " LEFT JOIN llx_usergroup_user ug ON u.rowid = ug.fk_user"; + $sql .= " WHERE ug.fk_usergroup IS NULL"; $sql .= " ORDER BY u.name"; $result = $db->query($sql); @@ -186,6 +191,9 @@ else $i++; } } + else { + dolibarr_print_error($db); + } if ($user->admin) { @@ -193,11 +201,11 @@ else print ''."\n"; print ''; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print '
Ajouter
'.$langs->trans("Users").''; print $form->select_array("user",$uss); - print ''; - print ''; + print ''; + print ''; print '
'."\n"; } @@ -222,10 +230,10 @@ else print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - print "\n"; + print "\n"; $var=True; while ($i < $num) { @@ -241,7 +249,7 @@ else { print ''; - print img_delete(); + print img_delete($langs->trans("RemoveFromGroup")); } else { diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index 59f88bce013..77c4ec27c68 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * * 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 @@ -21,7 +21,7 @@ * */ -/*! +/** \file htdocs/user/index.php \brief Page d'accueil de la gestion des utilisateurs \version $Revision$ @@ -31,13 +31,37 @@ require("./pre.inc.php"); $langs->load("users"); +$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; +$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +$page = $_GET["page"]; +if ($page < 0) { + $page = 0 ; } + +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +if ($sortfield == "") { + $sortfield="g.nom"; } + +if ($sortorder == "") +{ + $sortorder="ASC"; +} + + + llxHeader(); print_titre($langs->trans("ListOfGroups")); $sql = "SELECT g.rowid, g.nom"; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; -$sql .= " ORDER BY g.nom ASC"; +if ($sortfield) { + $sql .= " ORDER BY ".$sortfield; +} +if ($sortorder) { + $sql .= " ".$sortorder; +} $result = $db->query($sql); if ($result) @@ -49,7 +73,7 @@ if ($result) print "
'.$langs->trans("LastName").''.$langs->trans("FirstName").''.$langs->trans("LastName").''.$langs->trans("FirstName").''.$langs->trans("Code").'-
 
"; print ''; - print_liste_field_titre($langs->trans("LastName"),"index.php","name","","","",$sortfield); + print_liste_field_titre($langs->trans("LastName"),"index.php","g.nom","","","",$sortfield); print "\n"; $var=True; while ($i < $num) diff --git a/htdocs/user/group/pre.inc.php b/htdocs/user/group/pre.inc.php index 5ba5db19a81..ccd9ad6d828 100644 --- a/htdocs/user/group/pre.inc.php +++ b/htdocs/user/group/pre.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005 Laurent Destailleur * * 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 @@ -18,6 +19,13 @@ * $Id$ * $Source$ */ + +/** + \file htdocs/compta/pre.inc.php + \brief Fichier gestionnaire du menu groupe d'utilisateur + \version $Revision$ +*/ + require("../../main.inc.php"); require(DOL_DOCUMENT_ROOT.'/usergroup.class.php'); @@ -25,6 +33,7 @@ require(DOL_DOCUMENT_ROOT.'/usergroup.class.php'); function llxHeader($head = "", $urlp = "") { global $user, $langs; + /* * * @@ -33,14 +42,14 @@ function llxHeader($head = "", $urlp = "") $menu = new Menu(); - $menu->add(DOL_URL_ROOT."/user/", "Utilisateurs"); + $menu->add(DOL_URL_ROOT."/user/", $langs->trans("Users")); if($user->admin) { - $menu->add_submenu("fiche.php?&action=create",$langs->trans("NewUser")); + $menu->add_submenu(DOL_URL_ROOT."/user/fiche.php?&action=create",$langs->trans("NewUser")); } - $menu->add(DOL_URL_ROOT."/user/group/", "Groupes"); + $menu->add(DOL_URL_ROOT."/user/group/", $langs->trans("Groups")); if($user->admin) { diff --git a/htdocs/user/pre.inc.php b/htdocs/user/pre.inc.php index 078d76f408d..c6ea44166df 100644 --- a/htdocs/user/pre.inc.php +++ b/htdocs/user/pre.inc.php @@ -21,9 +21,9 @@ */ /** - \file htdocs/user/pre.inc.php - \brief Gestionnaire menu fichier users - \version $Revision$ + \file htdocs/user/pre.inc.php + \brief Gestionnaire menu fichier users + \version $Revision$ */ require("../main.inc.php"); @@ -47,11 +47,11 @@ function llxHeader($head = "", $urlp = "") $menu->add_submenu(DOL_URL_ROOT."/user/fiche.php?&action=create", $langs->trans("NewUser")); } - $menu->add(DOL_URL_ROOT."/user/group/", "Groupes"); + $menu->add(DOL_URL_ROOT."/user/group/", $langs->trans("Groups")); if($user->admin) { - $menu->add_submenu(DOL_URL_ROOT."/user/group/fiche.php?&action=create","Nouveau groupe"); + $menu->add_submenu(DOL_URL_ROOT."/user/group/fiche.php?&action=create", $langs->trans("NewGroup")); }