From b93b9a784c2c274fe05cd3756412a8e6cc507e40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 May 2022 00:30:35 +0200 Subject: [PATCH] Trans --- htdocs/admin/dict.php | 24 ++++++++++++++---------- htdocs/core/lib/functions.lib.php | 24 +++++++++++++++++------- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/societe/list.php | 3 ++- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 00eebf78f10..796e64223c4 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1490,11 +1490,13 @@ if ($id > 0) { } if ($valuetoshow != '') { + $tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : ''); + $tdsoffields .= ''; - if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { - $tdsoffields .= ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; - } elseif (!empty($tabhelp[$id][$value])) { - $tdsoffields .= $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); + if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) { + $tdsoffields .= ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; + } elseif ($tooltiphelp) { + $tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp); } else { $tdsoffields .= $valuetoshow; } @@ -1643,8 +1645,8 @@ if ($id > 0) { continue; } - if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabhelp[$id][$value])) { - $tabhelp[$id][$value] = $langs->trans('LabelUsedByDefault'); + if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabcomplete[$tabname[$id]]['help'][$value])) { + $tabcomplete[$tabname[$id]]['help'][$value] = $langs->trans('LabelUsedByDefault'); } // Determines the name of the field in relation to the possible names @@ -1850,10 +1852,12 @@ if ($id > 0) { // Show field title if ($showfield) { - if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { - $newvaluetoshow = ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; - } elseif (!empty($tabhelp[$id][$value])) { - $newvaluetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); + $tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : ''); + + if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) { + $newvaluetoshow = ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; + } elseif ($tooltiphelp) { + $newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp); } else { $newvaluetoshow = $valuetoshow; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7b343bcdfee..978d385fcda 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3768,6 +3768,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2) { global $conf, $langs; + // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto $url = DOL_URL_ROOT; $theme = isset($conf->theme) ? $conf->theme : null; @@ -3786,15 +3787,25 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ } } else { $pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); + $pictowithouttext = str_replace('object_', '', $pictowithouttext); - if (strpos($pictowithouttext, 'fontawesome_') !== false) { - $pictowithouttext = explode('_', $pictowithouttext); + if (strpos($pictowithouttext, 'fontawesome_') !== false || preg_match('/^fa-/', $pictowithouttext)) { + // This is a font awesome image 'fonwtawesome_xxx' or 'fa-xxx' + $pictowithouttext = str_replace('fa-', '', $pictowithouttext); + $pictowithouttextarray = explode('_', $pictowithouttext); $marginleftonlyshort = 0; - $fakey = 'fa-'.$pictowithouttext[1]; - $fa = $pictowithouttext[2] ? $pictowithouttext[2] : 'fa'; - $facolor = $pictowithouttext[3] ? $pictowithouttext[3] : ''; - $fasize = $pictowithouttext[4] ? $pictowithouttext[4] : ''; + if (!empty($pictowithouttextarray[1])) { + $fakey = 'fa-'.$pictowithouttextarray[1]; + $fa = empty($pictowithouttextarray[2]) ? 'fa' : $pictowithouttextarray[2]; + $facolor = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3]; + $fasize = empty($pictowithouttextarray[4]) ? '' : $pictowithouttextarray[4]; + } else { + $fakey = 'fa-'.$pictowithouttext; + $fa = 'fa'; + $facolor = ''; + $fasize = ''; + } // This snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only. // class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes. @@ -3820,7 +3831,6 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ return $enabledisablehtml; } - $pictowithouttext = str_replace('object_', '', $pictowithouttext); if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d36dbfd7733..808049978eb 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1949,7 +1949,7 @@ EnterAnyCode=This field contains a reference to identify the line. Enter any val Enter0or1=Enter 0 or 1 UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For example: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364] ColorFormat=The RGB color is in HEX format, eg: FF0000 -PictoHelp=Icon name in dolibarr format ('image.png' if into the current theme directory, 'image.png@nom_du_module' if into the directory /img/ of a module) +PictoHelp=Icon name in format:
- image.png for an image file into the current theme directory
- image.png@module if file is into the directory /img/ of a module
- fa-xxx for a FontAwesome fa-xxx picto
- fonwtawesome_xxx_fa_color_size for a FontAwesome fa-xxx picto (with prefix, color and size set) PositionIntoComboList=Position of line into combo lists SellTaxRate=Sales tax rate RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases. @@ -2262,3 +2262,4 @@ IconOnlyTextOnHover=Icon only - Text of icon appears under icon on mouse hover t IconOnly=Icon only - Text on tooltip only INVOICE_ADD_ZATCA_QR_CODE=Show the ZATCA QR code on invoices INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their invoices +UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID. \ No newline at end of file diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index c2ad5852842..a92ca5ed11c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1677,7 +1677,8 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['s.fk_stcomm']['checked'])) { // Prospect status print '
'; - print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); + print '
'; + print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); print '
-
'; foreach ($prospectstatic->cacheprospectstatus as $key => $val) { $titlealt = 'default';