diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3174fb132cd..c9b6d4a30c6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10418,8 +10418,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st /** * Function dolGetButtonAction * - * @param string $label label of button without HTML : use in alt attribute for accessibility $html is not empty - * @param string $html optional : content with html + * @param string $label label or tooltip of button. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. + * @param string $text optional : short label on button. Can be escaped HTML content or full simple text. * @param string $actionType default, delete, danger * @param string $url the url for link * @param string $id attribute id of button @@ -10444,7 +10444,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * // phpcs:enable * @return string html button */ -function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) +function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) { global $hookmanager, $action, $object, $langs; @@ -10464,8 +10464,8 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = 'title' => $label ); - if (empty($html)) { - $html = $label; + if (empty($text)) { + $text = $label; $attr['title'] = ''; // if html not set, leave label on title is redundant } else { $attr['aria-label'] = $label; @@ -10544,7 +10544,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = 'attr' => $attr, 'tag' => $tag, 'label' => $label, - 'html' => $html, + 'html' => $text, 'actionType' => $actionType, 'url' => $url, 'id' => $id, @@ -10556,7 +10556,11 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - return '<' . $tag . ' ' . $compiledAttributes . '>' . $html . ''; + if (dol_textishtml($text)) { // If content already HTML encoded + return '<' . $tag . ' ' . $compiledAttributes . '>' . $text . ''; + } else { + return '<' . $tag . ' ' . $compiledAttributes . '>' . dol_escape_htmltag($text) . ''; + } } else { return $hookmanager->resPrint; } diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 6b7e27c67aa..ffd43bbf8ac 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -94,7 +94,7 @@ class ActionsDatapolicy $langs->load('datapolicy@datapolicy'); $error = 0; // Error counter - if (GETPOST('socid') && $parameters['currentcontext'] == 'thirdpartycard') { + if (GETPOST('socid') && $parameters['currentcontext'] == 'thirdpartycard' && !empty($object)) { $object->fetch(GETPOST('socid')); } diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index d9b3d3127f9..4e0552d3c15 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -121,7 +121,7 @@ $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid * Actions */ -$parameters = array(); +$parameters = array('socid' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');