From 45d4e3faaa14eec100ebab259966748fe80d0a0f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 10 May 2025 16:29:32 +0200 Subject: [PATCH] Better tooltips. --- htdocs/accountancy/admin/index.php | 21 ++++++++++--------- htdocs/core/class/html.formsetup.class.php | 2 +- htdocs/langs/en_US/accountancy.lang | 3 ++- htdocs/modulebuilder/template/admin/setup.php | 1 + 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 570cf612c61..efd12eaeeeb 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -67,20 +67,21 @@ $nbletter = GETPOSTINT('ACCOUNTING_LETTERING_NBLETTERS'); $formSetup = new FormSetup($db); // Main options -$formSetup->newItem('BANK_DISABLE_DIRECT_INPUT') - ->setAsYesNo(); -$formSetup->newItem('ACCOUNTANCY_COMBO_FOR_AUX') - ->setAsYesNo(); -$formSetup->newItem('ACCOUNTING_MANAGE_ZERO') - ->setAsYesNo(); +$formSetup->newItem('BANK_DISABLE_DIRECT_INPUT')->setAsYesNo(); + +$formSetup->newItem('ACCOUNTANCY_COMBO_FOR_AUX')->setAsYesNo(); + +$item = $formSetup->newItem('ACCOUNTING_MANAGE_ZERO')->setAsYesNo(); +$item->helpText = $langs->trans('ACCOUNTING_MANAGE_ZERO2'); +$item->fieldParams['helpText'] = 'noclick'; + + if (!getDolGlobalInt('ACCOUNTING_MANAGE_ZERO')) { - $item = $formSetup->newItem('ACCOUNTING_LENGTH_GACCOUNT') - ->setAsString(); + $item = $formSetup->newItem('ACCOUNTING_LENGTH_GACCOUNT')->setAsString(); $item->fieldAttr['type'] = 'number'; $item->fieldAttr['class'] = 'maxwidth50 right'; - $item = $formSetup->newItem('ACCOUNTING_LENGTH_AACCOUNT') - ->setAsString(); + $item = $formSetup->newItem('ACCOUNTING_LENGTH_AACCOUNT')->setAsString(); $item->fieldAttr['type'] = 'number'; $item->fieldAttr['class'] = 'maxwidth50 right'; } diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index f1e60578050..bb7fd3a6d6a 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -332,7 +332,7 @@ class FormSetup $out .= ''; $out .= ''; - $out .= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey); + $out .= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, empty($item->fieldParams['helpText']) ? 'tootips'.$item->confKey : ($item->fieldParams['helpText'] != 'noclick' ? $item->fieldParams['helpText'] : '')); $out .= ''; $out .= ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 87a6fed0358..4e61bee53ee 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -161,7 +161,8 @@ ACCOUNTING_LENGTH_DESCRIPTION=Truncate product & services description in listing ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Truncate product & services account description form in listings after x chars (Best = 50) ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts (If you set value to 6 here, the account '706' will appear like '706000' on screen) ACCOUNTING_LENGTH_AACCOUNT=Length of the third-party accounting accounts (If you set value to 6 here, the account '401' will appear like '401000' on screen) -ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account. Needed by some countries (like Switzerland). If set to off (default), you can set the following two parameters to ask the application to add virtual zeros. +ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account instead of a fixed length account. +ACCOUNTING_MANAGE_ZERO2=Needed by some countries (like Switzerland). If kept to off (default), you can set the following two parameters to ask the application to add virtual zeros. ACCOUNTING_BANK_CONCILIATED=Transfer into accounting only the lines reconciliated in bank statements (by default, could be unchecked on each transfer) BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTANCY_ER_DATE_RECORD=Use the end date of the period of an expense report as the date for the transfer to accounting, instead of the date of the expense diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 89acbc262da..478b1babd2b 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -120,6 +120,7 @@ $item->cssClass = 'minwidth500'; $item = $formSetup->newItem('MYMODULE_MYPARAM2'); $item->defaultFieldValue = 'default value'; $item->fieldAttr['placeholder'] = 'A placeholder here'; +$item->helpText = 'Tooltip text'; // Setup conf for selection of a simple textarea input but we replace the text of field title $item = $formSetup->newItem('MYMODULE_MYPARAM3');