diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 17123f7e40a..ff92cc54ede 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2849,82 +2849,30 @@ class User extends CommonObject $withpictoimg = 0; } - $result = ''; $label = ''; $companylink = ''; - - if (!empty($this->photo)) { - $label .= '
'; - $label .= Form::showphoto('userphoto', $this, 0, 60, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); // Force height to 60 so we total height of tooltip can be calculated and collision can be managed - $label .= '
'; - //$label .= '
'; + $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'infologin' => $infologin, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - - // Info Login - $label .= '
'; - $label .= img_picto('', $this->picto).' '.$langs->trans("User").''; - $label .= ' '.$this->getLibStatut(4); - $label .= '
'.$langs->trans('Name').': '.dol_string_nohtmltag($this->getFullName($langs, '')); - if (!empty($this->login)) { - $label .= '
'.$langs->trans('Login').': '.dol_string_nohtmltag($this->login); - } - if (!empty($this->job)) { - $label .= '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job); - } - $label .= '
'.$langs->trans("Email").': '.dol_string_nohtmltag($this->email); - if (!empty($this->office_phone) || !empty($this->office_fax) || !empty($this->fax)) { - $phonelist = array(); - if ($this->office_phone) { - $phonelist[] = dol_print_phone($this->office_phone, $this->country_code, $this->id, 0, '', ' ', 'phone'); - } - if ($this->office_fax) { - $phonelist[] = dol_print_phone($this->office_fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); - } - if ($this->user_mobile) { - $phonelist[] = dol_print_phone($this->user_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile'); - } - $label .= '
'.$langs->trans('Phone').': '.implode(' ', $phonelist); - } - if (!empty($this->admin)) { - $label .= '
'.$langs->trans("Administrator").': '.yn($this->admin); - } - if (!empty($this->accountancy_code) || $option == 'accountancy') { - $label .= '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code; - } - $company = ''; + $label = implode($this->getTooltipContentArray($params)); + $companylink = ''; if (!empty($this->socid)) { // Add thirdparty for external users - $thirdpartystatic = new Societe($db); + $thirdpartystatic = new Societe($this->db); $thirdpartystatic->fetch($this->socid); if (empty($hidethirdpartylogo)) { $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company } - $company = ' ('.$langs->trans("Company").': '.img_picto('', 'company').' '.dol_string_nohtmltag($thirdpartystatic->name).')'; - } - $type = ($this->socid ? $langs->trans("ExternalUser").$company : $langs->trans("InternalUser")); - $label .= '
'.$langs->trans("Type").': '.$type; - $label .= '
'; - if ($infologin > 0) { - $label .= '
'; - $label .= '
'.$langs->trans("Session").''; - $label .= '
'.$langs->trans("IPAddress").': '.dol_string_nohtmltag(getUserRemoteIP()); - if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { - $label .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (User entity '.$this->entity.')'; - } - $label .= '
'.$langs->trans("AuthenticationMode").': '.dol_string_nohtmltag($_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)')); - $label .= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser'); - $label .= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser'); - $label .= '
'.$langs->trans("CurrentTheme").': '.dol_string_nohtmltag($conf->theme); - $label .= '
'.$langs->trans("CurrentMenuManager").': '.dol_string_nohtmltag($menumanager->name); - $s = picto_from_langcode($langs->getDefaultLang()); - $label .= '
'.$langs->trans("CurrentUserLanguage").': '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang()); - $label .= '
'.$langs->trans("Browser").': '.dol_string_nohtmltag($conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')'); - $label .= '
'.$langs->trans("Layout").': '.dol_string_nohtmltag($conf->browser->layout); - $label .= '
'.$langs->trans("Screen").': '.dol_string_nohtmltag($_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']); - if ($conf->browser->layout == 'phone') { - $label .= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); - } - if (!empty($_SESSION["disablemodules"])) { - $label .= '
'.$langs->trans("DisabledModules").':
'.dol_string_nohtmltag(join(', ', explode(',', $_SESSION["disablemodules"]))); - } } + if ($infologin < 0) { $label = ''; } @@ -2947,19 +2895,6 @@ class User extends CommonObject $linkstart = ' $this->id, - 'objecttype' => $this->element, - 'infologin' => $infologin, - 'option' => $option, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 8d5a054f646..04554b282d0 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -105,6 +105,11 @@ class UserGroup extends CommonObject private $_tab_loaded = array(); // Array of cache of already loaded permissions + /** + * @var int all_permissions_are_loaded + */ + public $all_permissions_are_loaded; + public $oldcopy; // To contains a clone of this when we need to save old properties of object public $fields = array( @@ -767,13 +772,20 @@ class UserGroup extends CommonObject $withpicto = 0; } - $result = ''; $label = ''; - - $label .= '
'; - $label .= img_picto('', 'group').' '.$langs->trans("Group").'
'; - $label .= ''.$langs->trans('Name').': '.$this->name; - $label .= '
'.$langs->trans("Description").': '.$this->note; - $label .= '
'; + $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); if ($option == 'permissions') { $url = DOL_URL_ROOT.'/user/group/perms.php?id='.$this->id; @@ -793,18 +805,6 @@ class UserGroup extends CommonObject } $linkclose = ""; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users");