' . $tmpphoto . '
';
+ //$label .= 'picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : $this->label);
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 43760d808b2..2392962a500 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -46,10 +46,18 @@ class MouvementStock extends CommonObject
*/
public $product_id;
+ /**
+ * @var int ID warehouse
+ * @deprecated
+ * @see $warehouse_id
+ */
+ public $entrepot_id;
+
/**
* @var int ID warehouse
*/
public $warehouse_id;
+
public $qty;
/**
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index 649c5578fa4..39a8d5721a9 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -585,6 +585,34 @@ class Productlot extends CommonObject
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $langs->loadLangs(['stocks', 'productbatch']);
+
+ $datas = [];
+ $option = $params['option'] ?? '';
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Batch").'';
+ $datas['divopen'] = '';
+ $datas['batch'] = ''.$langs->trans('Batch').': '.$this->batch;
+ if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
+ $datas['eatby'] = '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day');
+ }
+ if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
+ $datas['sellby'] = '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day');
+ }
+ $datas['divclose'] = '
';
+
+ return $datas;
+ }
+
/**
* Return a link to the a lot card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
@@ -604,16 +632,20 @@ class Productlot extends CommonObject
global $menumanager;
$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 = img_picto('', $this->picto).' '.$langs->trans("Batch").'';
- $label .= '';
- $label .= '
'.$langs->trans('Batch').': '.$this->batch;
- if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
- $label .= '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day');
- }
- if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
- $label .= '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day');
- }
+ $label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/product/stock/productlot_card.php?id='.$this->id;
@@ -635,7 +667,7 @@ class Productlot extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -654,7 +686,7 @@ class Productlot extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->batch;
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 305cfdd570b..20b0fb26e32 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1244,6 +1244,50 @@ class Project extends CommonObject
return dolGetStatus($langs->transnoentitiesnoconv($this->statuts_long[$status]), $langs->transnoentitiesnoconv($this->statuts_short[$status]), '', $statusClass, $mode);
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs;
+
+ $langs->load('projects');
+ $option = $params['option'] ?? '';
+ $moreinpopup = $params['morinpopup'] ?? '';
+
+ $datas = [];
+ if ($option != 'nolink') {
+ $datas['picto'] = img_picto('', $this->picto, 'class="pictofixedwidth"').'
'.$langs->trans("Project").'';
+ }
+ if (isset($this->status)) {
+ $datas['picto'] .= ' '.$this->getLibStatut(5);
+ }
+ $datas['ref'] = (isset($datas['picto']) ? '
' : '').'
'.$langs->trans('Ref').': '.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto
+ $datas['label'] = '
'.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
+ if (isset($this->public)) {
+ $datas['visibility'] = '
'.$langs->trans("Visibility").": ";
+ $datas['visibility'] .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject"));
+ }
+ if (!empty($this->thirdparty_name)) {
+ $datas['thirdparty'] = '
'.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
+ }
+ if (!empty($this->date_start)) {
+ $datas['datestart'] = '
'.$langs->trans('DateStart').': '.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
+ }
+ if (!empty($this->date_end)) {
+ $datas['dateend'] = '
'.$langs->trans('DateEnd').': '.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
+ }
+ if ($moreinpopup) {
+ $datas['moreinpopup'] = '
'.$moreinpopup;
+ }
+
+ return $datas;
+ }
+
/**
* Return clickable name (with picto eventually)
*
@@ -1269,32 +1313,20 @@ class Project extends CommonObject
if (!empty($conf->global->PROJECT_OPEN_ALWAYS_ON_TAB)) {
$option = $conf->global->PROJECT_OPEN_ALWAYS_ON_TAB;
}
-
- $label = '';
- if ($option != 'nolink') {
- $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'
'.$langs->trans("Project").'';
- }
- if (isset($this->status)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- $label .= ($label ? '
' : '').'
'.$langs->trans('Ref').': '.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto
- $label .= ($label ? '
' : '').'
'.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto
- if (isset($this->public)) {
- $label .= '
'.$langs->trans("Visibility").": ";
- $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject"));
- }
- if (!empty($this->thirdparty_name)) {
- $label .= ($label ? '
' : '').'
'.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
- }
- if (!empty($this->date_start)) {
- $label .= ($label ? '
' : '').'
'.$langs->trans('DateStart').': '.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
- }
- if (!empty($this->date_end)) {
- $label .= ($label ? '
' : '').'
'.$langs->trans('DateEnd').': '.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
- }
- if ($moreinpopup) {
- $label .= '
'.$moreinpopup;
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'moreinpopup' => $moreinpopup,
+ '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));
$url = '';
if ($option != 'nolink') {
@@ -1325,8 +1357,8 @@ class Project extends CommonObject
$label = $langs->trans("ShowProject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -1342,7 +1374,7 @@ class Project extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').$classfortooltip.' pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 597e680f8f0..1a4f96bacc6 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2008-2014 Laurent Destailleur
* Copyright (C) 2010-2012 Regis Houssin
* Copyright (C) 2014 Marcos García
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2023 Frédéric France
* Copyright (C) 2020 Juanjo Menent
* Copyright (C) 2022 Charlene Benke
*
@@ -696,6 +696,34 @@ class Task extends CommonObjectLine
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $langs;
+
+ $langs->load('projects');
+
+ $datas = [];
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Task").'';
+ if (!empty($this->ref)) {
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->label)) {
+ $datas['label'] = '
'.$langs->trans('LabelTask').': '.$this->label;
+ }
+ if ($this->date_start || $this->date_end) {
+ $datas['range'] = "
".get_date_range($this->date_start, $this->date_end, '', $langs, 0);
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable name (with picto eventually)
*
@@ -717,16 +745,18 @@ class Task extends CommonObjectLine
}
$result = '';
- $label = img_picto('', $this->picto).' '.$langs->trans("Task").'';
- if (!empty($this->ref)) {
- $label .= '
'.$langs->trans('Ref').': '.$this->ref;
- }
- if (!empty($this->label)) {
- $label .= '
'.$langs->trans('LabelTask').': '.$this->label;
- }
- if ($this->date_start || $this->date_end) {
- $label .= "
".get_date_range($this->date_start, $this->date_end, '', $langs, 0);
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ ];
+ $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));
$url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : '');
// Add param to save lastsearch_values or not
@@ -744,8 +774,8 @@ class Task extends CommonObjectLine
$label = $langs->trans("ShowTask");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip nowraponall"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.' nowraponall"';
} else {
$linkclose .= ' class="nowraponall"';
}
@@ -758,7 +788,7 @@ class Task extends CommonObjectLine
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php
index 99cc586cbb9..5d0c0481b98 100644
--- a/htdocs/resource/class/dolresource.class.php
+++ b/htdocs/resource/class/dolresource.class.php
@@ -52,6 +52,9 @@ class Dolresource extends CommonObject
public $type_label;
+ /**
+ * @var string description
+ */
public $description;
public $fk_country;
@@ -761,6 +764,33 @@ class Dolresource extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs;
+
+ $langs->load('resource');
+
+ $datas = [];
+
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Resource").'';
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ /*if (isset($this->status)) {
+ $datas['status'] = '
' . $langs->trans("Status").": ".$this->getLibStatut(5);
+ }*/
+ if (isset($this->type_label)) {
+ $datas['label'] = '
'.$langs->trans("ResourceType").": ".$this->type_label;
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -777,15 +807,18 @@ class Dolresource extends CommonObject
global $conf, $langs, $hookmanager;
$result = '';
- $label = img_picto('', $this->picto).' '.$langs->trans("Resource").'';
- $label .= '
';
- $label .= ''.$langs->trans('Ref').': '.$this->ref;
- /*if (isset($this->status)) {
- $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5);
- }*/
- if (isset($this->type_label)) {
- $label .= '
'.$langs->trans("ResourceType").": ".$this->type_label;
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ ];
+ $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));
$url = DOL_URL_ROOT.'/resource/card.php?id='.$this->id;
@@ -806,8 +839,8 @@ class Dolresource extends CommonObject
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -820,7 +853,7 @@ class Dolresource extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php
index 2f7bb36869e..acf811b4f88 100644
--- a/htdocs/salaries/class/salary.class.php
+++ b/htdocs/salaries/class/salary.class.php
@@ -79,6 +79,17 @@ class Salary extends CommonObject
*/
public $fk_bank;
+ /**
+ * @var int
+ * @see $accountid
+ */
+ public $fk_account;
+
+ /**
+ * @var int
+ */
+ public $accountid;
+
/**
* @var int ID
*/
@@ -250,7 +261,8 @@ class Salary extends CommonObject
$this->fk_bank = $obj->fk_bank;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif;
- $this->fk_account = $this->accountid = $obj->fk_account;
+ $this->fk_account = $obj->fk_account;
+ $this->accountid = $obj->fk_account;
// Retrieve all extrafield
// fetch optionals attributes and labels
@@ -479,6 +491,25 @@ class Salary extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $langs->loadLangs(['salaries']);
+
+ $datas = [];
+ $option = $params['option'] ?? '';
+ $datas['picto'] = ''.$langs->trans("Salary").'';
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+
+ return $datas;
+ }
/**
* Send name clicable (with possibly the picto)
@@ -499,27 +530,32 @@ class Salary extends CommonObject
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
$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 = ''.$langs->trans("Salary").'';
- $label .= '
';
- $label .= ''.$langs->trans('Ref').': '.$this->ref;
- if ($this->label) {
- $label .= '
'.$langs->trans('Label').': '.$this->label;
- }
- if ($this->datesp && $this->dateep) {
- $label .= '
'.$langs->trans('Period').': '.dol_print_date($this->datesp, 'day').' - '.dol_print_date($this->dateep, 'day');
- }
- if (isset($this->amount)) {
- $label .= '
'.$langs->trans('Amount').': '.price($this->amount);
- }
+ $label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
if ($option != 'nolink') {
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
- if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
+ $add_save_lastsearch_values = 1;
+ }
+ if ($add_save_lastsearch_values) {
+ $url .= '&save_lastsearch_values=1';
+ }
}
$linkclose = '';
@@ -529,23 +565,22 @@ class Salary extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('myobjectdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
- } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
+ } else {
+ $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+ }
$linkstart = '';
$linkend = '';
$result .= $linkstart;
- if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1);
- if ($withpicto != 2) $result .= $this->ref;
+ if ($withpicto) {
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.' pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1);
+ }
+ if ($withpicto != 2) {
+ $result .= $this->ref;
+ }
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 5f4a8c36b7c..bc0e8cff3bd 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2597,6 +2597,138 @@ class Societe extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $langs->loadLangs(['companies', 'commercial']);
+
+ $datas = [];
+
+ $option = $params['option'] ?? '';
+ $name = $this->name;
+
+ if (!empty($this->name_alias) && empty($noaliasinname)) {
+ $name .= ' ('.$this->name_alias.')';
+ }
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("ShowCompany")];
+ }
+
+ if (!empty($this->logo) && class_exists('Form')) {
+ $photo = '';
+ $photo .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
+ $photo .= '
';
+ $datas['photo'] = $photo;
+ } elseif (!empty($this->logo_squarred) && class_exists('Form')) {
+ /*$label.= '';
+ $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
+ $label.= '
';*/
+ }
+
+ $datas['divopen'] = '';
+
+ if ($option == 'customer' || $option == 'compta' || $option == 'category') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Customer").'';
+ } elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Prospect").'';
+ } elseif ($option == 'supplier' || $option == 'category_supplier') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Supplier").'';
+ } elseif ($option == 'agenda') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").'';
+ } elseif ($option == 'project') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").'';
+ } elseif ($option == 'margin') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").'';
+ } elseif ($option == 'contact') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").'';
+ } elseif ($option == 'ban') {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").'';
+ }
+
+ // By default
+ if (empty($datas['picto'])) {
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").'';
+ }
+ if (isset($this->status)) {
+ $datas['status'] = ' '.$this->getLibStatut(5);
+ }
+ if (isset($this->client) && isset($this->fournisseur)) {
+ $datas['type'] = ' ' . $this->getTypeUrl(1);
+ }
+ $datas['name'] = '
'.$langs->trans('Name').': '.dol_escape_htmltag($this->name);
+ if (!empty($this->name_alias)) {
+ $datas['namealias'] = ' ('.dol_escape_htmltag($this->name_alias).')';
+ }
+ if (!empty($this->email)) {
+ $datas['email'] = '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
+ }
+ if (!empty($this->url)) {
+ $datas['url'] = '
'.img_picto('', 'globe', 'class="pictofixedwidth"').$this->url;
+ }
+ if (!empty($this->phone) || !empty($this->fax)) {
+ $phonelist = array();
+ if ($this->phone) {
+ $phonelist[] = dol_print_phone($this->phone, $this->country_code, $this->id, 0, '', ' ', 'phone');
+ }
+ if ($this->fax) {
+ $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax');
+ }
+ $datas['phonelist'] = '
'.implode(' ', $phonelist);
+ }
+
+ if (!empty($this->address)) {
+ $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country
+ } elseif (!empty($this->country_code)) {
+ $datas['address'] = '
'.$langs->trans('Country').': '.$this->country_code;
+ }
+ if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) {
+ $datas['vatintra'] = '
'.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra);
+ }
+
+ if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) {
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') {
+ $datas['profid1'] = '
'.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1;
+ }
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') {
+ $datas['profid2'] = '
'.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2;
+ }
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') {
+ $datas['profid3'] = '
'.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3;
+ }
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') {
+ $datas['profid4'] = '
'.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4;
+ }
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') {
+ $datas['profid5'] = '
'.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5;
+ }
+ if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') {
+ $datas['profid6'] = '
'.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6;
+ }
+ }
+ if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) {
+ $datas['customercode'] = '
'.$langs->trans('CustomerCode').': '.$this->code_client;
+ }
+ if (!empty($this->code_fournisseur) && $this->fournisseur) {
+ $datas['suppliercode'] = '
'.$langs->trans('SupplierCode').': '.$this->code_fournisseur;
+ }
+ if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) {
+ $datas['accountancycustomercode'] = '
'.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client);
+ }
+ if (isModEnabled('accounting') && $this->fournisseur) {
+ $datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur;
+ }
+
+ $datas['divclose'] = '
';
+
+ return $datas;
+ }
/**
* Return a link on thirdparty (with picto)
@@ -2652,122 +2784,45 @@ class Societe extends CommonObject
$name .= ' ('.$this->name_alias.')';
}
- $result = ''; $label = ''; $label2 = '';
- $linkstart = ''; $linkend = '';
-
- if (!empty($this->logo) && class_exists('Form')) {
- $label .= '';
- $label .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
- $label .= '
';
- //$label .= '';
- } elseif (!empty($this->logo_squarred) && class_exists('Form')) {
- /*$label.= '';
- $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip.
- $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 .= '';
+ $label = implode($this->getTooltipContentArray($params));
+ $linkstart = '';
+ $linkend = '';
if ($option == 'customer' || $option == 'compta' || $option == 'category') {
- $label .= img_picto('', $this->picto).'
'.$langs->trans("Customer").'';
$linkstart = '
'.$langs->trans("Prospect").'';
$linkstart = ''.$langs->trans("Supplier").'';
$linkstart = ''.$langs->trans("ThirdParty").'';
$linkstart = ''.$langs->trans("ThirdParty").'';
$linkstart = ''.$langs->trans("ThirdParty").'';
$linkstart = ''.$langs->trans("ThirdParty").'';
$linkstart = ''.$langs->trans("ThirdParty").'';
$linkstart = ''.$langs->trans("ThirdParty").'';
$linkstart = 'email;
- }
- if (!empty($this->phone) || !empty($this->fax)) {
- $phonelist = array();
- if ($this->phone) {
- $phonelist[] = dol_print_phone($this->phone, $this->country_code, $this->id, 0, '', ' ', 'phone');
- }
- if ($this->fax) {
- $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax');
- }
- $label .= '
'.implode(' ', $phonelist);
- }
-
- if (!empty($this->address)) {
- $label2 .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country
- } elseif (!empty($this->country_code)) {
- $label2 .= '
'.$langs->trans('Country').': '.$this->country_code;
- }
- if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) {
- $label2 .= '
'.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra);
- }
-
- if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) {
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') {
- $label2 .= '
'.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1;
- }
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') {
- $label2 .= '
'.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2;
- }
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') {
- $label2 .= '
'.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3;
- }
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') {
- $label2 .= '
'.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4;
- }
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') {
- $label2 .= '
'.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5;
- }
- if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') {
- $label2 .= '
'.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6;
- }
- }
- if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) {
- $label2 .= '
'.$langs->trans('CustomerCode').': '.$this->code_client;
- }
- if (!empty($this->code_fournisseur) && $this->fournisseur) {
- $label2 .= '
'.$langs->trans('SupplierCode').': '.$this->code_fournisseur;
- }
- if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) {
- $label2 .= '
'.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client);
- }
- if (isModEnabled('accounting') && $this->fournisseur) {
- $label2 .= '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur;
- }
- $label .= ($label2 ? '
'.$label2 : '').' ';
// Add type of canvas
$linkstart .= (!empty($this->canvas) ? '&canvas='.$this->canvas : '');
@@ -2788,7 +2843,7 @@ class Societe extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip refurl valignmiddle"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.' refurl valignmiddle"';
$target_value = array('_self', '_blank', '_parent', '_top');
if (in_array($target, $target_value)) {
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
@@ -2807,7 +2862,7 @@ class Societe extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php
index 09fee02c8a3..a10fee1666e 100644
--- a/htdocs/societe/class/societeaccount.class.php
+++ b/htdocs/societe/class/societeaccount.class.php
@@ -362,6 +362,27 @@ class SocieteAccount extends CommonObject
return $this->deleteCommon($user, $notrigger);
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $langs->loadLangs(['companies, commercial']);
+
+ $datas = [];
+ $option = $params['option'] ?? '';
+
+ $datas['picto'] = ''.$langs->trans("WebsiteAccount").'';
+ $datas['login'] = '
'.$langs->trans('Login').': '.$this->login;
+
+ return $datas;
+ }
+
/**
* Return a link to the object card (with optionaly the picto)
*
@@ -405,13 +426,25 @@ class SocieteAccount 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)) {
$label = $langs->trans("WebsiteAccount");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -422,7 +455,7 @@ class SocieteAccount extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 55f2eab63d9..6d7d7bc3720 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -13,7 +13,7 @@
* Copyright (C) 2014 Marcos García
* Copyright (C) 2016 Ferran Marcet
* Copyright (C) 2018 Nicolas ZABOURI
- * Copyright (C) 2019-2022 Frédéric France
+ * Copyright (C) 2019-2023 Frédéric France
* Copyright (C) 2020 Tobias Sekan
* Copyright (C) 2022 Gauthier VERDOL
*
@@ -2468,6 +2468,46 @@ class SupplierProposal extends CommonObject
}
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $menumanager;
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ return ['optimize' => $langs->trans("ShowSupplierProposal")];
+ }
+
+ $option = $params['option'] ?? '';
+ $datas = [];
+
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("SupplierProposal").'';
+ if (isset($this->status)) {
+ $datas['picto'] .= ' '.$this->getLibStatut(5);
+ }
+ if (!empty($this->ref)) {
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->ref_fourn)) {
+ $datas['ref_supplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_fourn;
+ }
+ if (!empty($this->total_ht)) {
+ $datas['amount_ht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_tva)) {
+ $datas['amount_vat'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+ if (!empty($this->total_ttc)) {
+ $datas['amount_ttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ }
+
+ return $datas;
+ }
+
/**
* Return clicable link of object (with eventually picto)
*
@@ -2489,26 +2529,20 @@ class SupplierProposal extends CommonObject
$url = '';
$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 = img_picto('', $this->picto).' '.$langs->trans("SupplierProposal").'';
- if (isset($this->status)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- if (!empty($this->ref)) {
- $label .= '
'.$langs->trans('Ref').': '.$this->ref;
- }
- if (!empty($this->ref_fourn)) {
- $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_fourn;
- }
- if (!empty($this->total_ht)) {
- $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_tva)) {
- $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- }
- if (!empty($this->total_ttc)) {
- $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- }
+ $label = implode($this->getTooltipContentArray($params));
if ($option == '') {
$url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id.$get_params;
@@ -2534,8 +2568,8 @@ class SupplierProposal extends CommonObject
$label = $langs->trans("ShowSupplierProposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.'"';
}
$linkstart = 'picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index ba8590dc8a5..1034ced1a95 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1420,6 +1420,34 @@ class Ticket extends CommonObject
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params);
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $langs;
+
+ $langs->load('ticket');
+
+ $datas = [];
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").'';
+ $datas['picto'] .= ' '.$this->getLibStatut(4);
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ $datas['track_id'] = '
'.$langs->trans('TicketTrackId').': '.$this->track_id;
+ $datas['subject'] = '
'.$langs->trans('Subject').': '.$this->subject;
+ if ($this->date_creation) {
+ $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.$this->date_creation;
+ }
+ if ($this->date_modification) {
+ $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.$this->date_modification;
+ }
+
+ return $datas;
+ }
/**
* Return a link to the object card (with optionaly the picto)
@@ -1443,18 +1471,19 @@ class Ticket extends CommonObject
$result = '';
- $label = img_picto('', $this->picto).' '.$langs->trans("Ticket").'';
- $label .= ' '.$this->getLibStatut(4);
- $label .= '
';
- $label .= ''.$langs->trans('Ref').': '.$this->ref.'
';
- $label .= ''.$langs->trans('TicketTrackId').': '.$this->track_id.'
';
- $label .= ''.$langs->trans('Subject').': '.$this->subject;
- if ($this->date_creation) {
- $label .= '
'.$langs->trans('DateCreation').': '.$this->date_creation;
- }
- if ($this->date_modification) {
- $label .= '
'.$langs->trans('DateModification').': '.$this->date_modification;
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ ];
+ $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));
+
$url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id;
if ($option != 'nolink') {
@@ -1474,8 +1503,8 @@ class Ticket extends CommonObject
$label = $langs->trans("ShowTicket");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -1486,7 +1515,7 @@ class Ticket extends CommonObject
$result .= $linkstart;
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 964f4b9a67f..b3d83ddb239 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
-if (!empty($conf->ldap->enabled)) {
+if (isModEnabled('ldap')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
}
if (isModEnabled('adherent')) {
@@ -785,7 +785,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print "
";
- if (!empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
+ if (isModEnabled('ldap') && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
// Show form to add an account from LDAP if sync LDAP -> Dolibarr is set
$ldap = new Ldap();
$result = $ldap->connect_bind();
@@ -1375,7 +1375,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Connexion ldap
// pour recuperer passDoNotExpire et userChangePassNextLogon
- if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
+ if (isModEnabled('ldap') && !empty($object->ldap_sid)) {
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0) {
@@ -2896,7 +2896,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print ' ';
}
- if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
+ if (isModEnabled('ldap') && !empty($object->ldap_sid)) {
$ldap->unbind();
}
}
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 1f3b67a3a60..ff92cc54ede 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -2727,6 +2727,99 @@ class User extends CommonObject
return $result;
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $menumanager;
+
+ $infologin = $params['infologin'] ?? 0;
+ $option = $params['option'] ?? '';
+
+ $datas = [];
+ if (!empty($this->photo)) {
+ $photo = '';
+ $photo .= 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
+ $photo .= '
';
+ $datas['photo'] = $photo;
+ //$label .= '';
+ }
+
+ // Info Login
+ $datas['opendiv'] = '';
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("User").' '.$this->getLibStatut(4);
+ $datas['name'] = '
'.$langs->trans('Name').': '.dol_string_nohtmltag($this->getFullName($langs, ''));
+ if (!empty($this->login)) {
+ $datas['login'] = '
'.$langs->trans('Login').': '.dol_string_nohtmltag($this->login);
+ }
+ if (!empty($this->job)) {
+ $datas['job'] = '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job);
+ }
+ $datas['email'] = '
'.$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');
+ }
+ $datas['phones'] = '
'.$langs->trans('Phone').': '.implode(' ', $phonelist);
+ }
+ if (!empty($this->admin)) {
+ $datas['administrator'] = '
'.$langs->trans("Administrator").': '.yn($this->admin);
+ }
+ if (!empty($this->accountancy_code) || $option == 'accountancy') {
+ $datas['accountancycode'] = '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code;
+ }
+ $company = '';
+ if (!empty($this->socid)) { // Add thirdparty for external users
+ $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"));
+ $datas['type'] = '
'.$langs->trans("Type").': '.$type;
+ $datas['closediv'] = '
';
+ if ($infologin > 0) {
+ $datas['newlinelogin'] = '
';
+ $datas['session'] = '
'.$langs->trans("Session").'';
+ $datas['ip'] = '
'.$langs->trans("IPAddress").': '.dol_string_nohtmltag(getUserRemoteIP());
+ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) {
+ $datas['multicompany'] = '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (User entity '.$this->entity.')';
+ }
+ $datas['authentication'] = '
'.$langs->trans("AuthenticationMode").': '.dol_string_nohtmltag($_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'));
+ $datas['connectedsince'] = '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
+ $datas['previousconnexion'] = '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
+ $datas['currenttheme'] = '
'.$langs->trans("CurrentTheme").': '.dol_string_nohtmltag($conf->theme);
+ $datas['currentmenumanager'] = '
'.$langs->trans("CurrentMenuManager").': '.dol_string_nohtmltag($menumanager->name);
+ $s = picto_from_langcode($langs->getDefaultLang());
+ $datas['currentuserlang'] = '
'.$langs->trans("CurrentUserLanguage").': '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang());
+ $datas['browser'] = '
'.$langs->trans("Browser").': '.dol_string_nohtmltag($conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')');
+ $datas['layout'] = '
'.$langs->trans("Layout").': '.dol_string_nohtmltag($conf->browser->layout);
+ $datas['screen'] = '
'.$langs->trans("Screen").': '.dol_string_nohtmltag($_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']);
+ if ($conf->browser->layout == 'phone') {
+ $datas['phone'] = '
'.$langs->trans("Phone").': '.$langs->trans("Yes");
+ }
+ if (!empty($_SESSION["disablemodules"])) {
+ $datas['disabledmodules'] = '
'.$langs->trans("DisabledModules").':
'.dol_string_nohtmltag(join(', ', explode(',', $_SESSION["disablemodules"])));
+ }
+ }
+
+ return $datas;
+ }
+
/**
* Return a HTML link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
@@ -2756,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 = '';
}
@@ -2861,7 +2902,7 @@ class User extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}
$linkstart .= $linkclose.'>';
@@ -2876,7 +2917,7 @@ class User extends CommonObject
}
// Only picto
if ($withpictoimg > 0) {
- $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'';
+ $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams.' class="paddingright '.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1).'';
} else {
// Picto must be a photo
$picto = ''.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).'';
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index 250fec08c30..04554b282d0 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -7,6 +7,7 @@
* Copyright (C) 2014 Alexis Algoud
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2019 Abbes Bahfir
+ * Copyright (C) 2023 Frédéric France
*
* 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
@@ -28,7 +29,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
-if (!empty($conf->ldap->enabled)) {
+if (isModEnabled('ldap')) {
require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
}
@@ -104,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(
@@ -718,6 +724,33 @@ class UserGroup extends CommonObject
return '';
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $menumanager;
+
+ $option = $params['option'] ?? '';
+
+ $datas = [];
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ $langs->load("users");
+ return ['optimize' => $langs->trans("ShowGroup")];
+ }
+ $datas['divopen'] = '';
+ $datas['picto'] = img_picto('', 'group').' '.$langs->trans("Group").'
';
+ $datas['name'] = ''.$langs->trans('Name').': '.$this->name;
+ $datas['description'] = '
'.$langs->trans("Description").': '.$this->note;
+ $datas['divclose'] = '
';
+
+ return $datas;
+ }
+
/**
* Return a link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
@@ -739,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;
@@ -772,7 +812,7 @@ class UserGroup extends CommonObject
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}
$linkstart = 'picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.'class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->name;
diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php
index 96054b0d802..4d0702aeb74 100644
--- a/htdocs/user/passwordforgotten.php
+++ b/htdocs/user/passwordforgotten.php
@@ -30,7 +30,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-if (!empty($conf->ldap->enabled)) {
+if (isModEnabled('ldap')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
}
diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php
index ac51aeae1d2..3adf2f3cd8a 100644
--- a/htdocs/workstation/class/workstation.class.php
+++ b/htdocs/workstation/class/workstation.class.php
@@ -683,6 +683,29 @@ class Workstation extends CommonObject
return $this->setStatusCommon($user, self::STATUS_DISABLED, $notrigger, 'WORKSTATION_DISABLED');
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs;
+
+ $langs->load('holiday');
+
+ $datas = [];
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Workstation").'';
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ if (isset($this->status)) {
+ $datas['status'] = '
'.$langs->trans("Status").": ".$this->getLibStatut(5);
+ }
+
+ return $datas;
+ }
+
/**
* Return a link to the object card (with optionaly the picto)
*
@@ -703,12 +726,18 @@ class Workstation extends CommonObject
$result = '';
- $label = img_picto('', $this->picto).' '.$langs->trans("Workstation").'';
- $label .= '
';
- $label .= ''.$langs->trans('Ref').': '.$this->ref;
- if (isset($this->status)) {
- $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5);
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ ];
+ $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));
$url = dol_buildpath('/workstation/workstation_card.php', 1).'?id='.$this->id;
@@ -729,8 +758,8 @@ class Workstation extends CommonObject
$label = $langs->trans("ShowWorkstation");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -743,7 +772,7 @@ class Workstation extends CommonObject
if (empty($this->showphoto_on_popup)) {
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'mrp'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'mrp'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
} else {
if ($withpicto) {
diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php
index 1d57db17ffc..ec419ad9987 100644
--- a/test/phpunit/AllTests.php
+++ b/test/phpunit/AllTests.php
@@ -41,7 +41,7 @@ if (empty($conf->adherent->enabled)) {
print "Error: Module member must be enabled to have significant results.\n";
exit(1);
}
-if (!empty($conf->ldap->enabled)) {
+if (isModEnabled('ldap')) {
print "Error: LDAP module should not be enabled.\n";
exit(1);
}