diff --git a/htdocs/index.php b/htdocs/index.php index 5a41a85a11d..3e33570a379 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -375,15 +375,12 @@ $dashboardlines=array(); // Do not include sections without management permission require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; - - // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) { include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $board=new ActionComm($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; // deprecated + $dashboardlines[$board->element] = $board->load_board($user); } // Number of project opened @@ -391,8 +388,7 @@ if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $board=new Project($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } // Number of tasks to do (late) @@ -400,8 +396,7 @@ if (! empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) { include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $board=new Task($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } // Number of commercial proposals opened (expired) @@ -409,13 +404,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board=new Propal($db); - - $workBoard = $board->load_board($user, "opened"); - $dashboardlines[$board->element.'_opened'] = $workBoard; - - $workBoard = $board->load_board($user, "signed"); - $dashboardlines[$board->element.'_signed'] = $workBoard; - + $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); + // Number of commercial proposals CLOSED signed (billed) + $dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed"); } // Number of commercial proposals opened (expired) @@ -423,13 +414,9 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos { include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $board=new SupplierProposal($db); - - $workBoard = $board->load_board($user, "opened"); - $dashboardlines[$board->element.'_opened'] = $workBoard; - + $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); // Number of commercial proposals CLOSED signed (billed) - $workBoard = $board->load_board($user, "signed"); - $dashboardlines[$board->element.'_signed'] = $workBoard; + $dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed"); } // Number of customer orders a deal @@ -437,8 +424,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $board=new Commande($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } // Number of suppliers orders a deal @@ -446,8 +432,7 @@ if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->comma { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board=new CommandeFournisseur($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } // Number of services enabled (delayed) @@ -455,20 +440,16 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $board=new Contrat($db); - $workBoard = $board->load_board($user, "inactive"); - $dashboardlines[$board->element.'_inactive'] = $workBoard; - + $dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive"); // Number of active services (expired) - $workBoard = $board->load_board($user, "active"); - $dashboardlines[$board->element.'_active'] = $workBoard; + $dashboardlines[$board->element.'_active'] = $board->load_board($user, "active"); } // Number of invoices customers (has paid) if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $board=new Facture($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } // Number of supplier invoices (has paid) @@ -476,8 +457,7 @@ if (! empty($conf->supplier_invoice->enabled) && ! empty($user->rights->fourniss { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board=new FactureFournisseur($db); - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } // Number of transactions to conciliate @@ -488,8 +468,7 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate if ($nb > 0) { - $workBoard = $board->load_board($user); - $dashboardlines[$board->element] = $workBoard; + $dashboardlines[$board->element] = $board->load_board($user); } } @@ -694,15 +673,19 @@ if (!empty($valid_dashboardlines)) $boxwork.='
'; - foreach($dashboardgroup as $groupKey => $groupElement) { + foreach($dashboardgroup as $groupKey => $groupElement) { $boards = array(); - foreach ($groupElement['stats'] as $infoKey) + + if(!empty($conf->global->MAIN_DISPLAY_NEW_OPENED_DASH_BOARD)) { - if(!empty($valid_dashboardlines[$infoKey])) + foreach ($groupElement['stats'] as $infoKey) { - $boards[] = $valid_dashboardlines[$infoKey]; - $isIntopOpenedDashBoard[]=$infoKey; + if(!empty($valid_dashboardlines[$infoKey])) + { + $boards[] = $valid_dashboardlines[$infoKey]; + $isIntopOpenedDashBoard[]=$infoKey; + } } } @@ -744,7 +727,7 @@ if (!empty($valid_dashboardlines)) $openedDashBoard .= ' '.$infoName.' : '.$board->nbtodo.''.$textLate.'' . "\n"; - if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX) || $board->total > 0){ + if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)){ $openedDashBoard .= ''.$langs->trans('Total').' : '.price($board->total) .''; } } @@ -775,10 +758,10 @@ if (!empty($valid_dashboardlines)) $weatherDashBoard.= ' '.$langs->trans('GlobalOpenedElemView').'' . "\n"; $weatherDashBoard.= ' '.$langs->transnoentitiesnoconv("NActionsLate", $totalLateNumber).'' . "\n"; - /*if($totallatePercentage>0){ + if($totallatePercentage>0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)){ $weatherDashBoard.= '
'; $weatherDashBoard.= ' '.$langs->trans('NActionsLate', price($totallatePercentage).'%').'' . "\n"; - }*/ + } $weatherDashBoard.= '
'."\n"; $weatherDashBoard.= ' '."\n"; @@ -790,9 +773,11 @@ if (!empty($valid_dashboardlines)) } - - for ($i = 1; $i <= 10; $i++) { - $openedDashBoard .= '
'; + if(!empty($isIntopOpenedDashBoard)) + { + for ($i = 1; $i <= 10; $i++) { + $openedDashBoard .= '
'; + } } $nbworkboardcount=0; @@ -800,18 +785,23 @@ if (!empty($valid_dashboardlines)) { if(in_array($infoKey, $isIntopOpenedDashBoard)) { // skip if info is present on top - //continue; + continue; } if (empty($board->nbtodo)) $nbworkboardempty++; $nbworkboardcount++; - $boxwork .='
'; + + $textlate = $langs->trans("NActionsLate", $board->nbtodolate); + $textlate.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; + + + $boxwork .='
'; $boxwork .= '
'; $sep=($conf->dol_use_jmobile?'
':' '); $boxwork .= ''.$board->img.' '.$board->label.'
'; $boxwork .= ''.$board->nbtodo.''; - if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) + if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) { $boxwork .= ' / '.price($board->total) .''; } @@ -855,10 +845,11 @@ $boxwork.=''; // End table array of working board $boxwork.='
'; - -print '
'; -print '
'.$openedDashBoard.'
'; -print '
'; +if(!empty($isIntopOpenedDashBoard)) { + print '
'; + print '
' . $openedDashBoard . '
'; + print '
'; +} print '
';