NEW IHM - Include new options to manage dashboard

This commit is contained in:
Alexandre SPANGARO 2021-08-22 05:25:13 +02:00
parent 58fa0740c3
commit a1d3e21e77
4 changed files with 119 additions and 20 deletions

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,7 +44,7 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other'
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'dashboard', 'login', 'other'
if (!defined("MAIN_MOTD")) {
define("MAIN_MOTD", "");
@ -206,6 +207,10 @@ if ($action == 'update') {
}
}
if ($mode == 'dashboard') {
}
if ($mode == 'other') {
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
@ -328,6 +333,84 @@ if ($mode == 'template') {
showSkins(null, 1);
}
if ($mode == 'dashboard') {
print '<div class="div-table-responsive-no-min">';
print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th class="titlefieldmiddle" colspan="2">';
print $langs->trans("DashboardEnableBlockToShow");
print '</th></tr>';
// Block meteo
print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block agenda
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block agenda
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block customer
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block supplier
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block contract
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block ticket
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block bank
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block adherent
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block expense report
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
// Block holiday
print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '</tr>';
print '</table>' . "\n";
print '</div>';
}
if ($mode == 'other') {
// Other
print '<div class="div-table-responsive-no-min">';

View File

@ -685,6 +685,11 @@ function ihm_prepare_head()
$head[$h][2] = 'template';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=dashboard";
$head[$h][1] = $langs->trans("Dashboard");
$head[$h][2] = 'dashboard';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login";
$head[$h][1] = $langs->trans("LoginPage");
$head[$h][2] = 'login';

View File

@ -156,28 +156,28 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
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) {
if (!empty($conf->agenda->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $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) {
if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && $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) {
if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && 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 open (expired)
if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
// Number of commercial customer proposals open (expired)
if (!empty($conf->propal->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $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");
@ -185,8 +185,8 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$dashboardlines[$board->element.'_signed'] = $board->load_board($user, "signed");
}
// Number of commercial proposals open (expired)
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
// Number of commercial supplier proposals open (expired)
if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $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");
@ -195,14 +195,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of customer orders a deal
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $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) {
if (!empty($conf->supplier_order->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->rights->fournisseur->commande->lire) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$board = new CommandeFournisseur($db);
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
@ -210,7 +210,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of contract / services enabled (delayed)
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
if (!empty($conf->contrat->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CONTRACT) && $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");
@ -219,7 +219,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of tickets open
if (!empty($conf->ticket->enabled) && $user->rights->ticket->read) {
if (!empty($conf->ticket->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_TICKET) && $user->rights->ticket->read) {
include_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
$board = new Ticket($db);
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
@ -228,21 +228,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of invoices customers (paid)
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $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 (paid)
if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
if (!empty($conf->supplier_invoice->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && !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->socid) {
if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->rights->banque->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$board = new Account($db);
$nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate
@ -252,14 +252,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of cheque to send
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
$board = new RemiseCheque($db);
$dashboardlines[$board->element] = $board->load_board($user);
}
// Number of foundation members
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) {
if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_ADHERENT) && $user->rights->adherent->lire && !$user->socid) {
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$board = new Adherent($db);
$dashboardlines[$board->element.'_shift'] = $board->load_board($user, 'shift');
@ -267,21 +267,21 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of expense reports to approve
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_EXPENSEREPORT) && $user->rights->expensereport->approve) {
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db);
$dashboardlines[$board->element.'_toapprove'] = $board->load_board($user, 'toapprove');
}
// Number of expense reports to pay
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_EXPENSEREPORT) && $user->rights->expensereport->to_paid) {
include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$board = new ExpenseReport($db);
$dashboardlines[$board->element.'_topay'] = $board->load_board($user, 'topay');
}
// Number of holidays to approve
if (!empty($conf->holiday->enabled) && $user->rights->holiday->approve) {
if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_HOLIDAY) && $user->rights->holiday->approve) {
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$board = new Holiday($db);
$dashboardlines[$board->element] = $board->load_board($user);

View File

@ -2163,3 +2163,14 @@ APIsAreNotEnabled=APIs modules are not enabled
YouShouldSetThisToOff=You should set this to 0 or off
InstallAndUpgradeLockedBy=Install and upgrades are locked by the file <b>%s</b>
OldImplementation=Old implementation
DashboardEnableBlockToShow=Dashboard - Block to show
DashboardDisableBlockAgenda=Disable block agenda
DashboardDisableBlockProject=Disable block project
DashboardDisableBlockCustomer=Disable block customer
DashboardDisableBlockSupplier=Disable block supplier
DashboardDisableBlockContract=Disable block contract
DashboardDisableBlockTicket=Disable block ticket
DashboardDisableBlockBank=Disable block bank
DashboardDisableBlockAdherent=Disable block adherent
DashboardDisableBlockExpenseReport=Disable block expense report
DashboardDisableBlockHoliday=Disable block holiday