diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c4328328f18..dba4e0e84d6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3690,6 +3690,52 @@ class Propal extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("Proposal")]; + } + if ($user->hasRight('propal', 'lire')) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Proposal").''; + if (isset($this->statut)) { + $datas['status'] = ' '.$this->getLibStatut(5); + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['vat'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['amountttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->date)) { + $datas['date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); + } + if (!empty($this->delivery_date)) { + $datas['deliverydate'] = '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -3737,7 +3783,7 @@ class Propal extends CommonObject $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); } if (!empty($this->delivery_date)) { - $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); } if ($option == '') { @@ -3768,8 +3814,18 @@ class Propal extends CommonObject $label = $langs->trans("Proposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="propal-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } } $linkstart = '