diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b22424d1171..f1b83861ef5 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -593,6 +593,11 @@ abstract class CommonObject
protected $labelStatus;
protected $labelStatusShort;
+ /**
+ * @var int showphoto_on_popup
+ */
+ public $showphoto_on_popup;
+
/**
* @var array nb used in load_stateboard
*/
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) {