diff --git a/htdocs/index.php b/htdocs/index.php index 45c7e1509e2..bce3b9dc083 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -107,27 +107,21 @@ if (! empty($conf->global->MAIN_MOTD)) * Dashboard Dolibarr states (statistics) * Hidden for external users */ -$boxstat=''; + + +$boxstatItems = array(); +$boxstatFromHook = ''; // Load translation files required by page $langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts')); if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { - $boxstat.='
'; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.=''; - $boxstat.='
'; - $boxstat.='
'.$langs->trans("DolibarrStateBoard").'
'; - $boxstat.='
'; - $object=new stdClass(); $parameters=array(); $action=''; $reshook=$hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - $boxstat.=$hookmanager->resPrint; + $boxstatFromHook=$hookmanager->resPrint; if (empty($reshook)) { @@ -318,6 +312,7 @@ if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTAT { if ($conditions[$key]) { + $boxstatItem = ''; $classe=$classes[$key]; // Search in cache if load_state_board is already realized if (! isset($boardloaded[$classe]) || ! is_object($boardloaded[$classe])) @@ -336,28 +331,17 @@ if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTAT if (!empty($langfile[$key])) $langs->load($langfile[$key]); $text=$langs->trans($titres[$key]); - $boxstat.=''; - $boxstat.='
'; - $boxstat.=''.$text.'
'; - $boxstat.=''.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val]?$board->nb[$val]:0).''; - $boxstat.='
'; - $boxstat.='
'; + $boxstatItem.=''; + $boxstatItem.='
'; + $boxstatItem.=''.$text.'
'; + $boxstatItem.=''.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val]?$board->nb[$val]:0).''; + $boxstatItem.='
'; + $boxstatItem.='
'; + + $boxstatItems[$val] = $boxstatItem; } } } - - $boxstat.='
'; - $boxstat.='
'; - $boxstat.='
'; - $boxstat.='
'; - $boxstat.='
'; - $boxstat.='
'; - $boxstat.='
'; - $boxstat.='
'; - - $boxstat.='
'; - $boxstat.='
'; } @@ -589,7 +573,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { 'Holiday' => array( 'groupName' => 'Holidays', - 'globalStatsKey' => 'holidays', + 'globalStatsKey' => 'holidays', 'stats' => array('Holiday'), ), @@ -710,18 +694,18 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } - $openedDashBoard .= '
' . "\n"; - $openedDashBoard .= '
' . "\n"; + $openedDashBoard.= '
' . "\n"; + $openedDashBoard.= '
' . "\n"; $openedDashBoard.= ' '."\n"; $openedDashBoard.= ' '."\n"; if(!empty($groupElement['globalStats'])){ - $globalStatInTopOpenedDashBoard[] = $groupElement['globalStats']; + $globalStatInTopOpenedDashBoard[] = $globalStatsKey; $openedDashBoard.= ' '.$nbTotal.''."\n"; } $openedDashBoard.= ' '."\n"; - $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= '
' . "\n"; $openedDashBoard .= ' '.$groupName.'' . "\n"; @@ -900,6 +884,50 @@ $boxlist.=$resultboxes['boxlista']; $boxlist.= '
'; + +if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) +{ + // Remove allready present info in new dash board + if(!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0){ + foreach ($boxstatItems as $boxstatItemKey => $boxstatItemHtml) { + if (in_array($boxstatItemKey, $globalStatInTopOpenedDashBoard)) { + unset($boxstatItems[$boxstatItemKey]); + } + } + } + + if(!empty($boxstatFromHook) || !empty($boxstatItems)){ + $boxstat.='
'; + $boxstat.=''; + $boxstat.=''; + $boxstat.=''; + $boxstat.=''; + $boxstat.=''; + $boxstat.='
'; + $boxstat.='
'.$langs->trans("DolibarrStateBoard").'
'; + $boxstat.='
'; + + $boxstat.=$boxstatFromHook; + + if(is_array($boxstatItems) && count($boxstatItems) > 0) + { + $boxstat.= implode('', $boxstatItems); + } + + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + $boxstat.='
'; + + $boxstat.='
'; + $boxstat.='
'; + } +} + $boxlist.= '
'; $boxlist.=$boxstat; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 34254812848..a483b3d758d 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -91,6 +91,13 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> -webkit-transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s; } + +global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)){ ?> +.info-box-icon-text{ + opacity: 1; +} + + .info-box-sm .info-box-icon-text{ overflow: hidden; width: 80px;