enhance shipping tooltip

This commit is contained in:
Frédéric FRANCE 2023-02-13 23:29:10 +01:00
parent 3e91a4b1d1
commit b9243376af
3 changed files with 43 additions and 8 deletions

View File

@ -1784,6 +1784,30 @@ class Expedition extends CommonObject
}
/**
* getTooltipContentArray
*
* @param array $params ex option, infologin
* @since v18
* @return array
*/
public function getTooltipContentArray($params)
{
global $conf, $langs;
$langs->load('shipping');
$nofetch = empty($params['nofetch']) ? false : true;
$datas = [];
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Shipment").'</u>';
if (isset($this->statut)) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
return $datas;
}
/**
* Return clicable link of object (with eventually picto)
*
@ -1800,9 +1824,20 @@ class Expedition extends CommonObject
global $langs, $conf, $hookmanager;
$result = '';
$label = '<u>'.$langs->trans("Shipment").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
'nofetch' => 1,
];
$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.'/expedition/card.php?id='.$this->id;
@ -1827,8 +1862,8 @@ class Expedition extends CommonObject
$label = $langs->trans("Shipment");
$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 = '<a href="'.$url.'"';
@ -1837,7 +1872,7 @@ class Expedition extends CommonObject
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), $this->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;

View File

@ -2740,7 +2740,7 @@ class FactureFournisseur extends CommonInvoice
$alreadypaid = $this->alreadypaid;
}
$datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid);
$$datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid);
}
if ($moretitle) {
$datas['picto'] .= ' - '.$moretitle;

View File

@ -1317,7 +1317,7 @@ class Holiday extends CommonObject
if (isset($this->statut)) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
$datas['label'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
return $datas;
}