Skip to content

Commit

Permalink
Merge pull request #12647 from atm-john/develop_fix_dolGetBadge
Browse files Browse the repository at this point in the history
Fix dolGetBadge class
  • Loading branch information
eldy committed Dec 9, 2019
2 parents 0bb5df4 + 4d3ed4f commit fba2749
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -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)) {
Expand All @@ -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;
}
}
}

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit fba2749

Please sign in to comment.