Fix dolGetBadge class

This commit is contained in:
ATM John BOTELLA 2019-12-07 17:41:13 +01:00
parent 0e063a3bb3
commit 4d3ed4ffd3

View File

@ -8132,7 +8132,7 @@ function roundUpToNextMultiple($n, $x = 5)
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
{
$attr = array(
'class'=>'badge badge-status'.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css'])
'class'=>'badge '.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css'])
);
if (empty($html)) {
@ -8153,7 +8153,15 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
// Override attr
if (!empty($params['attr']) && is_array($params['attr'])) {
foreach ($params['attr']as $key => $value) {
$attr[$key] = $value;
if ($key == 'class') {
$attr['class'] .= ' '.$value;
}
elseif ($key == 'classOverride') {
$attr['class'] = $value;
}
else {
$attr[$key] = $value;
}
}
}
@ -8260,6 +8268,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
$statusLabelShort = !empty($statusLabelShort) ? $statusLabelShort : $statusLabel;
$dolGetBadgeParams['attr']['class'] = 'badge-status';
if ($displayMode == 3) {
$return = dolGetBadge($statusLabel, '', $statusType, 'dot', $url, $dolGetBadgeParams);
}