diff --git a/htdocs/index.php b/htdocs/index.php index 4e83f376db3..5a22dd2e13f 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -366,484 +366,474 @@ if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTAT /* * Dolibarr Working Board with weather */ -$showweather=(empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0; +if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { + $showweather = (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0; //Array that contains all WorkboardResponse classes to process them -$dashboardlines=array(); + $dashboardlines = array(); // Do not include sections without management permission -require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; + 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); - $dashboardlines[$board->element] = $board->load_board($user); -} + 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); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of project opened -if (! empty($conf->projet->enabled) && $user->rights->projet->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $board=new Project($db); - $dashboardlines[$board->element] = $board->load_board($user); -} + if (!empty($conf->projet->enabled) && $user->rights->projet->lire) { + include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + $board = new Project($db); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of tasks to do (late) -if (! empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; - $board=new Task($db); - $dashboardlines[$board->element] = $board->load_board($user); -} + if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) { + include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; + $board = new Task($db); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of commercial proposals opened (expired) -if (! empty($conf->propal->enabled) && $user->rights->propale->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $board=new Propal($db); - $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"); -} + if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { + include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; + $board = new Propal($db); + $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) -if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; - $board=new SupplierProposal($db); - $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"); -} + if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { + include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; + $board = new SupplierProposal($db); + $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 customer orders a deal -if (! empty($conf->commande->enabled) && $user->rights->commande->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $board=new Commande($db); - $dashboardlines[$board->element] = $board->load_board($user); -} + if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; + $board = new Commande($db); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of suppliers orders a deal -if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; - $board=new CommandeFournisseur($db); - $dashboardlines[$board->element] = $board->load_board($user); -} + if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) { + include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; + $board = new CommandeFournisseur($db); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of services enabled (delayed) -if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - $board=new Contrat($db); - $dashboardlines[$board->element.'_inactive'] = $board->load_board($user, "inactive"); - // Number of active services (expired) - $dashboardlines[$board->element.'_active'] = $board->load_board($user, "active"); -} + if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { + include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + $board = new Contrat($db); + $dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive"); + // Number of active services (expired) + $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); - $dashboardlines[$board->element] = $board->load_board($user); -} + if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { + include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + $board = new Facture($db); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of supplier invoices (has paid) -if (! empty($conf->supplier_invoice->enabled) && ! empty($user->rights->fournisseur->facture->lire)) -{ - include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $board=new FactureFournisseur($db); - $dashboardlines[$board->element] = $board->load_board($user); -} + if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) { + include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; + $board = new FactureFournisseur($db); + $dashboardlines[$board->element] = $board->load_board($user); + } // Number of transactions to conciliate -if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id) -{ - include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $board=new Account($db); - $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate - if ($nb > 0) - { - $dashboardlines[$board->element] = $board->load_board($user); - } -} + if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) { + include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; + $board = new Account($db); + $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate + if ($nb > 0) { + $dashboardlines[$board->element] = $board->load_board($user); + } + } // Number of cheque to send -if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) -{ - include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; - $board=new RemiseCheque($db); - $dashboardlines['RemiseCheque'] = $board->load_board($user); -} + if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { + include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; + $board = new RemiseCheque($db); + $dashboardlines['RemiseCheque'] = $board->load_board($user); + } // Number of foundation members -if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $user->societe_id) -{ - include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $board=new Adherent($db); - $dashboardlines['Adherent'] = $board->load_board($user); -} + if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) { + include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + $board = new Adherent($db); + $dashboardlines['Adherent'] = $board->load_board($user); + } // Number of expense reports to approve -if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) -{ - include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; - $board=new ExpenseReport($db); - $dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); -} + if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) { + include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; + $board = new ExpenseReport($db); + $dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); + } // Number of expense reports to pay -if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) -{ - include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; - $board=new ExpenseReport($db); - $dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); -} + if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) { + include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; + $board = new ExpenseReport($db); + $dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); + } // Number of holidays to approve -if (! empty($conf->holiday->enabled) && $user->rights->holiday->approve) -{ - include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; - $board=new Holiday($db); - $dashboardlines['Holiday'] = $board->load_board($user); -} + if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) { + include_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php'; + $board = new Holiday($db); + $dashboardlines['Holiday'] = $board->load_board($user); + } -$object=new stdClass(); -$parameters=array(); -$action=''; -$reshook=$hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook == 0) { - $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); -} + $object = new stdClass(); + $parameters = array(); + $action = ''; + $reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, + $action); // Note that $action and $object may have been modified by some hooks + if ($reshook == 0) { + $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); + } -/* grouping dashboard stats */ -$dashboardgroup = array ( - 'action' => - array ( - 'groupName' => 'Agenda', - 'stats' => array ('action'), - ), - 'project' => - array ( - 'groupName' => 'Projects', - 'stats' => array ('project','project_task'), - ), - 'propal' => - array ( - 'groupName' => 'Proposals', - 'stats' => - array ('propal_opened','propal_signed'), - ), - 'commande' => - array ( - 'groupName' => 'Orders', - 'stats' => - array ('commande'), - ), - 'facture' => - array ( - 'groupName' => 'Invoices', - 'stats' => - array ('facture'), - ), - 'contrat' => - array ( - 'groupName' => 'Contracts', - 'stats' => - array ('contrat_inactive','contrat_active'), - ), - 'supplier_proposal' => - array ( - 'groupName' => 'SupplierProposals', - 'stats' => - array ('supplier_proposal_opened','supplier_proposal_signed'), - ), - 'order_supplier' => - array ( - 'groupName' => 'SuppliersOrders', - 'stats' => - array ('order_supplier'), - ), - 'invoice_supplier' => - array ( - 'groupName' => 'BillsSuppliers', - 'stats' => - array ('invoice_supplier'), - ), - 'bank_account' => - array ( - 'groupName' => 'BankAccount', - 'stats' => - array ('bank_account','RemiseCheque'), - ), - 'Adherent' => - array ( - 'groupName' => 'Members', - 'stats' => - array ('Adherent'), - ), - 'ExpenseReport' => - array ( - 'groupName' => 'ExpenseReport', - 'stats' => - array ('ExpenseReport'), - ), - 'Holiday' => - array ( - 'groupName' => 'Holidays', - 'stats' => - array ('Holiday'), - ), -); + /* grouping dashboard stats */ + $dashboardgroup = array( + 'action' => + array( + 'groupName' => 'Agenda', + 'stats' => array('action'), + ), + 'project' => + array( + 'groupName' => 'Projects', + 'stats' => array('project', 'project_task'), + ), + 'propal' => + array( + 'groupName' => 'Proposals', + 'stats' => + array('propal_opened', 'propal_signed'), + ), + 'commande' => + array( + 'groupName' => 'Orders', + 'stats' => + array('commande'), + ), + 'facture' => + array( + 'groupName' => 'Invoices', + 'stats' => + array('facture'), + ), + 'contrat' => + array( + 'groupName' => 'Contracts', + 'stats' => + array('contrat_inactive', 'contrat_active'), + ), + 'supplier_proposal' => + array( + 'groupName' => 'SupplierProposals', + 'stats' => + array('supplier_proposal_opened', 'supplier_proposal_signed'), + ), + 'order_supplier' => + array( + 'groupName' => 'SuppliersOrders', + 'stats' => + array('order_supplier'), + ), + 'invoice_supplier' => + array( + 'groupName' => 'BillsSuppliers', + 'stats' => + array('invoice_supplier'), + ), + 'bank_account' => + array( + 'groupName' => 'BankAccount', + 'stats' => + array('bank_account', 'RemiseCheque'), + ), + 'Adherent' => + array( + 'groupName' => 'Members', + 'stats' => + array('Adherent'), + ), + 'ExpenseReport' => + array( + 'groupName' => 'ExpenseReport', + 'stats' => + array('ExpenseReport'), + ), + 'Holiday' => + array( + 'groupName' => 'Holidays', + 'stats' => + array('Holiday'), + ), + ); -$object=new stdClass(); -$parameters=array( - 'dashboardgroup' => $dashboardgroup -); -$reshook=$hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook == 0) { - $dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray); -} + $object = new stdClass(); + $parameters = array( + 'dashboardgroup' => $dashboardgroup + ); + $reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, + $action); // Note that $action and $object may have been modified by some hooks + if ($reshook == 0) { + $dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray); + } // Calculate total nb of late -$totallate=$totaltodo=0; + $totallate = $totaltodo = 0; //Remove any invalid response //load_board can return an integer if failed or WorkboardResponse if OK -$valid_dashboardlines=array(); -foreach($dashboardlines as $infoKey => $tmp) -{ - if ($tmp instanceof WorkboardResponse) $valid_dashboardlines[$infoKey] = $tmp; -} + $valid_dashboardlines = array(); + foreach ($dashboardlines as $infoKey => $tmp) { + if ($tmp instanceof WorkboardResponse) { + $valid_dashboardlines[$infoKey] = $tmp; + } + } // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop -foreach($valid_dashboardlines as $board) -{ - if ($board->nbtodolate > 0) { - $totaltodo += $board->nbtodo; - $totallate += $board->nbtodolate; + foreach ($valid_dashboardlines as $board) { + if ($board->nbtodolate > 0) { + $totaltodo += $board->nbtodo; + $totallate += $board->nbtodolate; + } } -} -$openedDashBoardSize = 'info-box-sm'; // use sm by default -foreach ($dashboardgroup as $dashbordelement){ - if (is_array($dashbordelement['stats']) && count($dashbordelement['stats'])>2){ - $openedDashBoardSize = ''; // use default info box size : big - break; + $openedDashBoardSize = 'info-box-sm'; // use sm by default + foreach ($dashboardgroup as $dashbordelement) { + if (is_array($dashbordelement['stats']) && count($dashbordelement['stats']) > 2) { + $openedDashBoardSize = ''; // use default info box size : big + break; + } } -} -$totalLateNumber = $totallate; -$totallatePercentage = ((! empty($totaltodo)) ? round($totallate / $totaltodo * 100, 2) : 0); -if(! empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = $totallatePercentage; + $totalLateNumber = $totallate; + $totallatePercentage = ((!empty($totaltodo)) ? round($totallate / $totaltodo * 100, 2) : 0); + if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) { + $totallate = $totallatePercentage; + } -$boxwork=''; -$boxwork.='
'; -$boxwork.=''."\n"; -$boxwork.=''; -$boxwork.=''; -$boxwork.=''."\n"; + $boxwork = ''; + $boxwork .= '
'; + $boxwork .= '
'.$langs->trans("DolibarrWorkBoard").'
'; -if ($showweather) -{ - if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')'; - else $text=$langs->transnoentitiesnoconv("NoItemLate"); - $text.='. '.$langs->transnoentitiesnoconv("LateDesc"); - //$text.=$form->textwithpicto('',$langs->trans("LateDesc")); - $options='height="24px" style="float: right"'; - $boxwork.=showWeather($totallate, $text, $options, 'inline-block valignmiddle'); -} -$boxwork.='
' . "\n"; + $boxwork .= ''; + $boxwork .= ''; + $boxwork .= '' . "\n"; // Show dashboard -$nbworkboardempty=0; -$isIntopOpenedDashBoard = array(); -if (!empty($valid_dashboardlines)) -{ - $openedDashBoard = ''; + $nbworkboardempty = 0; + $isIntopOpenedDashBoard = array(); + if (!empty($valid_dashboardlines)) { + $openedDashBoard = ''; - $boxwork.=''; + } else { + $boxwork .= ''; + $boxwork .= ''; + $boxwork .= ''; } - $boxwork .='
'; - $boxwork .='
'; - $boxwork .='
'; - $boxwork .='
'; + $boxwork .= ''; + + $boxwork .= '
' . $langs->trans("DolibarrWorkBoard") . '
'; + if ($showweather) { + if ($totallate > 0) { + $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate", + $totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')'; + } else { + $text = $langs->transnoentitiesnoconv("NoItemLate"); + } + $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); + //$text.=$form->textwithpicto('',$langs->trans("LateDesc")); + $options = 'height="24px" style="float: right"'; + $boxwork .= showWeather($totallate, $text, $options, 'inline-block valignmiddle'); + } + $boxwork .= '
'; + $boxwork .= '
'; - foreach($dashboardgroup as $groupKey => $groupElement) { - $boards = array(); + foreach ($dashboardgroup as $groupKey => $groupElement) { + $boards = array(); - if(!empty($conf->global->MAIN_DISPLAY_NEW_OPENED_DASH_BOARD) || !empty($conf->global->MAIN_FEATURES_LEVEL)) - { - foreach ($groupElement['stats'] as $infoKey) - { - if(!empty($valid_dashboardlines[$infoKey])) - { - $boards[] = $valid_dashboardlines[$infoKey]; - $isIntopOpenedDashBoard[]=$infoKey; - } - } - } + if (!empty($conf->global->MAIN_DISPLAY_NEW_OPENED_DASH_BOARD) || !empty($conf->global->MAIN_FEATURES_LEVEL)) { + foreach ($groupElement['stats'] as $infoKey) { + if (!empty($valid_dashboardlines[$infoKey])) { + $boards[] = $valid_dashboardlines[$infoKey]; + $isIntopOpenedDashBoard[] = $infoKey; + } + } + } - if(!empty($boards)) - { - $groupName = $langs->trans($groupElement['groupName']); - $groupKeyLowerCase = strtolower($groupKey); + if (!empty($boards)) { + $groupName = $langs->trans($groupElement['groupName']); + $groupKeyLowerCase = strtolower($groupKey); - $openedDashBoard.= '
'."\n"; - $openedDashBoard.= '
'."\n"; - $openedDashBoard.= ' '."\n"; - $openedDashBoard.= '
'."\n"; - $openedDashBoard .= ' '.$groupName.'' . "\n"; + $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= ' ' . "\n"; + $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= ' ' . $groupName . '' . "\n"; - foreach($boards as $board) { - if(!empty($board->labelShort)){ - $infoName = ''.$board->labelShort.''; - } - else{ - $infoName = $board->label ; - } + foreach ($boards as $board) { + if (!empty($board->labelShort)) { + $infoName = '' . $board->labelShort . ''; + } else { + $infoName = $board->label; + } - $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate); - $textLateTitle.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; + $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate); + $textLateTitle .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')'; - $textLate = ''; - if($board->nbtodolate>0) - { - $textLate .= ' '; - $textLate .= ' '.$board->nbtodolate; - $textLate .= ''; - } + $textLate = ''; + if ($board->nbtodolate > 0) { + $textLate .= ' '; + $textLate .= ' ' . $board->nbtodolate; + $textLate .= ''; + } - $nbtodClass = ''; - if($board->nbtodo>0){ - $nbtodClass = 'badge badge-info'; - } + $nbtodClass = ''; + if ($board->nbtodo > 0) { + $nbtodClass = 'badge badge-info'; + } - $openedDashBoard .= ' '.$infoName.' : '.$board->nbtodo.''.$textLate.'' . "\n"; + $openedDashBoard .= ' ' . $infoName . ' : ' . $board->nbtodo . '' . $textLate . '' . "\n"; - if ($board->total > 0 && ! empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)){ - $openedDashBoard .= ''.$langs->trans('Total').' : '.price($board->total) .''; - } - } + if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) { + $openedDashBoard .= '' . $langs->trans('Total') . ' : ' . price($board->total) . ''; + } + } - $openedDashBoard.= '
'."\n"; - $openedDashBoard.= '
'."\n"; - $openedDashBoard.= '
'."\n"; - $openedDashBoard.="\n"; - } - } - - if ($showweather && !empty($isIntopOpenedDashBoard)) - { - $appendClass = $conf->global->MAIN_DISABLE_METEO == 2 ?' hideonsmartphone' : ''; - $weather = getWeatherStatus($totallate); - - $text=''; - if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')'; - else $text=$langs->transnoentitiesnoconv("NoItemLate"); - $text.='. '.$langs->transnoentitiesnoconv("LateDesc"); - - $weatherDashBoard= '
'."\n"; - $weatherDashBoard.= '
'."\n"; - $weatherDashBoard.= ' '; - $weatherDashBoard.= img_weather('', $weather->level, '', 0, 'valignmiddle width50'); - $weatherDashBoard.= ' '."\n"; - $weatherDashBoard.= '
'."\n"; - $weatherDashBoard.= ' '.$langs->trans('GlobalOpenedElemView').'' . "\n"; - - if($totallatePercentage>0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) { - $weatherDashBoard.= ' '.$langs->transnoentitiesnoconv("NActionsLate", price($totallatePercentage).'%').'' . "\n"; - $weatherDashBoard.= ' '.$langs->trans('NActionsLate', $totalLateNumber).'' . "\n"; - } - else{ - $weatherDashBoard.= ' '.$langs->transnoentitiesnoconv("NActionsLate", $totalLateNumber).'' . "\n"; - if($totallatePercentage>0) { - $weatherDashBoard.= ' '.$langs->trans('NActionsLate', price($totallatePercentage).'%').'' . "\n"; - } - } - - $weatherDashBoard.= '
'."\n"; - $weatherDashBoard.= '
'."\n"; - $weatherDashBoard.= '
'."\n"; - $weatherDashBoard.="\n"; - - $openedDashBoard=$weatherDashBoard.$openedDashBoard; - } - - if(!empty($isIntopOpenedDashBoard)) - { - for ($i = 1; $i <= 10; $i++) { - $openedDashBoard .= '
'; - } - } - - $nbworkboardcount=0; - foreach($valid_dashboardlines as $infoKey => $board) - { - if(in_array($infoKey, $isIntopOpenedDashBoard)) { - // skip if info is present on top - continue; - } - - if (empty($board->nbtodo)) $nbworkboardempty++; - $nbworkboardcount++; - - - $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 .= '
'; - $boxwork .= ''.$board->img.' '.$board->label.'
'; - $boxwork .= ''.$board->nbtodo.''; - if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) - { - $boxwork .= ' / '.price($board->total) .''; + $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= '
' . "\n"; + $openedDashBoard .= "\n"; + } } - $boxwork .= '
'; - if ($board->nbtodolate > 0) - { - $boxwork .= '
'; - $boxwork .= ''; - //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').''; - $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"').''; - $boxwork .= ''; - $boxwork .= $board->nbtodolate; - $boxwork .= ''; - $boxwork .= ''; + + if ($showweather && !empty($isIntopOpenedDashBoard)) { + $appendClass = $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : ''; + $weather = getWeatherStatus($totallate); + + $text = ''; + if ($totallate > 0) { + $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate", + $totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')'; + } else { + $text = $langs->transnoentitiesnoconv("NoItemLate"); + } + $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); + + $weatherDashBoard = '
' . "\n"; + $weatherDashBoard .= '
' . "\n"; + $weatherDashBoard .= ' '; + $weatherDashBoard .= img_weather('', $weather->level, '', 0, 'valignmiddle width50'); + $weatherDashBoard .= ' ' . "\n"; + $weatherDashBoard .= '
' . "\n"; + $weatherDashBoard .= ' ' . $langs->trans('GlobalOpenedElemView') . '' . "\n"; + + if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) { + $weatherDashBoard .= ' ' . $langs->transnoentitiesnoconv("NActionsLate", + price($totallatePercentage) . '%') . '' . "\n"; + $weatherDashBoard .= ' ' . $langs->trans('NActionsLate', + $totalLateNumber) . '' . "\n"; + } else { + $weatherDashBoard .= ' ' . $langs->transnoentitiesnoconv("NActionsLate", + $totalLateNumber) . '' . "\n"; + if ($totallatePercentage > 0) { + $weatherDashBoard .= ' ' . $langs->trans('NActionsLate', + price($totallatePercentage) . '%') . '' . "\n"; + } + } + + $weatherDashBoard .= '
' . "\n"; + $weatherDashBoard .= '
' . "\n"; + $weatherDashBoard .= '
' . "\n"; + $weatherDashBoard .= "\n"; + + $openedDashBoard = $weatherDashBoard . $openedDashBoard; + } + + if (!empty($isIntopOpenedDashBoard)) { + for ($i = 1; $i <= 10; $i++) { + $openedDashBoard .= '
'; + } + } + + $nbworkboardcount = 0; + foreach ($valid_dashboardlines as $infoKey => $board) { + if (in_array($infoKey, $isIntopOpenedDashBoard)) { + // skip if info is present on top + continue; + } + + if (empty($board->nbtodo)) { + $nbworkboardempty++; + } + $nbworkboardcount++; + + + $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 .= '
'; + $boxwork .= '' . $board->img . ' ' . $board->label . '
'; + $boxwork .= '' . $board->nbtodo . ''; + if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) { + $boxwork .= ' / ' . price($board->total) . ''; + } $boxwork .= '
'; + if ($board->nbtodolate > 0) { + $boxwork .= ''; + } + $boxwork .= '
'; + $boxwork .= "\n"; } - $boxwork.='
'; - $boxwork .="\n"; + + $boxwork .= '
'; + $boxwork .= '
'; + $boxwork .= '
'; + $boxwork .= '
'; + + $boxwork .= '
'; + $boxwork .= '
'; + $boxwork .= $langs->trans("NoOpenedElementToProcess"); + $boxwork .= '
'; // End table array of working board + $boxwork .= '
'; + + + if (!empty($isIntopOpenedDashBoard)) { + print '
'; + print '
' . $openedDashBoard . '
'; + print '
'; + } - $boxwork .=''; - $boxwork .=''; -} -else -{ - $boxwork.=''; - $boxwork.=''; - $boxwork.=$langs->trans("NoOpenedElementToProcess"); - $boxwork.=''; - $boxwork.=''; } -$boxwork.=''; - -$boxwork.=''; // End table array of working board -$boxwork.=''; - - -if(!empty($isIntopOpenedDashBoard)) { - print '
'; - print '
' . $openedDashBoard . '
'; - print '
'; -} print '
';