diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dc894663e4c..12825d9a780 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2315,6 +2315,7 @@ class Adherent extends CommonObject $response = new WorkboardResponse(); $response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); + $response->labelShort=$langs->trans("MembersWithSubscriptionToReceiveShort"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; $response->img=img_object('', "user"); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6e4e3fb941b..79ae09c1678 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1103,6 +1103,7 @@ class ActionComm extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $conf->agenda->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); + $response->labelShort = $langs->trans("ActionsToDoShort"); $response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda'; if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1'; $response->img = img_object('', "action", 'class="inline-block valigntextmiddle"'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c1dde5e2aa4..481f6a5096f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3277,21 +3277,24 @@ class Propal extends CommonObject $delay_warning = 0; $statut = 0; - $label = ''; + $label = $labelShort = ''; if ($mode == 'opened') { $delay_warning=$conf->propal->cloture->warning_delay; $statut = self::STATUS_VALIDATED; $label = $langs->trans("PropalsToClose"); + $labelShort = $langs->trans("ToClose"); } if ($mode == 'signed') { $delay_warning=$conf->propal->facturation->warning_delay; $statut = self::STATUS_SIGNED; $label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered + $labelShort = $langs->trans("ToBill"); } $response = new WorkboardResponse(); $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; + $response->labelShort = $labelShort; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; $response->img = img_object('', "propal"); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b1e2262f109..fb246c7e232 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3411,6 +3411,7 @@ class Commande extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); + $response->labelShort = $langs->trans("ToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; $response->img=img_object('', "order"); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e5b8c0795ed..00b25b64506 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3889,6 +3889,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); + $response->labelShort=$langs->trans("Unpaid"); $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=billing&leftmenu=customers_bills'; $response->img=img_object('', "bill"); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0fb460466ef..666b80fb2d4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2186,23 +2186,27 @@ class Contrat extends CommonObject if ($mode == 'inactive') { $warning_delay = $conf->contrat->services->inactifs->warning_delay; $label = $langs->trans("BoardNotActivatedServices"); + $labelShort = $langs->trans("BoardNotActivatedServicesShort"); $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc'; } elseif ($mode == 'expired') { $warning_delay = $conf->contrat->services->expires->warning_delay; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc'; $label = $langs->trans("BoardExpiredServices"); + $labelShort = $langs->trans("BoardExpiredServicesShort"); } else { $warning_delay = $conf->contrat->services->expires->warning_delay; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc'; //$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year']; //if ($warning_delay >= 0) $url.='&filter=expired'; $label = $langs->trans("BoardRunningServices"); + $labelShort = $langs->trans("BoardRunningServicesShort"); } $response = new WorkboardResponse(); $response->warning_delay = $warning_delay/60/60/24; $response->label = $label; + $response->labelShort = $labelShort; $response->url = $url; $response->img = img_object('', "contract"); diff --git a/htdocs/core/class/workboardresponse.class.php b/htdocs/core/class/workboardresponse.class.php index 35449693599..3af5feaecbc 100644 --- a/htdocs/core/class/workboardresponse.class.php +++ b/htdocs/core/class/workboardresponse.class.php @@ -37,6 +37,18 @@ class WorkboardResponse */ public $label; + /** + * Short Label of the warning + * @var string + */ + public $labelShort; + + /** + * infoKey of the warning + * @var string + */ + public $infoKey = 'todo'; + /** * URL to list to do items * @var string diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 34f60120925..272125530e3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2333,12 +2333,14 @@ class ExpenseReport extends CommonObject { $response->warning_delay=$conf->expensereport->approve->warning_delay/60/60/24; $response->label=$langs->trans("ExpenseReportsToApprove"); + $response->labelShort=$langs->trans("ToApprove"); $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=2'; } else { $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24; $response->label=$langs->trans("ExpenseReportsToPay"); + $response->labelShort=$langs->trans("ToPay"); $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5'; } $response->img=img_object('', "trip"); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9d5bfce0189..a77206d5f42 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2835,6 +2835,7 @@ class CommandeFournisseur extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); + $response->labelShort=$langs->trans("ToProcess"); $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3&mainmenu=commercial&leftmenu=orders_suppliers'; $response->img=img_object('', "order"); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 41ac2f126a7..dcafc3bdbf2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2213,6 +2213,7 @@ class FactureFournisseur extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); + $response->labelShort=$langs->trans("ToPay"); $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills'; $response->img=img_object($langs->trans("Bills"), "bill"); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 533f6c9c748..b540ba8248e 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2243,6 +2243,7 @@ class Holiday extends CommonObject $response = new WorkboardResponse(); $response->warning_delay=$conf->holiday->approve->warning_delay/60/60/24; $response->label=$langs->trans("HolidaysToApprove"); + $response->labelShort=$langs->trans("ToApprove"); $response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday'; $response->img=img_object('', "holiday"); diff --git a/htdocs/index.php b/htdocs/index.php index bce4c521ad5..6276d85f579 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -374,13 +374,15 @@ $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); - - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; // deprecated } // Number of project opened @@ -388,7 +390,8 @@ 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->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of tasks to do (late) @@ -396,7 +399,8 @@ 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); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of commercial proposals opened (expired) @@ -404,9 +408,13 @@ 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->load_board($user, "opened"); - // Number of commercial proposals CLOSED signed (billed) - $dashboardlines[] = $board->load_board($user, "signed"); + + $workBoard = $board->load_board($user, "opened"); + $dashboardlines[$board->element.'_opened'] = $workBoard; + + $workBoard = $board->load_board($user, "signed"); + $dashboardlines[$board->element.'_signed'] = $workBoard; + } // Number of commercial proposals opened (expired) @@ -414,9 +422,13 @@ 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); - $dashboardlines[] = $board->load_board($user, "opened"); + + $workBoard = $board->load_board($user, "opened"); + $dashboardlines[$board->element.'_opened'] = $workBoard; + // Number of commercial proposals CLOSED signed (billed) - $dashboardlines[] = $board->load_board($user, "signed"); + $workBoard = $board->load_board($user, "signed"); + $dashboardlines[$board->element.'_signed'] = $workBoard; } // Number of customer orders a deal @@ -424,7 +436,8 @@ 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->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of suppliers orders a deal @@ -432,7 +445,8 @@ 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); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of services enabled (delayed) @@ -440,16 +454,20 @@ 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->load_board($user, "inactive"); + $workBoard = $board->load_board($user, "inactive"); + $dashboardlines[$board->element.'_inactive'] = $workBoard; + // Number of active services (expired) - $dashboardlines[] = $board->load_board($user, "active"); + $workBoard = $board->load_board($user, "active"); + $dashboardlines[$board->element.'_active'] = $workBoard; } // 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->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of supplier invoices (has paid) @@ -457,7 +475,8 @@ 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); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of transactions to conciliate @@ -468,7 +487,8 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate if ($nb > 0) { - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } } @@ -477,7 +497,7 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s { include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board=new RemiseCheque($db); - $dashboardlines[] = $board->load_board($user); + $dashboardlines['RemiseCheque'] = $board->load_board($user); } // Number of foundation members @@ -485,7 +505,7 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use { include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $board=new Adherent($db); - $dashboardlines[] = $board->load_board($user); + $dashboardlines['Adherent'] = $board->load_board($user); } // Number of expense reports to approve @@ -493,7 +513,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->appr { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board=new ExpenseReport($db); - $dashboardlines[] = $board->load_board($user, 'toapprove'); + $dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); } // Number of expense reports to pay @@ -501,7 +521,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_p { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board=new ExpenseReport($db); - $dashboardlines[] = $board->load_board($user, 'topay'); + $dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); } // Number of holidays to approve @@ -509,7 +529,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->approve) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $board=new Holiday($db); - $dashboardlines[] = $board->load_board($user); + $dashboardlines['Holiday'] = $board->load_board($user); } $object=new stdClass(); @@ -520,15 +540,103 @@ 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'), + ), + 'supplier_proposal' => + array ( + 'groupName' => 'SupplierProposals', + 'stats' => + array ('supplier_proposal_opened','supplier_proposal_signed'), + ), + 'commande' => + array ( + 'groupName' => 'Orders', + 'stats' => + array ('commande'), + ), + 'order_supplier' => + array ( + 'groupName' => 'SuppliersOrders', + 'stats' => + array ('order_supplier'), + ), + 'contrat' => + array ( + 'groupName' => 'Contracts', + 'stats' => + array ('contrat_inactive','contrat_active'), + ), + 'facture' => + array ( + 'groupName' => 'Invoices', + 'stats' => + array ('facture'), + ), + 'invoice_supplier' => + array ( + 'groupName' => 'SupplierInvoices', + 'stats' => + array ('invoice_supplier'), + ), + 'bank_account' => + array ( + 'groupName' => 'BankAccount', + 'stats' => + array ('bank_account','RemiseCheque'), + ), + /*'RemiseCheque' => + array ( + 'groupName' => 'BankChecks', + 'stats' => + array ('RemiseCheque'), + ),*/ + 'Adherent' => + array ( + 'groupName' => 'Members', + 'stats' => + array ('Adherent'), + ), + 'ExpenseReport' => + array ( + 'groupName' => 'ExpenseReport', + 'stats' => + array ('ExpenseReport'), + ), + 'Holiday' => + array ( + 'groupName' => 'Holidays', + 'stats' => + array ('Holiday'), + ), +); + + + // Calculate total nb of late $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 $tmp) +foreach($dashboardlines as $infoKey => $tmp) { - if ($tmp instanceof WorkboardResponse) $valid_dashboardlines[] = $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 @@ -578,14 +686,64 @@ $boxwork.=''."\n"; $nbworkboardempty=0; if (! empty($valid_dashboardlines)) { + $openedDashBoard = ''; + $boxwork.='