mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean code
This commit is contained in:
parent
49f869352c
commit
28797930fc
|
|
@ -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 . '</' . $tag . '>';
|
||||
if (dol_textishtml($text)) { // If content already HTML encoded
|
||||
return '<' . $tag . ' ' . $compiledAttributes . '>' . $text . '</' . $tag . '>';
|
||||
} else {
|
||||
return '<' . $tag . ' ' . $compiledAttributes . '>' . dol_escape_htmltag($text) . '</' . $tag . '>';
|
||||
}
|
||||
} else {
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user