From 7f32a49121b55430e021efdf586447d0c8a95f5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Feb 2024 18:26:40 +0100 Subject: [PATCH 1/7] Fix tooltip --- htdocs/categories/class/categorie.class.php | 73 ++++++++++++++++----- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f7008dad5eb..6e88c1d2373 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1656,15 +1656,22 @@ class Categorie extends CommonObject * Return name and link of category (with picto) * Use ->id, ->ref, ->label, ->color * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option Sur quoi pointe le lien ('', 'xyz') - * @param int $maxlength Max length of text - * @param string $moreparam More param on URL link + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param string $option On what the link point to ('nolink', ...) + * @param int $maxlength Max length of text + * @param string $moreparam More param on URL link + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '') + public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = '') { - global $hookmanager; + global $conf, $hookmanager; + + if (!empty($conf->dol_no_mouse_hover)) { + $notooltip = 1; // Force disable tooltips + } $result = ''; $params = [ @@ -1682,6 +1689,19 @@ class Categorie extends CommonObject $label = implode($this->getTooltipContentArray($params)); } + $url = DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : '')); + + if ($option !== 'nolink') { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { + $add_save_lastsearch_values = 1; + } + if ($url && $add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } + } + // Check contrast with background and correct text color $forced_color = 'categtextwhite'; if ($this->color) { @@ -1689,24 +1709,43 @@ class Categorie extends CommonObject $forced_color = 'categtextblack'; } } - $link = ''; - $linkend = ''; - $picto = 'category'; + $linkclose = ''; + if (empty($notooltip)) { + if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { + $label = $langs->trans("ShowMyObject"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.' '.$forced_color.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose = ($morecss ? ' class="'.$forced_color.($morecss ? ' '.$morecss : '').'"' : ''); + } + if ($option == 'nolink' || empty($url)) { + $linkstart = ''; + if ($option == 'nolink' || empty($url)) { + $linkend = ''; + } else { + $linkend = ''; + } + + $result .= $linkstart; if ($withpicto) { - $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend); - } - if ($withpicto && $withpicto != 2) { - $result .= ' '; + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"'), 0, 0, $notooltip ? 0 : 1); } + if ($withpicto != 2) { - $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; + $result .= dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength); } + + $result .= $linkend; + global $action; $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); From 1c0068c24830dce11e24df1d74a8fd42e38e8d73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Feb 2024 18:27:10 +0100 Subject: [PATCH 2/7] Doc --- htdocs/core/lib/treeview.lib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index d679d230566..cebe8b34b8a 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -170,6 +170,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print $tab[$x]['buttons']; print ''; } else { + // Show the badge with color for the category print $tab[$x]['entry']; } //print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'
'."\n"; @@ -193,9 +194,11 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset if ($showfk) { print ''; print ''; print ''; + // Add column counter $entry .= $counter; $entry .= '
'; - print ''; + print ''; + print ''; print $tab[$x]['title']; - print ''; + print ''; + print ''; print '(mainmenu='.$tab[$x]['mainmenu'].' - leftmenu='.$tab[$x]['leftmenu'].', fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; print ''; From c95c16dda0b9ce13560bcd04acdacdc431f3a56e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Feb 2024 22:20:50 +0100 Subject: [PATCH 3/7] Comment --- htdocs/categories/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 6e99bea3958..eb322bbeb3f 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -204,6 +204,7 @@ foreach ($fulltree as $key => $val) { $entry .= ''.$li.''; $entry .= ''; From 926462e2186291b7360ac4ee62c1272a9010e08f Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Sun, 18 Feb 2024 22:56:19 +0100 Subject: [PATCH 4/7] FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211) --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2d0291e1bd3..cd9f44130b9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5938,9 +5938,9 @@ class Form print ''; } else { if (!empty($rate)) { - print price($rate, 1, $langs, 1, 0); + print price($rate, 1, $langs, 0, 0); if ($currency && $rate != 1) { - print '   (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; + print '   (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; } } else { print 1; From aa068bd0a0d39a9e4608946d0c0c515f168c8918 Mon Sep 17 00:00:00 2001 From: atm-sami <139965072+atm-sami@users.noreply.github.com> Date: Mon, 19 Feb 2024 09:35:59 +0100 Subject: [PATCH 5/7] 18.0 FIX multiplication error (#28266) * add new hook context for mo production card * remove consumed and produced line when we clone mo * Fix multiplication error in actions_addupdatedelete.inc.php --- htdocs/core/actions_addupdatedelete.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 086b37aa501..25458a612e5 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -95,7 +95,9 @@ if ($action == 'add' && !empty($permissiontoadd)) { } elseif ($object->fields[$key]['type'] == 'datetime') { $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel'); } elseif ($object->fields[$key]['type'] == 'duration') { - $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int'); + $hour = intval(GETPOST($key.'hour', 'int')); + $min = intval(GETPOST($key.'min', 'int')); + $value = 60 * 60 * $hour + 60 * $min; } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup } elseif ($object->fields[$key]['type'] == 'boolean') { From 1ec1704de9af0ccb9c47863915f6036145b6a89b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Feb 2024 22:39:31 +0100 Subject: [PATCH 6/7] FIX Picto for mime --- htdocs/core/lib/functions.lib.php | 122 +++++++++++++++--------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 393755f39d2..76b8ee3387d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10887,229 +10887,229 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) if (preg_match('/\.txt$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.rtx$/i', $tmpfile)) { $mime = 'text/richtext'; $imgmime = 'text.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.csv$/i', $tmpfile)) { $mime = 'text/csv'; $imgmime = 'text.png'; - $famime = 'file-text-o'; + $famime = 'file-csv'; } elseif (preg_match('/\.tsv$/i', $tmpfile)) { $mime = 'text/tab-separated-values'; $imgmime = 'text.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.ini$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'ini'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.md$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'md'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.css$/i', $tmpfile)) { $mime = 'text/css'; $imgmime = 'css.png'; $srclang = 'css'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.lang$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'lang'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { // Certificate files $mime = 'text/plain'; $imgmime = 'text.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { // XML based (HTML/XML/XAML) $mime = 'text/html'; $imgmime = 'html.png'; $srclang = 'html'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) { $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xml'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.xaml$/i', $tmpfile)) { $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xaml'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.bas$/i', $tmpfile)) { // Languages $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'bas'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.(c)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'c'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.(cpp)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cpp'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.cs$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cs'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.(h)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'h'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.(java|jsp)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'java'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.phtml$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.(pl|pm)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'pl.png'; $srclang = 'perl'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.sql$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'sql'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.js$/i', $tmpfile)) { $mime = 'text/x-javascript'; $imgmime = 'jscript.png'; $srclang = 'js'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.odp$/i', $tmpfile)) { // Open office $mime = 'application/vnd.oasis.opendocument.presentation'; $imgmime = 'ooffice.png'; - $famime = 'file-powerpoint-o'; + $famime = 'file-powerpoint'; } elseif (preg_match('/\.ods$/i', $tmpfile)) { $mime = 'application/vnd.oasis.opendocument.spreadsheet'; $imgmime = 'ooffice.png'; - $famime = 'file-excel-o'; + $famime = 'file-excel'; } elseif (preg_match('/\.odt$/i', $tmpfile)) { $mime = 'application/vnd.oasis.opendocument.text'; $imgmime = 'ooffice.png'; - $famime = 'file-word-o'; + $famime = 'file-word'; } elseif (preg_match('/\.mdb$/i', $tmpfile)) { // MS Office $mime = 'application/msaccess'; $imgmime = 'mdb.png'; - $famime = 'file-o'; + $famime = 'file'; } elseif (preg_match('/\.doc[xm]?$/i', $tmpfile)) { $mime = 'application/msword'; $imgmime = 'doc.png'; - $famime = 'file-word-o'; + $famime = 'file-word'; } elseif (preg_match('/\.dot[xm]?$/i', $tmpfile)) { $mime = 'application/msword'; $imgmime = 'doc.png'; - $famime = 'file-word-o'; + $famime = 'file-word'; } elseif (preg_match('/\.xlt(x)?$/i', $tmpfile)) { $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; - $famime = 'file-excel-o'; + $famime = 'file-excel'; } elseif (preg_match('/\.xla(m)?$/i', $tmpfile)) { $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; - $famime = 'file-excel-o'; + $famime = 'file-excel'; } elseif (preg_match('/\.xls$/i', $tmpfile)) { $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; - $famime = 'file-excel-o'; + $famime = 'file-excel'; } elseif (preg_match('/\.xls[bmx]$/i', $tmpfile)) { $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime = 'xls.png'; - $famime = 'file-excel-o'; + $famime = 'file-excel'; } elseif (preg_match('/\.pps[mx]?$/i', $tmpfile)) { $mime = 'application/vnd.ms-powerpoint'; $imgmime = 'ppt.png'; - $famime = 'file-powerpoint-o'; + $famime = 'file-powerpoint'; } elseif (preg_match('/\.ppt[mx]?$/i', $tmpfile)) { $mime = 'application/x-mspowerpoint'; $imgmime = 'ppt.png'; - $famime = 'file-powerpoint-o'; + $famime = 'file-powerpoint'; } elseif (preg_match('/\.pdf$/i', $tmpfile)) { // Other $mime = 'application/pdf'; $imgmime = 'pdf.png'; - $famime = 'file-pdf-o'; + $famime = 'file-pdf'; } elseif (preg_match('/\.bat$/i', $tmpfile)) { // Scripts $mime = 'text/x-bat'; $imgmime = 'script.png'; $srclang = 'dos'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.sh$/i', $tmpfile)) { $mime = 'text/x-sh'; $imgmime = 'script.png'; $srclang = 'bash'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.ksh$/i', $tmpfile)) { $mime = 'text/x-ksh'; $imgmime = 'script.png'; $srclang = 'bash'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.bash$/i', $tmpfile)) { $mime = 'text/x-bash'; $imgmime = 'script.png'; $srclang = 'bash'; - $famime = 'file-code-o'; + $famime = 'file-code'; } elseif (preg_match('/\.ico$/i', $tmpfile)) { // Images $mime = 'image/x-icon'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.(jpg|jpeg)$/i', $tmpfile)) { $mime = 'image/jpeg'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.png$/i', $tmpfile)) { $mime = 'image/png'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.gif$/i', $tmpfile)) { $mime = 'image/gif'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.bmp$/i', $tmpfile)) { $mime = 'image/bmp'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.(tif|tiff)$/i', $tmpfile)) { $mime = 'image/tiff'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.svg$/i', $tmpfile)) { $mime = 'image/svg+xml'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.webp$/i', $tmpfile)) { $mime = 'image/webp'; $imgmime = 'image.png'; - $famime = 'file-image-o'; + $famime = 'file-image'; } elseif (preg_match('/\.vcs$/i', $tmpfile)) { // Calendar $mime = 'text/calendar'; $imgmime = 'other.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.ics$/i', $tmpfile)) { $mime = 'text/calendar'; $imgmime = 'other.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } elseif (preg_match('/\.torrent$/i', $tmpfile)) { // Other $mime = 'application/x-bittorrent'; $imgmime = 'other.png'; @@ -11117,40 +11117,40 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) } elseif (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i', $tmpfile)) { // Audio $mime = 'audio'; $imgmime = 'audio.png'; - $famime = 'file-audio-o'; + $famime = 'file-audio'; } elseif (preg_match('/\.mp4$/i', $tmpfile)) { // Video $mime = 'video/mp4'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.ogv$/i', $tmpfile)) { $mime = 'video/ogg'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.webm$/i', $tmpfile)) { $mime = 'video/webm'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.avi$/i', $tmpfile)) { $mime = 'video/x-msvideo'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.divx$/i', $tmpfile)) { $mime = 'video/divx'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.xvid$/i', $tmpfile)) { $mime = 'video/xvid'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.(wmv|mpg|mpeg)$/i', $tmpfile)) { $mime = 'video'; $imgmime = 'video.png'; - $famime = 'file-video-o'; + $famime = 'file-video'; } elseif (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh|zst)$/i', $tmpfile)) { // Archive // application/xxx where zzz is zip, ... $mime = 'archive'; $imgmime = 'archive.png'; - $famime = 'file-archive-o'; + $famime = 'file-archive'; } elseif (preg_match('/\.(exe|com)$/i', $tmpfile)) { // Exe $mime = 'application/octet-stream'; $imgmime = 'other.png'; @@ -11162,7 +11162,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) } elseif (preg_match('/\.err$/i', $tmpfile)) { // phpcs:ignore $mime = 'error'; $imgmime = 'error.png'; - $famime = 'file-text-o'; + $famime = 'file-alt'; } // Return mimetype string From f599ae779a234111384a1b43c1ffd0f454afeae6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Feb 2024 15:00:52 +0100 Subject: [PATCH 7/7] FIX some tooltips has disappeared on invoice action button --- htdocs/bom/bom_card.php | 2 +- htdocs/compta/facture/card.php | 29 ++++++++++++------------ htdocs/contrat/card.php | 9 ++++++++ htdocs/user/card.php | 40 +++++++++++++--------------------- 4 files changed, 39 insertions(+), 41 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f375004b4a4..61a51b8f139 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -731,7 +731,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Validate").''."\n"; } else { $langs->load("errors"); - print ''.$langs->trans("Validate").''."\n"; + print ''.$langs->trans("Validate").''."\n"; } } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3b425ae6e69..ea9b87b1de6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -46,14 +46,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } @@ -5655,7 +5654,7 @@ if ($action == 'create') { if (getDolGlobalString('INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE') || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) { if (!$objectidnext && $object->is_last_in_cycle()) { if ($usercanunvalidate) { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', true, $params); } else { $params['attr']['title'] = $langs->trans('NotEnoughPermissions'); @@ -5686,7 +5685,7 @@ if ($action == 'create') { && ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely) if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { $params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice"); @@ -5708,7 +5707,7 @@ if ($action == 'create') { // Validate if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (getDolGlobalString('FACTURE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params); } } @@ -5720,10 +5719,10 @@ if ($action == 'create') { print ''.$langs->trans('SendMail').''; } else { if ($usercansend) { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params); } else { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params); } } @@ -5766,7 +5765,7 @@ if ($action == 'create') { } else { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done) //print ''.$langs->trans('DoPayment').''; - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create'.($object->fk_account > 0 ? '&accountid='.$object->fk_account : ''), '', true, $params); } } @@ -5794,7 +5793,7 @@ if ($action == 'create') { if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate && (getDolGlobalString('INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED') || $sumofpayment == 0) && $object->total_ht < 0 ) { - print ''.$langs->trans('ConvertToReduc').''; + print ''.$langs->trans('ConvertToReduc').''; } // For down payment invoice (deposit) if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) { @@ -5802,7 +5801,7 @@ if ($action == 'create') { if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || getDolGlobalInt('DEPOSIT_AS_CREDIT_AVAILABLE_EVEN_UNPAID') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) { print ''.$langs->trans('ConvertToReduc').''; } else { - print ''.$langs->trans('ConvertToReduc').''; + print ''.$langs->trans('ConvertToReduc').''; } } } @@ -5819,7 +5818,7 @@ if ($action == 'create') { $params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment'); print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params); } else { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params); } } @@ -5865,14 +5864,14 @@ if ($action == 'create') { // Clone if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params); } // Clone as predefined / Create template if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) { if (!$objectidnext && count($object->lines) > 0) { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params); } } @@ -5926,10 +5925,10 @@ if ($action == 'create') { $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); $enableDelete = true; } - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', $deleteHref, '', $enableDelete, $params); } else { - $params['attr']['title'] = ''; + unset($params['attr']['title']); print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', '#', '', false); } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 6b0e29a207f..0ee4686559e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2157,6 +2157,7 @@ if ($action == 'create') { if ($object->status == $object::STATUS_DRAFT && $nbofservices) { if ($user->hasRight('contrat', 'creer')) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params); } else { $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); @@ -2165,6 +2166,7 @@ if ($action == 'create') { } if ($object->status == $object::STATUS_VALIDATED) { if ($user->hasRight('contrat', 'creer')) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params); } else { $params['attr']['title'] = $langs->trans("NotEnoughPermissions"); @@ -2199,20 +2201,25 @@ if ($action == 'create') { ); } if (count($arrayofcreatebutton)) { + unset($params['attr']['title']); print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayofcreatebutton, '', true, $params); } if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { if ($user->hasRight('contrat', 'activer')) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params); } else { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params); } } if ($object->nbofservicesclosed < $nbofservices) { if ($user->hasRight('contrat', 'desactiver')) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params); } else { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params); } @@ -2235,10 +2242,12 @@ if ($action == 'create') { // Clone if ($user->hasRight('contrat', 'creer')) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params); } // Delete + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete, $params); } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3dd49b2cea7..3d7460d34d9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1955,17 +1955,19 @@ if ($action == 'create' || $action == 'adduserldap') { $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); + if (empty($user->socid)) { $canSendMail = false; - $params = array( - 'attr' => array( - 'title' => '', - 'class' => 'classfortooltip' - ) - ); if (!empty($object->email)) { $langs->load("mails"); $canSendMail = true; + unset($params['attr']['title']); } else { $langs->load("mails"); $params['attr']['title'] = $langs->trans('NoEMail'); @@ -1974,26 +1976,16 @@ if ($action == 'create' || $action == 'adduserldap') { } if ($caneditfield && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { - $params = array( - 'attr' => array( - 'title' => '', - 'class' => 'classfortooltip' - ) - ); if (getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')) { $params['attr']['title'] = $langs->trans('DisabledInMonoUserMode'); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); } else { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken(), '', true, $params); } } elseif ($caneditpasswordandsee && !$object->ldap_sid && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { - $params = array( - 'attr' => array( - 'title' => '', - 'class' => 'classfortooltip' - ) - ); + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit', '', true, $params); } @@ -2010,6 +2002,7 @@ if ($action == 'create' || $action == 'adduserldap') { print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); } elseif (($user->id != $id && $caneditpasswordandsee) && $object->login && !$object->ldap_sid && ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password&token='.newToken(), '', true, $params); } @@ -2019,6 +2012,7 @@ if ($action == 'create' || $action == 'adduserldap') { } elseif (($user->id != $id && $caneditpasswordandsend) && $object->login && !$object->ldap_sid && ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { if ($object->email) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend&token='.newToken(), '', true, $params); } else { $params['attr']['title'] = $langs->trans('NoEMail'); @@ -2027,20 +2021,15 @@ if ($action == 'create' || $action == 'adduserldap') { } } - // Enable user - $params = array( - 'attr' => array( - 'title' => '', - 'class' => 'classfortooltip' - ) - ); if ($user->id != $id && $candisableuser && $object->statut == 0 && ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params); } // Disable user if ($user->id != $id && $candisableuser && $object->statut == 1 && ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params); } else { if ($user->id == $id) { @@ -2052,6 +2041,7 @@ if ($action == 'create' || $action == 'adduserldap') { if ($user->id != $id && $candisableuser && ((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin + unset($params['attr']['title']); print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params); } else { $params['attr']['title'] = $langs->trans('MustBeAdminToDeleteOtherAdmin');