add ajax tooltip on invoices
This commit is contained in:
parent
b7b4737ef8
commit
1e0125540a
@ -1766,6 +1766,71 @@ class Facture extends CommonInvoice
|
|||||||
return $deposit;
|
return $deposit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getTooltipContentArray
|
||||||
|
*
|
||||||
|
* @param array $params ex option, infologin
|
||||||
|
* @since v18
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getTooltipContentArray($params)
|
||||||
|
{
|
||||||
|
global $conf, $langs, $mysoc, $user;
|
||||||
|
|
||||||
|
$langs->load('bills');
|
||||||
|
|
||||||
|
$datas = [];
|
||||||
|
$moretitle = $params['moretitle'] ?? '';
|
||||||
|
$picto = $this->picto;
|
||||||
|
if ($this->type == self::TYPE_REPLACEMENT) {
|
||||||
|
$picto .= 'r'; // Replacement invoice
|
||||||
|
}
|
||||||
|
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
||||||
|
$picto .= 'a'; // Credit note
|
||||||
|
}
|
||||||
|
if ($this->type == self::TYPE_DEPOSIT) {
|
||||||
|
$picto .= 'd'; // Deposit invoice
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->hasRight("facture", "read")) {
|
||||||
|
$datas['picto'] = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->trans("Invoice").'</u>';
|
||||||
|
if (isset($this->statut) && isset($this->alreadypaid)) {
|
||||||
|
$datas['picto'] .= ' '.$this->getLibStatut(5, $this->alreadypaid);
|
||||||
|
}
|
||||||
|
$datas['picto'] .= ' '.$this->getLibType(1);
|
||||||
|
if ($moretitle) {
|
||||||
|
$datas['picto'] = ' - '.$moretitle;
|
||||||
|
}
|
||||||
|
if (!empty($this->ref)) {
|
||||||
|
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
|
}
|
||||||
|
if (!empty($this->ref_customer)) {
|
||||||
|
$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_customer;
|
||||||
|
}
|
||||||
|
if (!empty($this->date)) {
|
||||||
|
$datas['date'] = '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'day');
|
||||||
|
}
|
||||||
|
if (!empty($this->total_ht)) {
|
||||||
|
$datas['amountht'] = '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
|
if (!empty($this->total_tva)) {
|
||||||
|
$datas['amountvat'] = '<br><b>'.$langs->trans('AmountVAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
|
if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) {
|
||||||
|
// We keep test != 0 because $this->total_localtax1 can be '0.00000000'
|
||||||
|
$datas['amountlt1'] = '<br><b>'.$langs->transcountry('AmountLT1', $mysoc->country_code).':</b> '.price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
|
if (!empty($this->total_localtax2) && $this->total_localtax2 != 0) {
|
||||||
|
$datas['amountlt2'] = '<br><b>'.$langs->transcountry('AmountLT2', $mysoc->country_code).':</b> '.price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
|
if (!empty($this->total_ttc)) {
|
||||||
|
$datas['amountttc'] = '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clicable link of object (with eventually picto)
|
* Return clicable link of object (with eventually picto)
|
||||||
*
|
*
|
||||||
@ -1863,13 +1928,26 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
$linkclose = ($target ? ' target="'.$target.'"' : '');
|
$linkclose = ($target ? ' target="'.$target.'"' : '');
|
||||||
|
$classfortooltip = 'classfortooltip';
|
||||||
|
$dataparams = '';
|
||||||
|
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||||
|
$params = [
|
||||||
|
'id' => $this->id,
|
||||||
|
'objecttype' => $this->element,
|
||||||
|
'moretitle' => $moretitle,
|
||||||
|
'option' => $option,
|
||||||
|
];
|
||||||
|
$classfortooltip = 'classforajaxtooltip';
|
||||||
|
$dataparams = ' data-params='.json_encode($params);
|
||||||
|
$label = $langs->trans('Loading');
|
||||||
|
}
|
||||||
if (empty($notooltip) && $user->hasRight("facture", "read")) {
|
if (empty($notooltip) && $user->hasRight("facture", "read")) {
|
||||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
$label = $langs->trans("Invoice");
|
$label = $langs->trans("Invoice");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose .= ' class="classfortooltip"';
|
$linkclose .= ' class="'.$classfortooltip.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
@ -1883,7 +1961,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) {
|
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) {
|
if ($withpicto != 2) {
|
||||||
$result .= ($max ?dol_trunc($this->ref, $max) : $this->ref);
|
$result .= ($max ?dol_trunc($this->ref, $max) : $this->ref);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user