add ajax tooltip on account

This commit is contained in:
Frédéric FRANCE 2023-02-02 21:16:09 +01:00
parent 1e305c4f86
commit a367fd24b7
2 changed files with 52 additions and 4 deletions

View File

@ -9,7 +9,7 @@
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 JC Prieto <jcprieto@virtual20.com><prietojc@gmail.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022-2023 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -1367,6 +1367,40 @@ class Account extends CommonObject
return $nb;
}
/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
* @since v18
* @return array
*/
public function getTooltipContentArray($params)
{
global $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
$datas = [];
$pictos = img_picto('', $this->picto).' <u class="paddingrightnow">'.$langs->trans("BankAccount").'</u>';
if (isset($this->status)) {
$pictos .= ' '.$this->getLibStatut(5);
}
$datas['picto'] = $pictos;
$datas['label'] = '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
$datas['accountnumber'] = '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number;
$datas['iban'] = '<br><b>'.$langs->trans('IBAN').':</b> '.getIbanHumanReadable($this);
$datas['bic'] = '<br><b>'.$langs->trans('BIC').':</b> '.$this->bic;
$datas['accountcurrency'] = '<br><b>'.$langs->trans("AccountCurrency").':</b> '.$this->currency_code;
if (isModEnabled('accounting')) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$langs->load("accountancy");
$datas['accountaccounting'] = '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);
$datas['accountancyjournal'] = '<br><b>'.$langs->trans('AccountancyJournal').':</b> '.$this->accountancy_journal;
}
return $datas;
}
/**
* Return clicable name (with picto eventually)
*
@ -1403,8 +1437,17 @@ class Account extends CommonObject
$label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);
$label .= '<br><b>'.$langs->trans('AccountancyJournal').':</b> '.$this->accountancy_journal;
}
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$linkclose = '" data-params='.json_encode($params).' id="' . uniqid('member') . '" title="' . $langs->trans('Loading') . '"';
$linkclose .= ' class="classforajaxtooltip"';
} else {
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
}
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
if ($mode == 'transactions') {

View File

@ -75,6 +75,11 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
$classpath = 'compta/facture/class';
$module = 'facture';
$myobject = 'facture';
} elseif ($objecttype == 'bank_account') {
$langs->loadLangs(['banks', 'compta']);
$classpath = 'compta/bank/class';
$module = 'banque';
$myobject = 'account';
} elseif ($objecttype == 'commande' || $objecttype == 'order') {
$langs->load('orders');
$classpath = 'commande/class';
@ -180,7 +185,7 @@ if ($objecttype == 'invoice_supplier') {
} elseif ($objecttype == 'contact') {
$module = 'societe';
}
// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n";
// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."<br>";
if (isModEnabled($module)) {
$res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');