diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9d735b8759c..8c6b4c69f82 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7981,14 +7981,15 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' /** * @param string $statusLabel label of badge no html : use in alt attribute for accessibility + * @param string $statusLabelShort short label of badge no html * @param string $html optional : label of badge with html * @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name - * @param int $displayMode for retrocompatibility 0=label only, 1=label + Picto, 2=Picto, 3=Picto + label + * @param int $displayMode for retrocompatibility 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @param string $url the url for link * @param array $params various params for future : recommended rather than adding more function arguments * @return string html status */ -function dolGetStatus($statusLabel = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array()) +function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array()) { global $conf; @@ -8011,28 +8012,36 @@ function dolGetStatus($statusLabel = '', $html = '', $statusType = 'status0', $d if($displayMode==0){ $return = !empty($html)?$html:$statusLabel; } + elseif($displayMode===1){ + $return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel); + } // use status with images elseif(empty($conf->global->MAIN_STATUS_USES_CSS)){ $return = ''; - $htmlLabel = ''.(!empty($html)?$html:$statusLabel).''; + $htmlLabel = ''.(!empty($html)?$html:$statusLabel).''; + $htmlLabelShort = ''.(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).''; if(!empty($statusImg[$statusType])){ $htmlImg = img_picto($statusLabel, $statusImg[$statusType]); }else{ $htmlImg = img_picto($statusLabel, $statusType); } - - if($displayMode === 1){ - $return = $htmlLabel .' '. $htmlImg; - } - elseif($displayMode === 2){ - $return = $htmlImg; - } - elseif($displayMode === 3){ + + + if($displayMode === 2){ $return = $htmlImg .' '. $htmlLabel; } - else{ - $return = !empty($html)?$html:$statusLabel; + elseif($displayMode === 3){ + $return = $htmlImg; + } + elseif($displayMode === 4){ + $return = $htmlImg .' '. $htmlLabel; + } + elseif($displayMode === 5){ + $return = $htmlLabelShort .' '. $htmlImg; + } + else{ // $displayMode >= 6 + $return = $htmlLabel .' '. $htmlImg; } } @@ -8040,10 +8049,19 @@ function dolGetStatus($statusLabel = '', $html = '', $statusType = 'status0', $d // Use new badge if(!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)){ - $mode = 'pill'; - if($displayMode == 2)$mode = 'dot'; - - $return = dolGetBadge($statusLabel, $html, $statusType, $mode); + $statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel; + + + if($displayMode == 3){ + $return = dolGetBadge($statusLabel, '', $statusType, 'dot'); + } + elseif($displayMode === 5){ + $return = dolGetBadge($statusLabelShort, $html, $statusType); + } + else{ + $return = dolGetBadge($statusLabel, $html, $statusType); + } + } return $return; diff --git a/htdocs/theme/eldy/doc/badges.php b/htdocs/theme/eldy/doc/badges.php index 7da8ed71e83..8057ce7ffae 100644 --- a/htdocs/theme/eldy/doc/badges.php +++ b/htdocs/theme/eldy/doc/badges.php @@ -293,26 +293,34 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $conf->global->MAIN_STATUS_USES_CSS = 1; ?>

Using hidden global conf MAIN_STATUS_USES_CSS=1

-

with html', 'status4') ?>

-

with html', 'status4',1) ?>

-

with html', 'status4',2) ?>

-

with html', 'status4',3) ?>

+

with html', 'status4') ?>

+

with html', 'status4',1) ?>

+

with html', 'status4',2) ?>

+

with html', 'status4',3) ?>

+

with html', 'status4',4) ?>

+

with html', 'status4',5) ?>

+

with html', 'status4',6) ?>

global->MAIN_STATUS_USES_CSS = 0; ?>

Disabled hidden global conf : MAIN_STATUS_USES_CSS=0

-

with html', 'status4') ?>

-

with html', 'status4',1) ?>

-

with html', 'status4',2) ?>

-

with html', 'status4',3) ?>

+

with html', 'status4',1) ?>

+

with html', 'status4',2) ?>

+

with html', 'status4',3) ?>

+

with html', 'status4',4) ?>

+

with html', 'status4',5) ?>

+

with html', 'status4',6) ?>

global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?>
-<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4') ?>
-<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4',1) ?>
-<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4',2) ?>
-<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4',3) ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4') ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',1) ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',2) ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',3) ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',4) ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',5) ?>
+<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',6) ?>