diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e144677832f..b72767fdcc4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 JC Prieto - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2023 Frédéric France * * 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).' '.$langs->trans("BankAccount").''; + if (isset($this->status)) { + $pictos .= ' '.$this->getLibStatut(5); + } + $datas['picto'] = $pictos; + $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; + $datas['accountnumber'] = '
'.$langs->trans('AccountNumber').': '.$this->number; + $datas['iban'] = '
'.$langs->trans('IBAN').': '.getIbanHumanReadable($this); + $datas['bic'] = '
'.$langs->trans('BIC').': '.$this->bic; + $datas['accountcurrency'] = '
'.$langs->trans("AccountCurrency").': '.$this->currency_code; + + if (isModEnabled('accounting')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $langs->load("accountancy"); + $datas['accountaccounting'] = '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); + $datas['accountancyjournal'] = '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; + } + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -1403,8 +1437,17 @@ class Account extends CommonObject $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); $label .= '
'.$langs->trans('AccountancyJournal').': '.$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') { diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index e52d3cfd3d9..2656a788631 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -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."
"; if (isModEnabled($module)) { $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');