Skip to content
Snippets Groups Projects
Commit 46272cf4 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: for avoid error with function "complete_head_from_modules"

parent a3b3ce9c
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
......
<?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
......
<?php
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
......@@ -31,8 +31,8 @@ $langs->load("users");
// Security check
$id = GETPOST('id','int');
$fuser = new User($db);
$fuser->fetch($id);
$object = new User($db);
$object->fetch($id);
// Security check
$socid=0;
......@@ -45,7 +45,7 @@ if ($user->id == $id) // A user can always read its own card
$result = restrictedArea($user, 'user', $id, '&user', $feature2);
// If user is not user read and no permission to read other users, we stop
if (($fuser->id != $user->id) && (! $user->rights->user->user->lire))
if (($object->id != $user->id) && (! $user->rights->user->user->lire))
accessforbidden();
......@@ -56,16 +56,16 @@ if (($fuser->id != $user->id) && (! $user->rights->user->user->lire))
llxHeader();
$fuser->info($id);
$object->info($id);
$head = user_prepare_head($fuser);
$head = user_prepare_head($object);
$title = $langs->trans("User");
dol_fiche_head($head, 'info', $title, 0, 'user');
print '<table width="100%"><tr><td>';
dol_print_object_info($fuser);
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
......
<?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2015 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
......@@ -41,9 +41,9 @@ $feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
if ($user->id == $id) $feature2=''; // A user can always read its own card
$result = restrictedArea($user, 'user', $id, '&user', $feature2);
$fuser = new User($db);
$fuser->fetch($id);
$fuser->getrights();
$object = new User($db);
$object->fetch($id);
$object->getrights();
/*
......@@ -57,8 +57,8 @@ if ($_GET["action"] == 'dolibarr2ldap')
$ldap=new Ldap();
$result=$ldap->connect_bind();
$info=$fuser->_load_ldap_info();
$dn=$fuser->_load_ldap_dn($info);
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
$olddn=$dn; // We can say that old dn = dn as we force synchro
$result=$ldap->update($dn,$info,$user,$olddn);
......@@ -84,7 +84,7 @@ llxHeader();
$form = new Form($db);
$head = user_prepare_head($fuser);
$head = user_prepare_head($object);
$title = $langs->trans("User");
dol_fiche_head($head, 'ldap', $title, 0, 'user');
......@@ -94,29 +94,29 @@ print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin);
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
print '</td>';
print '</tr>';
// Lastname
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
print '<td>'.$fuser->lastname.'</td>';
print '<td>'.$object->lastname.'</td>';
print "</tr>\n";
// Firstname
print '<tr><td width="25%" valign="top">'.$langs->trans("Firstname").'</td>';
print '<td>'.$fuser->firstname.'</td>';
print '<td>'.$object->firstname.'</td>';
print "</tr>\n";
// Login
print '<tr><td width="25%" valign="top">'.$langs->trans("Login").'</td>';
if ($fuser->ldap_sid)
if ($object->ldap_sid)
{
print '<td class="warning">'.$langs->trans("LoginAccountDisableInDolibarr").'</td>';
}
else
{
print '<td>'.$fuser->login.'</td>';
print '<td>'.$object->login.'</td>';
}
print '</tr>';
......@@ -126,7 +126,7 @@ if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
$result = $ldap->connect_bind();
if ($result > 0)
{
$userSID = $ldap->getObjectSid($fuser->login);
$userSID = $ldap->getObjectSid($object->login);
}
print '<tr><td width="25%" valign="top">'.$langs->trans("SID").'</td>';
print '<td>'.$userSID.'</td>';
......@@ -158,7 +158,7 @@ print '<div class="tabsAction">';
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fuser->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
}
print "</div>\n";
......@@ -182,9 +182,9 @@ $ldap=new Ldap();
$result=$ldap->connect_bind();
if ($result > 0)
{
$info=$fuser->_load_ldap_info();
$dn=$fuser->_load_ldap_dn($info,1);
$search = "(".$fuser->_load_ldap_dn($info,2).")";
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info,1);
$search = "(".$object->_load_ldap_dn($info,2).")";
$records=$ldap->getAttribute($dn,$search);
//print_r($records);
......
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
......@@ -35,11 +35,11 @@ $langs->load("members");
$langs->load("bills");
$langs->load("users");
$fuser = new User($db);
$fuser->fetch($id);
$object = new User($db);
$object->fetch($id);
// If user is not user read and no permission to read other users, we stop
if (($fuser->id != $user->id) && (! $user->rights->user->user->lire)) accessforbidden();
if (($object->id != $user->id) && (! $user->rights->user->user->lire)) accessforbidden();
// Security check
$socid=0;
......@@ -58,7 +58,7 @@ if ($action == 'update' && $user->rights->user->user->creer && ! $_POST["cancel"
{
$db->begin();
$res=$fuser->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
$res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
if ($res < 0)
{
$mesg='<div class="error">'.$adh->error.'</div>';
......@@ -82,7 +82,7 @@ $form = new Form($db);
if ($id)
{
$head = user_prepare_head($fuser);
$head = user_prepare_head($object);
$title = $langs->trans("User");
dol_fiche_head($head, 'note', $title, 0, 'user');
......@@ -97,19 +97,19 @@ if ($id)
// Reference
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin);
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
print '</td>';
print '</tr>';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$fuser->lastname.'&nbsp;</td>';
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$object->lastname.'&nbsp;</td>';
print '</tr>';
// Firstname
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$fuser->firstname.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$object->firstname.'&nbsp;</td></tr>';
// Login
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur" colspan="3">'.$fuser->login.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur" colspan="3">'.$object->login.'&nbsp;</td></tr>';
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
......@@ -117,15 +117,15 @@ if ($id)
if ($action == 'edit' && $user->rights->user->user->creer)
{
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$fuser->id."\">";
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note_private',$fuser->note,'',280,'dolibarr_notes','In',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
$doleditor=new DolEditor('note_private',$object->note,'',280,'dolibarr_notes','In',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
$doleditor->Create();
}
else
{
print dol_htmlentitiesbr($fuser->note);
print dol_htmlentitiesbr($object->note);
}
print "</td></tr>";
......@@ -151,7 +151,7 @@ if ($id)
if ($user->rights->user->user->creer && $action != 'edit')
{
print "<a class=\"butAction\" href=\"note.php?id=".$fuser->id."&amp;action=edit\">".$langs->trans('Modify')."</a>";
print "<a class=\"butAction\" href=\"note.php?id=".$object->id."&amp;action=edit\">".$langs->trans('Modify')."</a>";
}
print "</div>";
......
<?php
/* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -62,9 +62,9 @@ $dirtop = "../core/menus/standard";
$dirleft = "../core/menus/standard";
// Charge utilisateur edite
$fuser = new User($db);
$fuser->fetch($id);
$fuser->getrights();
$object = new User($db);
$object->fetch($id);
$object->getrights();
// Liste des zone de recherche permanentes supportees
$searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
......@@ -97,7 +97,7 @@ if ($action == 'update' && ($caneditfield || ! empty($user->admin)))
$tabparam["MAIN_SEARCHFORM_SOCIETE"]=$_POST["main_searchform_societe"];
$tabparam["MAIN_SEARCHFORM_PRODUITSERVICE"]=$_POST["main_searchform_produitservice"];
$result=dol_set_user_param($db, $conf, $fuser, $tabparam);
$result=dol_set_user_param($db, $conf, $object, $tabparam);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit;
......@@ -112,7 +112,7 @@ if ($action == 'update' && ($caneditfield || ! empty($user->admin)))
llxHeader();
$head = user_prepare_head($fuser);
$head = user_prepare_head($object);
$title = $langs->trans("User");
......@@ -133,18 +133,18 @@ 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($fuser,'id','',$user->rights->user->user->lire || $user->admin);
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
print '</td>';
print '</tr>';
// LastName
print '<tr><td width="25%" valign="top">'.$langs->trans("LastName").'</td>';
print '<td colspan="2">'.$fuser->lastname.'</td>';
print '<td colspan="2">'.$object->lastname.'</td>';
print "</tr>\n";
// FirstName
print '<tr><td width="25%" valign="top">'.$langs->trans("FirstName").'</td>';
print '<td colspan="2">'.$fuser->firstname.'</td>';
print '<td colspan="2">'.$object->firstname.'</td>';
print "</tr>\n";
print '</table><br>';
......@@ -178,26 +178,26 @@ if ($action == 'edit')
print $s?$s.' ':'';
print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
print '</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(! empty($fuser->conf->MAIN_LANG_DEFAULT)?" checked":"");
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(! empty($object->conf->MAIN_LANG_DEFAULT)?" checked":"");
print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
print $formadmin->select_language((! empty($fuser->conf->MAIN_LANG_DEFAULT)?$fuser->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1,null,0,0,(! empty($dolibarr_main_demo)));
print $formadmin->select_language((! empty($object->conf->MAIN_LANG_DEFAULT)?$object->conf->MAIN_LANG_DEFAULT:''),'main_lang_default',1,null,0,0,(! empty($dolibarr_main_demo)));
print '</td></tr>';
// Taille max des listes
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(! empty($fuser->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"");
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"");
print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input class="flat" name="main_size_liste_limit" id="main_size_liste_limit" size="4" value="' . (! empty($fuser->conf->MAIN_SIZE_LISTE_LIMIT)?$fuser->conf->MAIN_SIZE_LISTE_LIMIT:'') . '"></td></tr>';
print '<td><input class="flat" name="main_size_liste_limit" id="main_size_liste_limit" size="4" value="' . (! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?$object->conf->MAIN_SIZE_LISTE_LIMIT:'') . '"></td></tr>';
print '</table><br>';
// Theme
show_theme($fuser,(($user->admin || empty($dolibarr_main_demo))?1:0),true);
show_theme($object,(($user->admin || empty($dolibarr_main_demo))?1:0),true);
dol_fiche_end();
......@@ -225,24 +225,24 @@ else
print ($s?$s.' ':'');
print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
print '</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' type="checkbox" disabled '.(! empty($fuser->conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' type="checkbox" disabled '.(! empty($object->conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
$s=(isset($fuser->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($fuser->conf->MAIN_LANG_DEFAULT) : '');
$s=(isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : '');
print ($s?$s.' ':'');
print (isset($fuser->conf->MAIN_LANG_DEFAULT) && $fuser->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):(! empty($fuser->conf->MAIN_LANG_DEFAULT)?$langs->trans("Language_".$fuser->conf->MAIN_LANG_DEFAULT):''));
print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):(! empty($object->conf->MAIN_LANG_DEFAULT)?$langs->trans("Language_".$object->conf->MAIN_LANG_DEFAULT):''));
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
print '<td>'.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:'&nbsp;').'</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' type="checkbox" disabled '.(! empty($fuser->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>' . (! empty($fuser->conf->MAIN_SIZE_LISTE_LIMIT)?$fuser->conf->MAIN_SIZE_LISTE_LIMIT:'&nbsp;') . '</td></tr>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' type="checkbox" disabled '.(! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>' . (! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?$object->conf->MAIN_SIZE_LISTE_LIMIT:'&nbsp;') . '</td></tr>';
print '</table><br>';
// Skin
show_theme($fuser,0,true);
show_theme($object,0,true);
dol_fiche_end();
......@@ -256,7 +256,7 @@ else
{
if ($caneditfield || ! empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$fuser->id.'">'.$langs->trans("Modify").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
}
else
{
......
......@@ -3,7 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
......@@ -114,11 +114,11 @@ llxHeader('',$langs->trans("Permissions"));
$form=new Form($db);
$fuser = new User($db);
$fuser->fetch($id);
$fuser->getrights();
$object = new User($db);
$object->fetch($id);
$object->getrights();
$head = user_prepare_head($fuser);
$head = user_prepare_head($object);
$title = $langs->trans("User");
dol_fiche_head($head, 'rights', $title, 0, 'user');
......@@ -157,7 +157,7 @@ foreach($modulesdir as $dir)
// Load all permissions
if ($objMod->rights_class)
{
$forceEntity=((! empty($conf->multicompany->enabled) && ! empty($fuser->entity)) ? $fuser->entity : null);
$forceEntity=((! empty($conf->multicompany->enabled) && ! empty($object->entity)) ? $object->entity : null);
$ret=$objMod->insert_permissions(0, $forceEntity);
$modules[$objMod->rights_class]=$objMod;
//print "modules[".$objMod->rights_class."]=$objMod;";
......@@ -182,14 +182,14 @@ if (! empty($conf->multicompany->enabled))
if (1==2 && ! empty($conf->multicompany->transverse_mode)) {
$sql.= " AND r.entity = ".(GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity); // TODO unused for the moment
} else {
$sql.= " AND r.entity = ".(! empty($fuser->entity) ? $fuser->entity : $conf->entity);
$sql.= " AND r.entity = ".(! empty($object->entity) ? $object->entity : $conf->entity);
}
}
else
{
$sql.= " AND r.entity = ".$conf->entity;
}
$sql.= " AND ur.fk_user = ".$fuser->id;
$sql.= " AND ur.fk_user = ".$object->id;
dol_syslog("get user perms", LOG_DEBUG);
$result=$db->query($sql);
......@@ -222,10 +222,10 @@ $sql.= " WHERE gr.fk_id = r.id";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) {
$sql.= " AND gu.entity IS NOT NULL";
} else {
$sql.= " AND r.entity = ".((! empty($conf->multicompany->enabled) && ! empty($fuser->entity)) ? $fuser->entity : $conf->entity);
$sql.= " AND r.entity = ".((! empty($conf->multicompany->enabled) && ! empty($object->entity)) ? $object->entity : $conf->entity);
}
$sql.= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql.= " AND gu.fk_user = ".$fuser->id;
$sql.= " AND gu.fk_user = ".$object->id;
dol_syslog("get user perms", LOG_DEBUG);
$result=$db->query($sql);
......@@ -258,18 +258,18 @@ print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin);
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
print '</td>';
print '</tr>'."\n";
// Lastname
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>';
print '<td>'.$fuser->lastname.'</td>';
print '<td>'.$object->lastname.'</td>';
print '</tr>'."\n";
// Firstname
print '<tr><td width="25%" valign="top">'.$langs->trans("Firstname").'</td>';
print '<td>'.$fuser->firstname.'</td>';
print '<td>'.$object->firstname.'</td>';
print '</tr>'."\n";
print '</table><br>';
......@@ -285,7 +285,7 @@ if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transv
$aEntities=array_keys($permsgroupbyentity);
sort($aEntities);
$entity = (GETPOST('entity', 'int')?GETPOST('entity', 'int'):$aEntities[0]);
$head = entity_prepare_head($fuser, $aEntities);
$head = entity_prepare_head($object, $aEntities);
$title = $langs->trans("Entities");
dol_fiche_head($head, $entity, $title, 1, 'multicompany@multicompany');
}
......@@ -303,7 +303,7 @@ print '</tr>'."\n";
$sql = "SELECT r.id, r.libelle, r.module";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND r.entity = ".((! empty($conf->multicompany->enabled) && ! empty($fuser->entity)) ? $fuser->entity : $conf->entity);
$sql.= " AND r.entity = ".((! empty($conf->multicompany->enabled) && ! empty($object->entity)) ? $object->entity : $conf->entity);
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
$sql.= " ORDER BY r.module, r.id";
......@@ -335,16 +335,16 @@ if ($result)
$objMod=$modules[$obj->module];
$picto=($objMod->picto?$objMod->picto:'generic');
if ($caneditperms && (empty($objMod->rights_admin_allowed) || empty($fuser->admin)))
if ($caneditperms && (empty($objMod->rights_admin_allowed) || empty($object->admin)))
{
// On affiche ligne pour modifier droits
print '<tr '. $bc[$var].'>';
print '<td class="nowrap">'.img_object('',$picto).' '.$objMod->getName();
print '<a name="'.$objMod->getName().'">&nbsp;</a></td>';
print '<td align="center" class="nowrap">';
print '<a title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="perms.php?id='.$fuser->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
print '<a title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="perms.php?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
print '/';
print '<a title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="perms.php?id='.$fuser->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>";
print '<a title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="perms.php?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>";
print '</td>';
print '<td colspan="2">&nbsp;</td>';
print '</tr>'."\n";
......@@ -357,7 +357,7 @@ if ($result)
print '<td>'.img_object('',$picto).' '.$objMod->getName().'</td>';
// Permission and tick
if (! empty($fuser->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin
if (! empty($object->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin
{
if ($caneditperms)
{
......@@ -371,7 +371,7 @@ if ($result)
{
if ($caneditperms)
{
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&amp;action=delrights&amp;rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
print '<td align="center"><a href="perms.php?id='.$object->id.'&amp;action=delrights&amp;rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
}
print '<td align="center" class="nowrap">';
print img_picto($langs->trans("Active"),'tick');
......@@ -397,7 +397,7 @@ if ($result)
// Do not own permission
if ($caneditperms)
{
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td align="center"><a href="perms.php?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
}
print '<td>&nbsp</td>';
}
......@@ -407,7 +407,7 @@ if ($result)
// Do not own permission
if ($caneditperms)
{
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td align="center"><a href="perms.php?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
}
print '<td>&nbsp</td>';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment