forked from Wavyzz/dolibarr
Add new conf and update dolGetButtonAction function to display action buttons inline instead of into a dropdown (#29629)
This commit is contained in:
@@ -3037,10 +3037,14 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
$actionButtonsParameters = [
|
||||||
|
"areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER")
|
||||||
|
];
|
||||||
|
|
||||||
if ($numlines > 0) {
|
if ($numlines > 0) {
|
||||||
print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayforbutaction, $object->id, 1);
|
print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayforbutaction, $object->id, 1, $actionButtonsParameters);
|
||||||
} else {
|
} else {
|
||||||
print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans("Create"), 'default', $arrayforbutaction, $object->id, 0);
|
print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans("Create"), 'default', $arrayforbutaction, $object->id, 0, $actionButtonsParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set to shipped
|
// Set to shipped
|
||||||
|
|||||||
@@ -12095,7 +12095,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
|||||||
{
|
{
|
||||||
global $hookmanager, $action, $object, $langs;
|
global $hookmanager, $action, $object, $langs;
|
||||||
|
|
||||||
// If $url is an array, we must build a dropdown button
|
// If $url is an array, we must build a dropdown button or recursively iterate over each value
|
||||||
if (is_array($url)) {
|
if (is_array($url)) {
|
||||||
// Loop on $url array to remove entries of disabled modules
|
// Loop on $url array to remove entries of disabled modules
|
||||||
foreach ($url as $key => $subbutton) {
|
foreach ($url as $key => $subbutton) {
|
||||||
@@ -12106,6 +12106,24 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
|||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|
||||||
|
if (isset($params["areDropdownButtons"]) && $params["areDropdownButtons"] === false) {
|
||||||
|
foreach ($url as $button) {
|
||||||
|
if (!empty($button['lang'])) {
|
||||||
|
$langs->load($button['lang']);
|
||||||
|
}
|
||||||
|
$label = $langs->trans($button['label']);
|
||||||
|
$text = $button['text'] ?? '';
|
||||||
|
$actionType = $button['actionType'] ?? '';
|
||||||
|
$tmpUrl = DOL_URL_ROOT.$button['url'].(empty($params['backtopage']) ? '' : '&backtopage='.urlencode($params['backtopage']));
|
||||||
|
$id = $button['$id'] ?? '';
|
||||||
|
$userRight = $button['perm'] ?? 1;
|
||||||
|
$params = $button['$params'] ?? [];
|
||||||
|
|
||||||
|
$out .= dolGetButtonAction($label, $text, $actionType, $tmpUrl, $id, $userRight, $params);
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
if (count($url) > 1) {
|
if (count($url) > 1) {
|
||||||
$out .= '<div class="dropdown inline-block dropdown-holder">';
|
$out .= '<div class="dropdown inline-block dropdown-holder">';
|
||||||
$out .= '<a style="margin-right: auto;" class="dropdown-toggle classfortooltip butAction'.($userRight ? '' : 'Refused').'" title="'.dol_escape_htmltag($label).'" data-toggle="dropdown">'.($text ? $text : $label).'</a>';
|
$out .= '<a style="margin-right: auto;" class="dropdown-toggle classfortooltip butAction'.($userRight ? '' : 'Refused').'" title="'.dol_escape_htmltag($label).'" data-toggle="dropdown">'.($text ? $text : $label).'</a>';
|
||||||
|
|||||||
Reference in New Issue
Block a user