Fix: Debuggage et corrections diverses sur la gestion des groupes

Trad: Traduction de la gestion des groupes
This commit is contained in:
Laurent Destailleur 2005-01-28 20:35:01 +00:00
parent 9a04f5ed37
commit 4782a11086
7 changed files with 139 additions and 64 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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

View File

@ -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='<div class="error">'.$langs->trans("LoginAlreadyExists",$edituser->login).'</div>';
$message='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'</div>';
$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 "<br>".$message."<br>"; }
print "<br>";
if ($message) { print $message."<br>"; }
print '<form action="fiche.php" method="post">';
print '<input type="hidden" name="action" value="add">';
@ -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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>&nbsp</td><td>'.$langs->trans("OwnedRights").'</td><td>'.$langs->trans("Module").'</td></tr>';
$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 '</table>';
print '</td></tr>';
}
@ -328,8 +341,8 @@ else
print '<table class="border" width="100%">';
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
print '<td colspan="2" width="50%" class="valeur">'.$fuser->nom.'</td>';
print '<td align="center" valign="middle" width="50%" rowspan="8">';
print '<td width="50%" class="valeur">'.$fuser->nom.'</td>';
print '<td align="center" valign="middle" width="25%" rowspan="8">';
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
{
print '<img src="'.DOL_URL_ROOT.'/image.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
@ -340,26 +353,26 @@ else
print '</td></tr>';
print '<tr><td width="25%" valign="top">'.$langs->trans("Firstname").'</td>';
print '<td colspan="2" width="50%" class="valeur">'.$fuser->prenom.'</td>';
print '<td width="50%" class="valeur">'.$fuser->prenom.'</td>';
print "</tr>\n";
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
print '<td colspan="2" width="50%" class="valeur">'.$fuser->login.'</td></tr>';
print '<td width="50%" class="valeur">'.$fuser->login.'</td></tr>';
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>';
print '<td colspan="2" width="50%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
print '<td width="50%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
print "</tr>\n";
print '<tr><td width="25%" valign="top">'.$langs->trans("Administrator").'</td>';
print '<td colspan="2" class="valeur">'.yn($fuser->admin).'</td>';
print '<td class="valeur">'.yn($fuser->admin).'</td>';
print "</tr>\n";
print '<tr><td width="25%" valign="top">'.$langs->trans("DateCreation").'</td>';
print '<td colspan="2" class="valeur">'.dolibarr_print_date($fuser->datec).'</td>';
print '<td class="valeur">'.dolibarr_print_date($fuser->datec).'</td>';
print "</tr>\n";
print '<tr><td width="25%" valign="top">'.$langs->trans("DateModification").'</td>';
print '<td colspan="2" class="valeur">'.dolibarr_print_date($fuser->datem).'</td>';
print '<td class="valeur">'.dolibarr_print_date($fuser->datem).'</td>';
print "</tr>\n";
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("ContactCard").'</td>';
@ -375,18 +388,17 @@ else
print '</td>';
print "</tr>\n";
if ($fuser->societe_id > 0)
{
$societe = new Societe($db);
$societe->fetch($fuser->societe_id);
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Company").'</td>';
print '<td colspan="3">'.$societe->nom.'&nbsp;</td>';
print '<td colspan="2">'.$societe->nom.'&nbsp;</td>';
print "</tr>\n";
}
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Note").'</td>';
print '<td colspan="3" class="valeur">'.nl2br($fuser->note).'&nbsp;</td>';
print '<td colspan="2" class="valeur">'.nl2br($fuser->note).'&nbsp;</td>';
print "</tr>\n";
// Autres caractéristiques issus des autres modules
@ -394,7 +406,7 @@ else
{
$langs->load("other");
print '<tr><td width="25%" valign="top">'.$langs->trans("LoginWebcal").'</td>';
print '<td colspan="3">'.$fuser->webcal_login.'&nbsp;</td>';
print '<td colspan="2">'.$fuser->webcal_login.'&nbsp;</td>';
print "</tr>\n";
}
@ -435,12 +447,22 @@ else
*/
if ($_GET["action"] == 'edit' && $user->admin)
{
print '<form action="fiche.php?id='.$fuser->id.'" method="post">';
print '<form action="fiche.php?id='.$fuser->id.'" method="post">';
print '<input type="hidden" name="action" value="update">';
print '<table width="100%" class="border">';
print "<tr>".'<td valign="top">'.$langs->trans("Lastname").'</td>';
print '<td><input size="30" type="text" name="nom" value="'.$fuser->nom.'"></td></tr>';
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
print '<td width="50%" class="valeur"><input size="30" type="text" name="nom" value="'.$fuser->nom.'"></td>';
print '<td align="center" valign="middle" width="25%" rowspan="6">';
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg"))
{
print '<img src="'.DOL_URL_ROOT.'/image.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
}
else {
print '<img src="'.DOL_URL_ROOT.'/theme/nophoto.jpg">';
}
print '</td></tr>';
print "<tr>".'<td valign="top">'.$langs->trans("Firstname").'</td>';
print '<td><input size="30" type="text" name="prenom" value="'.$fuser->prenom.'"></td></tr>';
@ -473,12 +495,14 @@ else
// Autres caractéristiques issus des autres modules
$langs->load("other");
print "<tr>".'<td valign="top">'.$langs->trans("LoginWebcal").'</td>';
print '<td class="valeur"><input size="30" type="text" name="webcal_login" value="'.$fuser->webcal_login.'"></td></tr>';
print '<td class="valeur" colspan="2"><input size="30" type="text" name="webcal_login" value="'.$fuser->webcal_login.'"></td></tr>';
print "<tr>".'<td align="center" colspan="2"><input value="'.$langs->trans("Save").'" type="submit"></td></tr>';
print '<tr><td align="center" colspan="3"><input value="'.$langs->trans("Save").'" type="submit"></td></tr>';
print '</table><br>';
print '</form>';
}
}

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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='<div class="error">'.$langs->trans("LoginAlreadyExists",$edituser->login).'</div>';
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$editgroup->nom).'</div>';
$action="create"; // Go back to create page
}
}
@ -97,8 +98,9 @@ llxHeader();
if ($action == 'create')
{
print_titre($langs->trans("NewGroup"));
print "<br>";
if ($message) { print "<br>".$message."<br>"; }
if ($message) { print $message."<br>"; }
print '<form action="fiche.php" method="post">';
print '<input type="hidden" name="action" value="add">';
@ -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 '<form action="fiche.php?id='.$group->id.'" method="post">'."\n";
print '<input type="hidden" name="action" value="adduser">';
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td>Ajouter</td>'."\n";
print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Users").'</td>'."\n";
print '<td>';
print $form->select_array("user",$uss);
print '</td><td>';
print '<input type="submit">';
print '</td><td align="left">';
print '<input type="submit" class=button value="'.$langs->trans("Add").'">';
print '</td></tr>'."\n";
print '</table></form>'."\n";
}
@ -222,10 +230,10 @@ else
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("LastName").'</td>';
print '<td>'.$langs->trans("FirstName").'</td>';
print '<td width="25%">'.$langs->trans("LastName").'</td>';
print '<td width="25%">'.$langs->trans("FirstName").'</td>';
print '<td>'.$langs->trans("Code").'</td>';
print "<td>-</td></tr>\n";
print "<td>&nbsp;</td></tr>\n";
$var=True;
while ($i < $num)
{
@ -241,7 +249,7 @@ else
{
print '<a href="fiche.php?id='.$group->id.'&amp;action=removeuser&amp;user='.$obj->rowid.'">';
print img_delete();
print img_delete($langs->trans("RemoveFromGroup"));
}
else
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LastName"),"index.php","name","","","",$sortfield);
print_liste_field_titre($langs->trans("LastName"),"index.php","g.nom","","","",$sortfield);
print "</tr>\n";
$var=True;
while ($i < $num)

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2002,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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?&amp;action=create",$langs->trans("NewUser"));
$menu->add_submenu(DOL_URL_ROOT."/user/fiche.php?&amp;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)
{

View File

@ -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?&amp;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?&amp;action=create","Nouveau groupe");
$menu->add_submenu(DOL_URL_ROOT."/user/group/fiche.php?&amp;action=create", $langs->trans("NewGroup"));
}