diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e758e8fbc7d..74fbff46ea3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -31,7 +31,7 @@ * \file htdocs/core/class/html.form.class.php * \ingroup core * \brief File of class with all html predefined components - * \version $Id: html.form.class.php,v 1.199 2011/08/19 22:15:22 hregis Exp $ + * \version $Id: html.form.class.php,v 1.200 2011/08/20 09:03:38 hregis Exp $ */ @@ -763,10 +763,11 @@ class Form * @param disabled If select list must be disabled * @param include Array list of users id to include * @param enableonly Array list of users id to be enabled. All other must be disabled + * @param force_entity Possibility to force entity */ - function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='') + function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { - print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly); + print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); } /** @@ -778,8 +779,9 @@ class Form * @param disabled If select list must be disabled * @param include Array list of users id to include * @param enableonly Array list of users id to be enabled. All other must be disabled + * @param force_entity Possibility to force entity */ - function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='') + function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { global $conf,$user,$langs; @@ -803,7 +805,8 @@ class Form if($conf->multicompany->enabled && $conf->entity == 1 && $user->admin && ! $user->entity) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."entity as e on e.rowid=u.entity"; - $sql.= " WHERE u.entity IS NOT NULL"; + if ($force_entity) $sql.= " WHERE u.entity IN (0,".$force_entity.")"; + else $sql.= " WHERE u.entity IS NOT NULL"; } else { diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 426d8d3d41c..d5a8c72ea3b 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -28,7 +28,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. - * \version $Id: functions.lib.php,v 1.559 2011/08/19 22:15:22 hregis Exp $ + * \version $Id: functions.lib.php,v 1.560 2011/08/20 09:03:38 hregis Exp $ */ // For compatibility during upgrade @@ -2208,11 +2208,11 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='' { $sql=''; - $check = array('banque','user','usergroup','produit','service','produit|service'); // Test on entity only (Objects with no link to company) + $check = array('banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object $checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet'); // Test for project object - $nocheck = array('categorie','barcode','stock','fournisseur'); // No test + $nocheck = array('barcode','stock','fournisseur'); // No test $checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...). // If dbtable not defined, we use same name for table than module name diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index cff3f0b5bc9..78aacac7e91 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -21,7 +21,7 @@ /** * \file htdocs/user/group/fiche.php * \brief Onglet groupes utilisateurs - * \version $Id: fiche.php,v 1.74 2011/08/19 22:15:23 hregis Exp $ + * \version $Id: fiche.php,v 1.75 2011/08/20 09:03:38 hregis Exp $ */ require("../../main.inc.php"); @@ -374,7 +374,7 @@ else print ''."\n"; print ''."\n"; print '
'.$langs->trans("NonAffectedUsers").''; - print $form->select_users('','user',1,$exclude); + print $form->select_users('','user',1,$exclude,0,'','',$object->entity); print '   '; // Multicompany if ($conf->multicompany->enabled) @@ -521,5 +521,5 @@ else $db->close(); -llxFooter('$Date: 2011/08/19 22:15:23 $ - $Revision: 1.74 $'); +llxFooter('$Date: 2011/08/20 09:03:38 $ - $Revision: 1.75 $'); ?> diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index 5cab12b2aab..2e43ed37c7b 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Herve Prot * * This program is free software; you can redistribute it and/or modify @@ -22,7 +22,7 @@ * \file htdocs/user/group/index.php * \ingroup core * \brief Page of user groups - * \version $Id: index.php,v 1.28 2011/08/19 22:15:23 hregis Exp $ + * \version $Id: index.php,v 1.29 2011/08/20 09:03:38 hregis Exp $ */ require("../../main.inc.php"); @@ -59,7 +59,7 @@ print_fiche_titre($langs->trans("ListOfGroups")); $sql = "SELECT g.rowid, g.nom, g.entity, g.datec, COUNT(ugu.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid"; -if($conf->multicompany->enabled && $conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1) +if($conf->multicompany->enabled && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity))) { $sql.= " WHERE g.entity IS NOT NULL"; } @@ -82,7 +82,7 @@ if ($resql) $i = 0; $param="search_group=$search_group&sall=$sall"; - print ""; + print '
'; print ''; print_liste_field_titre($langs->trans("Group"),$_SERVER["PHP_SELF"],"g.nom",$param,"","",$sortfield,$sortorder); //multicompany @@ -129,6 +129,6 @@ else $db->close(); -llxFooter('$Date: 2011/08/19 22:15:23 $ - $Revision: 1.28 $'); +llxFooter('$Date: 2011/08/20 09:03:38 $ - $Revision: 1.29 $'); ?> diff --git a/htdocs/user/home.php b/htdocs/user/home.php index ff508457bcc..474f960a137 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -19,7 +19,7 @@ /** * \file htdocs/user/home.php * \brief Home page of users and groups management - * \version $Id: home.php,v 1.50 2011/08/19 22:15:23 hregis Exp $ + * \version $Id: home.php,v 1.51 2011/08/20 09:03:38 hregis Exp $ */ require("../main.inc.php"); @@ -197,16 +197,25 @@ if ($canreadperms) $sql = "SELECT g.rowid, g.nom, g.note, g.entity, g.datec"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g"; - $sql.= " WHERE g.entity IN (0,".$conf->entity.")"; + if($conf->multicompany->enabled && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity))) + { + $sql.= " WHERE g.entity IS NOT NULL"; + } + else + { + $sql.= " WHERE g.entity IN (0,".$conf->entity.")"; + } $sql.= $db->order("g.datec","DESC"); $sql.= $db->plimit($max); $resql=$db->query($sql); if ($resql) { + $colspan=2; + if ($conf->multicompany->enabled) $colspan++; $num = $db->num_rows($resql); print '
'; - print ''; + print ''; $var = true; $i = 0; @@ -217,11 +226,19 @@ if ($canreadperms) print ""; print '"; + if ($conf->multicompany->enabled) + { + $mc = new ActionsMulticompany($db); + $mc->getInfo($obj->entity); + print ''; + } print ''; print ""; $i++; @@ -242,5 +259,5 @@ print '
'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).'
'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).'
'.img_object($langs->trans("ShowGroup"),"group").' '.$obj->nom.''; - if (!$obj->entity) + if (! $obj->entity) { print img_picto($langs->trans("GlobalGroup"),'redstar'); } print "'; + print $mc->label; + print ''.dol_print_date($db->jdate($obj->datec),'dayhour').'
'; $db->close(); -llxFooter('$Date: 2011/08/19 22:15:23 $ - $Revision: 1.50 $'); +llxFooter('$Date: 2011/08/20 09:03:38 $ - $Revision: 1.51 $'); ?>