From e107423c2199823f4f602120087e05e317dcb55d Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 22 Feb 2022 12:25:30 +0100 Subject: [PATCH 1/3] fix : change title if html not set --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7be3f5e3351..9a866303eb3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9965,6 +9965,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = if (empty($html)) { $html = $label; + $attr['title'] = ''; // if html not set, leave label on title is redundant } else { $attr['aria-label'] = $label; } From 3edd478a467903452f6153372b2f2beae0345993 Mon Sep 17 00:00:00 2001 From: GregM Date: Wed, 23 Feb 2022 15:36:43 +0100 Subject: [PATCH 2/3] Fix empty url : dont add token --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9a866303eb3..b1f99d6f3f3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9954,7 +9954,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $class = 'butAction'; if ($actionType == 'danger' || $actionType == 'delete') { $class = 'butActionDelete'; - if (strpos($url, 'token=') === false) $url .= '&token='.newToken(); + if (!empty($url) && strpos($url, 'token=') === false) $url .= '&token='.newToken(); } $attr = array( From cf470c23061b1f6165774e47ad30458ddbd4b8ec Mon Sep 17 00:00:00 2001 From: GregM Date: Wed, 23 Feb 2022 16:01:07 +0100 Subject: [PATCH 3/3] Add auto tooltip --- htdocs/core/lib/functions.lib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b1f99d6f3f3..0ad9c638cd6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9979,6 +9979,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $attr['id'] = $id; } + // Override attr if (!empty($params['attr']) && is_array($params['attr'])) { foreach ($params['attr'] as $key => $value) { @@ -9992,6 +9993,11 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = } } + // automatic add tooltip when title is detected + if (!empty($attr['title']) && !empty($attr['class']) && strpos($attr['class'], 'classfortooltip') === false) { + $attr['class'].= ' classfortooltip'; + } + // Js Confirm button if ($userRight && !empty($params['confirm'])) { if (!is_array($params['confirm'])) {