2005-01-27 16:55:40 +01:00
|
|
|
<?php
|
2006-05-30 23:42:38 +02:00
|
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2011-08-24 00:10:25 +02:00
|
|
|
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2011-08-19 09:22:17 +02:00
|
|
|
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
2013-08-21 18:47:51 +02:00
|
|
|
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
2005-01-27 16:55:40 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2005-01-27 16:55:40 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2011-08-01 01:19:04 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-01-27 16:55:40 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2008-11-20 23:00:17 +01:00
|
|
|
* \file htdocs/user/group/fiche.php
|
|
|
|
|
* \brief Onglet groupes utilisateurs
|
|
|
|
|
*/
|
2005-01-27 16:55:40 +01:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
2012-08-23 02:04:35 +02:00
|
|
|
if(! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
2005-01-27 16:55:40 +01:00
|
|
|
|
2006-05-30 23:42:38 +02:00
|
|
|
// Defini si peux lire/modifier utilisateurs et permisssions
|
|
|
|
|
$canreadperms=($user->admin || $user->rights->user->user->lire);
|
|
|
|
|
$caneditperms=($user->admin || $user->rights->user->user->creer);
|
|
|
|
|
$candisableperms=($user->admin || $user->rights->user->user->supprimer);
|
2010-11-08 12:40:52 +01:00
|
|
|
// Advanced permissions
|
|
|
|
|
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
|
|
|
|
{
|
2011-07-08 20:49:16 +02:00
|
|
|
$canreadperms=($user->admin || $user->rights->user->group_advance->read);
|
|
|
|
|
$caneditperms=($user->admin || $user->rights->user->group_advance->write);
|
|
|
|
|
$candisableperms=($user->admin || $user->rights->user->group_advance->delete);
|
2010-11-08 12:40:52 +01:00
|
|
|
}
|
2006-05-30 23:42:38 +02:00
|
|
|
|
2005-01-27 16:55:40 +01:00
|
|
|
$langs->load("users");
|
2006-12-17 21:47:49 +01:00
|
|
|
$langs->load("other");
|
2005-01-27 16:55:40 +01:00
|
|
|
|
2012-01-13 18:24:25 +01:00
|
|
|
$id=GETPOST('id', 'int');
|
|
|
|
|
$action=GETPOST('action', 'alpha');
|
|
|
|
|
$confirm=GETPOST('confirm', 'alpha');
|
|
|
|
|
$userid=GETPOST('user', 'int');
|
2012-07-10 13:20:53 +02:00
|
|
|
$message='';
|
2011-08-21 02:20:43 +02:00
|
|
|
|
2009-04-27 22:37:50 +02:00
|
|
|
// Security check
|
2012-01-11 15:07:17 +01:00
|
|
|
$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user');
|
2009-04-27 22:37:50 +02:00
|
|
|
|
2012-07-07 10:57:54 +02:00
|
|
|
if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multicompany->transverse_mode)
|
2011-08-19 09:22:17 +02:00
|
|
|
{
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-07 17:45:01 +02:00
|
|
|
$object = new Usergroup($db);
|
|
|
|
|
|
2005-01-31 16:28:22 +01:00
|
|
|
|
2005-01-27 16:55:40 +01:00
|
|
|
/**
|
2010-01-16 20:56:05 +01:00
|
|
|
* Action remove group
|
2005-02-26 15:23:54 +01:00
|
|
|
*/
|
2010-11-08 12:40:52 +01:00
|
|
|
if ($action == 'confirm_delete' && $confirm == "yes")
|
2005-02-26 15:23:54 +01:00
|
|
|
{
|
2011-07-08 20:49:16 +02:00
|
|
|
if ($caneditperms)
|
|
|
|
|
{
|
2012-01-13 18:24:25 +01:00
|
|
|
$object->fetch($id);
|
2011-07-08 20:49:16 +02:00
|
|
|
$object->delete();
|
2012-08-31 05:58:38 +02:00
|
|
|
header("Location: index.php");
|
2011-07-08 20:49:16 +02:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-29 23:52:05 +02:00
|
|
|
$langs->load("errors");
|
2011-07-08 20:49:16 +02:00
|
|
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
|
|
|
|
}
|
2005-02-26 15:23:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2010-01-16 20:56:05 +01:00
|
|
|
* Action add group
|
2005-01-27 16:55:40 +01:00
|
|
|
*/
|
2011-08-21 02:20:43 +02:00
|
|
|
if ($action == 'add')
|
2005-01-27 16:55:40 +01:00
|
|
|
{
|
2012-07-07 10:57:54 +02:00
|
|
|
if ($caneditperms)
|
2011-07-08 20:49:16 +02:00
|
|
|
{
|
|
|
|
|
if (! $_POST["nom"])
|
|
|
|
|
{
|
|
|
|
|
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
|
|
|
|
$action="create"; // Go back to create page
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-19 09:22:17 +02:00
|
|
|
if (! $message)
|
|
|
|
|
{
|
2011-08-20 00:15:22 +02:00
|
|
|
$object->nom = trim($_POST["nom"]);
|
|
|
|
|
$object->note = trim($_POST["note"]);
|
2012-07-07 10:57:54 +02:00
|
|
|
|
2012-09-15 11:21:22 +02:00
|
|
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
2012-01-13 18:24:25 +01:00
|
|
|
else $object->entity = $_POST["entity"];
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
$db->begin();
|
|
|
|
|
|
|
|
|
|
$id = $object->create();
|
|
|
|
|
|
|
|
|
|
if ($id > 0)
|
|
|
|
|
{
|
|
|
|
|
$db->commit();
|
|
|
|
|
|
2012-08-31 05:58:38 +02:00
|
|
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
2011-07-08 20:49:16 +02:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$db->rollback();
|
|
|
|
|
|
|
|
|
|
$langs->load("errors");
|
|
|
|
|
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$object->nom).'</div>';
|
|
|
|
|
$action="create"; // Go back to create page
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-29 23:52:05 +02:00
|
|
|
$langs->load("errors");
|
2011-07-08 20:49:16 +02:00
|
|
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
|
|
|
|
}
|
2005-01-27 16:55:40 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-28 13:50:51 +02:00
|
|
|
// Add/Remove user into group
|
|
|
|
|
if ($action == 'adduser' || $action =='removeuser')
|
2005-01-27 16:55:40 +01:00
|
|
|
{
|
2011-07-08 20:49:16 +02:00
|
|
|
if ($caneditperms)
|
|
|
|
|
{
|
|
|
|
|
if ($userid)
|
|
|
|
|
{
|
2011-08-21 02:20:43 +02:00
|
|
|
$object->fetch($id);
|
2011-07-08 20:49:16 +02:00
|
|
|
$object->oldcopy=dol_clone($object);
|
|
|
|
|
|
2011-08-19 09:22:17 +02:00
|
|
|
$edituser = new User($db);
|
|
|
|
|
$edituser->fetch($userid);
|
2012-07-10 13:20:53 +02:00
|
|
|
if ($action == 'adduser') $result=$edituser->SetInGroup($object->id,(! empty($conf->multicompany->transverse_mode)?GETPOST('entity','int'):$object->entity));
|
|
|
|
|
if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id,(! empty($conf->multicompany->transverse_mode)?GETPOST('entity','int'):$object->entity));
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
if ($result > 0)
|
|
|
|
|
{
|
2012-07-07 10:57:54 +02:00
|
|
|
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
2011-07-08 20:49:16 +02:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$message.=$edituser->error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-29 23:52:05 +02:00
|
|
|
$langs->load("errors");
|
2011-07-08 20:49:16 +02:00
|
|
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
|
|
|
|
}
|
2005-01-27 16:55:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-08-21 02:20:43 +02:00
|
|
|
if ($action == 'update')
|
2005-02-27 15:12:16 +01:00
|
|
|
{
|
2012-07-07 10:57:54 +02:00
|
|
|
if ($caneditperms)
|
2011-07-08 20:49:16 +02:00
|
|
|
{
|
|
|
|
|
$db->begin();
|
|
|
|
|
|
2011-08-21 02:20:43 +02:00
|
|
|
$object->fetch($id);
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
$object->oldcopy=dol_clone($object);
|
|
|
|
|
|
2011-08-20 00:15:22 +02:00
|
|
|
$object->nom = trim($_POST["group"]);
|
|
|
|
|
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
2012-07-07 10:57:54 +02:00
|
|
|
|
2012-07-10 13:20:53 +02:00
|
|
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
2012-01-13 18:24:25 +01:00
|
|
|
else $object->entity = $_POST["entity"];
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
$ret=$object->update();
|
|
|
|
|
|
|
|
|
|
if ($ret >= 0 && ! count($object->errors))
|
|
|
|
|
{
|
|
|
|
|
$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
|
|
|
|
|
$db->commit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$message.='<div class="error">'.$object->error.'</div>';
|
|
|
|
|
$db->rollback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-29 23:52:05 +02:00
|
|
|
$langs->load("errors");
|
2011-07-08 20:49:16 +02:00
|
|
|
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
|
|
|
|
}
|
2005-02-27 15:12:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-08-12 01:42:21 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2005-02-27 15:12:16 +01:00
|
|
|
llxHeader('',$langs->trans("GroupCard"));
|
2005-01-27 16:55:40 +01:00
|
|
|
|
2011-06-07 17:45:01 +02:00
|
|
|
$form = new Form($db);
|
2011-04-06 21:54:06 +02:00
|
|
|
$fuserstatic = new User($db);
|
2005-01-27 16:55:40 +01:00
|
|
|
|
|
|
|
|
if ($action == 'create')
|
|
|
|
|
{
|
2011-07-08 20:49:16 +02:00
|
|
|
print_fiche_titre($langs->trans("NewGroup"));
|
|
|
|
|
|
|
|
|
|
if ($message) { print $message."<br>"; }
|
|
|
|
|
|
2013-02-18 15:01:00 +01:00
|
|
|
print dol_set_focus('#nom');
|
|
|
|
|
|
2011-07-08 20:49:16 +02:00
|
|
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
|
|
print '<input type="hidden" name="action" value="add">';
|
|
|
|
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
2011-08-19 09:22:17 +02:00
|
|
|
print "<tr>".'<td valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
|
2013-02-18 15:01:00 +01:00
|
|
|
print '<td class="valeur"><input size="30" type="text" id="nom" name="nom" value=""></td></tr>';
|
2011-08-24 00:10:25 +02:00
|
|
|
|
2011-08-19 09:22:17 +02:00
|
|
|
// Multicompany
|
2011-08-21 12:01:36 +02:00
|
|
|
if (! empty($conf->multicompany->enabled))
|
2011-08-19 09:22:17 +02:00
|
|
|
{
|
2011-11-04 09:09:53 +01:00
|
|
|
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
2011-08-20 00:15:22 +02:00
|
|
|
{
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
|
|
|
|
|
print "<td>".$mc->select_entities($conf->entity);
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
|
|
|
|
}
|
2011-08-19 09:22:17 +02:00
|
|
|
}
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
2011-11-05 23:18:49 +01:00
|
|
|
$doleditor=new DolEditor('note','','',240,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_8,90);
|
|
|
|
|
$doleditor->Create();
|
|
|
|
|
print "</td></tr>\n";
|
2011-07-08 20:49:16 +02:00
|
|
|
print "</table>\n";
|
2011-10-10 00:03:26 +02:00
|
|
|
|
|
|
|
|
print '<center><br><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></center>';
|
|
|
|
|
|
2011-07-08 20:49:16 +02:00
|
|
|
print "</form>";
|
2005-01-27 16:55:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
/* */
|
|
|
|
|
/* Visu et edition */
|
|
|
|
|
/* */
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-08-21 02:20:43 +02:00
|
|
|
if ($id)
|
2011-07-08 20:49:16 +02:00
|
|
|
{
|
2011-08-21 02:20:43 +02:00
|
|
|
$object->fetch($id);
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Affichage onglets
|
|
|
|
|
*/
|
|
|
|
|
$head = group_prepare_head($object);
|
|
|
|
|
$title = $langs->trans("Group");
|
|
|
|
|
dol_fiche_head($head, 'group', $title, 0, 'group');
|
|
|
|
|
|
2011-08-19 09:22:17 +02:00
|
|
|
/*
|
|
|
|
|
* Confirmation suppression
|
|
|
|
|
*/
|
|
|
|
|
if ($action == 'delete')
|
|
|
|
|
{
|
2013-09-06 11:51:24 +02:00
|
|
|
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1);
|
2011-08-19 09:22:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Fiche en mode visu
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if ($action != 'edit')
|
|
|
|
|
{
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
|
|
|
|
// Ref
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
|
|
|
|
print '<td colspan="2">';
|
|
|
|
|
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Name
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
2013-08-21 18:47:51 +02:00
|
|
|
print '<td width="75%" class="valeur">'.$object->name;
|
2011-08-19 09:22:17 +02:00
|
|
|
if (empty($object->entity))
|
|
|
|
|
{
|
2011-09-22 12:55:37 +02:00
|
|
|
print img_picto($langs->trans("GlobalGroup"),'redstar');
|
2011-08-19 09:22:17 +02:00
|
|
|
}
|
|
|
|
|
print "</td></tr>\n";
|
2011-08-24 00:10:25 +02:00
|
|
|
|
2011-08-20 00:15:22 +02:00
|
|
|
// Multicompany
|
2011-11-04 09:09:53 +01:00
|
|
|
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
2011-08-20 00:15:22 +02:00
|
|
|
{
|
|
|
|
|
$mc->getInfo($object->entity);
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
|
|
|
|
|
print '<td width="75%" class="valeur">'.$mc->label;
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
}
|
2011-08-19 09:22:17 +02:00
|
|
|
|
|
|
|
|
// Note
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
|
|
|
|
print '<td class="valeur">'.dol_htmlentitiesbr($object->note).' </td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
print "</table>\n";
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Barre d'actions
|
|
|
|
|
*/
|
|
|
|
|
print '<div class="tabsAction">';
|
|
|
|
|
|
|
|
|
|
if ($caneditperms)
|
|
|
|
|
{
|
|
|
|
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($candisableperms)
|
|
|
|
|
{
|
|
|
|
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans("DeleteGroup").'</a>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</div>\n";
|
|
|
|
|
print "<br>\n";
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
|
2011-11-05 23:18:49 +01:00
|
|
|
dol_htmloutput_mesg($message);
|
2007-05-16 14:03:55 +02:00
|
|
|
|
2009-05-04 20:13:07 +02:00
|
|
|
/*
|
|
|
|
|
* Liste des utilisateurs dans le groupe
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
print_fiche_titre($langs->trans("ListOfUsersInGroup"),'','');
|
|
|
|
|
|
2011-06-07 17:45:01 +02:00
|
|
|
// On selectionne les users qui ne sont pas deja dans le groupe
|
|
|
|
|
$exclude = array();
|
2011-08-24 00:10:25 +02:00
|
|
|
|
2012-08-01 12:58:19 +02:00
|
|
|
if (! empty($object->members))
|
2009-05-04 20:13:07 +02:00
|
|
|
{
|
2012-08-01 13:32:50 +02:00
|
|
|
if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)))
|
2012-08-01 12:58:19 +02:00
|
|
|
{
|
|
|
|
|
foreach($object->members as $useringroup)
|
|
|
|
|
{
|
|
|
|
|
$exclude[]=$useringroup->id;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-04 20:13:07 +02:00
|
|
|
}
|
2011-07-08 20:49:16 +02:00
|
|
|
|
2009-05-04 20:13:07 +02:00
|
|
|
if ($caneditperms)
|
|
|
|
|
{
|
2011-06-07 17:45:01 +02:00
|
|
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
|
2009-05-17 10:01:54 +02:00
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2009-05-04 20:13:07 +02:00
|
|
|
print '<input type="hidden" name="action" value="adduser">';
|
|
|
|
|
print '<table class="noborder" width="100%">'."\n";
|
|
|
|
|
print '<tr class="liste_titre"><td class="liste_titre" width="25%">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
|
|
|
|
|
print '<td>';
|
2011-08-21 02:20:43 +02:00
|
|
|
print $form->select_dolusers('','user',1,$exclude,0,'','',$object->entity);
|
2009-05-04 20:13:07 +02:00
|
|
|
print ' ';
|
2011-08-19 09:22:17 +02:00
|
|
|
// Multicompany
|
2011-08-21 12:01:36 +02:00
|
|
|
if (! empty($conf->multicompany->enabled))
|
2011-08-19 09:22:17 +02:00
|
|
|
{
|
2011-11-04 09:09:53 +01:00
|
|
|
if ($conf->entity == 1 && $conf->multicompany->transverse_mode)
|
2011-08-19 09:22:17 +02:00
|
|
|
{
|
|
|
|
|
print '</td><td valign="top">'.$langs->trans("Entity").'</td>';
|
|
|
|
|
print "<td>".$mc->select_entities($conf->entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-08-20 00:15:22 +02:00
|
|
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
2011-08-19 09:22:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2011-08-20 00:15:22 +02:00
|
|
|
{
|
|
|
|
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
|
|
|
|
}
|
2011-06-07 17:45:01 +02:00
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
2009-05-04 20:13:07 +02:00
|
|
|
print '</td></tr>'."\n";
|
|
|
|
|
print '</table></form>'."\n";
|
|
|
|
|
print '<br>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2011-06-07 17:45:01 +02:00
|
|
|
* Group members
|
2009-05-04 20:13:07 +02:00
|
|
|
*/
|
2011-06-07 17:45:01 +02:00
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
2011-08-21 02:20:43 +02:00
|
|
|
print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
|
|
|
|
|
print '<td class="liste_titre">'.$langs->trans("Lastname").'</td>';
|
|
|
|
|
print '<td class="liste_titre">'.$langs->trans("Firstname").'</td>';
|
2012-07-07 15:11:58 +02:00
|
|
|
if (! empty($conf->multicompany->enabled) && $conf->entity == 1)
|
2011-08-20 00:15:22 +02:00
|
|
|
{
|
2011-08-21 02:20:43 +02:00
|
|
|
print '<td class="liste_titre">'.$langs->trans("Entity").'</td>';
|
2011-08-20 00:15:22 +02:00
|
|
|
}
|
2011-08-21 02:20:43 +02:00
|
|
|
print '<td class="liste_titre" width="5" align="center">'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td class="liste_titre" width="5" align="right"> </td>';
|
2011-06-07 17:45:01 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2011-08-21 02:20:43 +02:00
|
|
|
if (! empty($object->members))
|
2009-05-04 20:13:07 +02:00
|
|
|
{
|
2011-08-19 09:22:17 +02:00
|
|
|
$var=True;
|
2011-08-21 02:20:43 +02:00
|
|
|
|
|
|
|
|
foreach($object->members as $useringroup)
|
2011-08-19 09:22:17 +02:00
|
|
|
{
|
|
|
|
|
$var=!$var;
|
2011-08-24 00:10:25 +02:00
|
|
|
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2011-08-19 09:22:17 +02:00
|
|
|
print '<td>';
|
|
|
|
|
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$useringroup->id.'">'.img_object($langs->trans("ShowUser"),"user").' '.$useringroup->login.'</a>';
|
2011-08-20 00:15:22 +02:00
|
|
|
if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar');
|
2011-08-19 09:22:17 +02:00
|
|
|
else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star');
|
|
|
|
|
print '</td>';
|
2011-08-24 00:10:25 +02:00
|
|
|
print '<td>'.$useringroup->lastname.'</td>';
|
|
|
|
|
print '<td>'.$useringroup->firstname.'</td>';
|
2012-07-10 13:35:22 +02:00
|
|
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
2011-08-20 00:15:22 +02:00
|
|
|
{
|
2012-07-07 15:11:58 +02:00
|
|
|
print '<td class="valeur">';
|
|
|
|
|
if (! empty($useringroup->usergroup_entity))
|
|
|
|
|
{
|
|
|
|
|
$nb=0;
|
|
|
|
|
foreach($useringroup->usergroup_entity as $group_entity)
|
|
|
|
|
{
|
|
|
|
|
$mc->getInfo($group_entity);
|
|
|
|
|
print ($nb > 0 ? ', ' : '').$mc->label;
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'&entity='.$group_entity.'">';
|
|
|
|
|
print img_delete($langs->trans("RemoveFromGroup"));
|
|
|
|
|
print '</a>';
|
2012-07-07 15:11:58 +02:00
|
|
|
$nb++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2011-08-20 00:15:22 +02:00
|
|
|
}
|
2011-08-21 02:20:43 +02:00
|
|
|
print '<td align="center">'.$useringroup->getLibStatut(3).'</td>';
|
2011-08-19 09:22:17 +02:00
|
|
|
print '<td align="right">';
|
2012-07-10 13:20:53 +02:00
|
|
|
if (! empty($user->admin) && empty($conf->multicompany->enabled))
|
2011-08-19 09:22:17 +02:00
|
|
|
{
|
2012-07-10 13:20:53 +02:00
|
|
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&user='.$useringroup->id.'">';
|
2011-08-19 09:22:17 +02:00
|
|
|
print img_delete($langs->trans("RemoveFromGroup"));
|
2012-07-10 13:20:53 +02:00
|
|
|
print '</a>';
|
2011-08-19 09:22:17 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print "-";
|
|
|
|
|
}
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
}
|
2009-05-04 20:13:07 +02:00
|
|
|
}
|
2011-06-07 17:45:01 +02:00
|
|
|
else
|
|
|
|
|
{
|
2011-07-08 20:49:16 +02:00
|
|
|
print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
2009-05-04 20:13:07 +02:00
|
|
|
}
|
2011-06-07 17:45:01 +02:00
|
|
|
print "</table>";
|
|
|
|
|
print "<br>";
|
2009-05-04 20:13:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Fiche en mode edition
|
|
|
|
|
*/
|
2011-06-07 17:45:01 +02:00
|
|
|
if ($action == 'edit' && $caneditperms)
|
2009-05-04 20:13:07 +02:00
|
|
|
{
|
2011-06-07 17:45:01 +02:00
|
|
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post" name="updategroup" enctype="multipart/form-data">';
|
2009-05-17 10:01:54 +02:00
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2009-05-04 20:13:07 +02:00
|
|
|
print '<input type="hidden" name="action" value="update">';
|
|
|
|
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
2010-02-27 17:14:52 +01:00
|
|
|
print '<tr><td width="25%" valign="top" class="fieldrequired">'.$langs->trans("Name").'</td>';
|
2013-08-21 18:47:51 +02:00
|
|
|
print '<td width="75%" class="valeur"><input size="15" type="text" name="group" value="'.$object->name.'">';
|
2011-06-07 17:45:01 +02:00
|
|
|
print "</td></tr>\n";
|
2011-08-24 00:10:25 +02:00
|
|
|
|
2011-08-19 09:22:17 +02:00
|
|
|
// Multicompany
|
2011-08-21 12:01:36 +02:00
|
|
|
if (! empty($conf->multicompany->enabled))
|
2009-05-04 20:13:07 +02:00
|
|
|
{
|
2011-11-04 09:09:53 +01:00
|
|
|
if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
2011-07-08 20:49:16 +02:00
|
|
|
{
|
2011-08-19 09:22:17 +02:00
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Entity").'</td>';
|
|
|
|
|
print "<td>".$mc->select_entities($object->entity);
|
|
|
|
|
print "</td></tr>\n";
|
2011-07-08 20:49:16 +02:00
|
|
|
}
|
2011-08-19 09:22:17 +02:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
|
|
|
|
|
}
|
2009-05-04 20:13:07 +02:00
|
|
|
}
|
2011-07-08 20:49:16 +02:00
|
|
|
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
2009-05-04 20:13:07 +02:00
|
|
|
print '<td class="valeur">';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
2011-11-05 23:18:49 +01:00
|
|
|
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_8,90);
|
|
|
|
|
$doleditor->Create();
|
2011-07-08 20:49:16 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
print "</table>\n";
|
2011-11-05 23:18:49 +01:00
|
|
|
|
|
|
|
|
print '<center><br><input class="button" value="'.$langs->trans("Save").'" type="submit"></center>';
|
|
|
|
|
|
2011-07-08 20:49:16 +02:00
|
|
|
print '</form>';
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2005-01-27 16:55:40 +01:00
|
|
|
}
|
|
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-01-13 18:24:25 +01:00
|
|
|
$db->close();
|
2005-01-27 16:55:40 +01:00
|
|
|
?>
|