From 61f1445fbf05cfe0c4aaf0266ef1fdc84d52d7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 11:27:31 +0200 Subject: [PATCH 1/4] fix ajax tooltip for account --- htdocs/compta/bank/class/account.class.php | 1 + htdocs/core/lib/functions.lib.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 35b9dba1e54..e8b645db7bb 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1416,6 +1416,7 @@ class Account extends CommonObject public function getTooltipContentArray($params) { global $langs; + $langs->loadLangs(['banks', 'compta']); include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; $datas = array(); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2bba488f51b..79d5f038678 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11245,7 +11245,12 @@ function getElementProperties($element_type) $subelement = 'Actioncomm'; $module = 'agenda'; } - + if ($element_type == 'bank_account') { + $classpath = 'compta/bank/class'; + $module = 'banque'; + $classfile = 'Account'; + $classname = 'Account'; + } // To work with non standard path if ($element_type == 'facture' || $element_type == 'invoice') { $classpath = 'compta/facture/class'; @@ -11361,7 +11366,6 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '') $ret = 0; $element_prop = getElementProperties($element_type); - if (is_array($element_prop) && isModEnabled($element_prop['module'])) { dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php'); From 75c29a0925eeeb0ec55d38995d9c5f6bf9ee30d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 11:33:48 +0200 Subject: [PATCH 2/4] fix ajax tooltip for warehouse --- htdocs/core/lib/functions.lib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 79d5f038678..57845360f10 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11244,12 +11244,15 @@ function getElementProperties($element_type) $classpath = 'comm/action/class'; $subelement = 'Actioncomm'; $module = 'agenda'; - } - if ($element_type == 'bank_account') { + } elseif ($element_type == 'bank_account') { $classpath = 'compta/bank/class'; $module = 'banque'; $classfile = 'Account'; $classname = 'Account'; + } elseif ($element_type == 'stock') { + $classpath = 'product/stock/class'; + $classfile = 'entrepot'; + $classname = 'Entrepot'; } // To work with non standard path if ($element_type == 'facture' || $element_type == 'invoice') { From f0b1699032e779ba4fd2dbc806ccd08167504f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 11:37:21 +0200 Subject: [PATCH 3/4] clean code --- htdocs/core/lib/functions.lib.php | 48 +++++++++++-------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 57845360f10..c764d3b8e40 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11239,7 +11239,7 @@ function getElementProperties($element_type) $subelement = $regs[2]; } - // For compat + // For compat and To work with non standard path if ($element_type == "action") { $classpath = 'comm/action/class'; $subelement = 'Actioncomm'; @@ -11253,81 +11253,65 @@ function getElementProperties($element_type) $classpath = 'product/stock/class'; $classfile = 'entrepot'; $classname = 'Entrepot'; - } - // To work with non standard path - if ($element_type == 'facture' || $element_type == 'invoice') { + } elseif ($element_type == 'facture' || $element_type == 'invoice') { $classpath = 'compta/facture/class'; $module = 'facture'; $subelement = 'facture'; - } - if ($element_type == 'commande' || $element_type == 'order') { + } elseif ($element_type == 'commande' || $element_type == 'order') { $classpath = 'commande/class'; $module = 'commande'; $subelement = 'commande'; - } - if ($element_type == 'propal') { + } elseif ($element_type == 'propal') { $classpath = 'comm/propal/class'; - } - if ($element_type == 'supplier_proposal') { + } elseif ($element_type == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; - } - if ($element_type == 'shipping') { + } elseif ($element_type == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; - } - if ($element_type == 'delivery') { + } elseif ($element_type == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note'; - } - if ($element_type == 'contract') { + } elseif ($element_type == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; $subelement = 'contrat'; - } - if ($element_type == 'member') { + } elseif ($element_type == 'member') { $classpath = 'adherents/class'; $module = 'adherent'; $subelement = 'adherent'; - } - if ($element_type == 'cabinetmed_cons') { + } elseif ($element_type == 'cabinetmed_cons') { $classpath = 'cabinetmed/class'; $module = 'cabinetmed'; $subelement = 'cabinetmedcons'; - } - if ($element_type == 'fichinter') { + } elseif ($element_type == 'fichinter') { $classpath = 'fichinter/class'; $module = 'ficheinter'; $subelement = 'fichinter'; - } - if ($element_type == 'dolresource' || $element_type == 'resource') { + } elseif ($element_type == 'dolresource' || $element_type == 'resource') { $classpath = 'resource/class'; $module = 'resource'; $subelement = 'dolresource'; - } - if ($element_type == 'propaldet') { + } elseif ($element_type == 'propaldet') { $classpath = 'comm/propal/class'; $module = 'propal'; $subelement = 'propaleligne'; - } - if ($element_type == 'order_supplier') { + } elseif ($element_type == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; $classfile = 'fournisseur.commande'; $element = 'commande'; $subelement = ''; $classname = 'CommandeFournisseur'; - } - if ($element_type == 'invoice_supplier') { + } elseif ($element_type == 'invoice_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; $classfile = 'fournisseur.facture'; $element = 'facture'; $subelement = ''; $classname = 'FactureFournisseur'; - } - if ($element_type == "service") { + } elseif ($element_type == "service") { $classpath = 'product/class'; $subelement = 'product'; } From 9632f99a548f29d841008a609fb29f46dc5a6924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 11:40:17 +0200 Subject: [PATCH 4/4] clean code --- htdocs/core/lib/functions.lib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c764d3b8e40..d83d7eee3c3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11253,6 +11253,13 @@ function getElementProperties($element_type) $classpath = 'product/stock/class'; $classfile = 'entrepot'; $classname = 'Entrepot'; + } elseif ($element_type == 'project') { + $classpath = 'projet/class'; + $module = 'projet'; + } elseif ($element_type == 'project_task') { + $classpath = 'projet/class'; + $module = 'projet'; + $subelement = 'task'; } elseif ($element_type == 'facture' || $element_type == 'invoice') { $classpath = 'compta/facture/class'; $module = 'facture';