forked from Wavyzz/dolibarr
Merge pull request #12647 from atm-john/develop_fix_dolGetBadge
Fix dolGetBadge class
This commit is contained in:
@@ -8135,7 +8135,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)) {
|
||||
@@ -8156,7 +8156,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8263,6 +8271,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user