diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 9d8f655a608..7ba9a875643 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2021 Alexandre Spangaro * * 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') { + dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); + } + 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); @@ -221,8 +226,6 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); } if ($mode == 'login') { @@ -328,6 +331,114 @@ if ($mode == 'template') { showSkins(null, 1); } +if ($mode == 'dashboard') { + print '
'; + print ''; + + // Message of the day on home page + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); + complete_substitutions_array($substitutionarray, $langs); + + print '' . "\n"; + + print ''; + print ''; + + print ''; + print ''; + + if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { + print ''; + + // Block meteo + print ''; + print ''; + + // Block agenda + print ''; + print ''; + + // Block agenda + print ''; + print ''; + + // Block customer + print ''; + print ''; + + // Block supplier + print ''; + print ''; + + // Block contract + print ''; + print ''; + + // Block ticket + print ''; + print ''; + + // Block bank + print ''; + print ''; + + // Block adherent + print ''; + print ''; + + // Block expense report + print ''; + print ''; + + // Block holiday + print ''; + print ''; + } + + print '
'; + $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '
'; + foreach ($substitutionarray as $key => $val) { + $texthelp .= $key . '
'; + } + print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); + + print '
'; + + $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); + $doleditor->Create(); + + print '
' . $langs->trans('DashboardDisableGlobal') . ''; + print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('BoxstatsDisableGlobal') . ''; + print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0); + print '
'; + print $langs->trans("DashboardDisableBlocks"); + print '
' . $langs->trans('MAIN_DISABLE_METEO') . ''; + print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockAgenda') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockProject') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockCustomer') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockSupplier') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockContract') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockTicket') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockBank') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockAdherent') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockExpenseReport') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0); + print '
' . $langs->trans('DashboardDisableBlockHoliday') . ''; + print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0); + print '
' . "\n"; + print '
'; +} + if ($mode == 'other') { // Other print '
'; @@ -432,24 +543,6 @@ if ($mode == 'other') { print ' '; print ''; - // Message of the day on home page - $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); - complete_substitutions_array($substitutionarray, $langs); - - print ''; - $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '
'; - foreach ($substitutionarray as $key => $val) { - $texthelp .= $key . '
'; - } - print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); - - print ''; - - $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); - $doleditor->Create(); - - print '' . "\n"; - print '' . "\n"; print '
'; } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 45b7e3b2096..6285aabfb05 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -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'; diff --git a/htdocs/index.php b/htdocs/index.php index ea0efebc720..880b5577bbb 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -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"); @@ -186,7 +186,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of supplier proposals open (expired) - if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { + if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->rights->supplier_proposal->lire) { $langs->load("supplier_proposal"); include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $board = new SupplierProposal($db); @@ -196,14 +196,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"); @@ -211,7 +211,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"); @@ -220,7 +220,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"); @@ -229,21 +229,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 @@ -253,14 +253,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'); @@ -268,21 +268,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); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6d99e754368..0e8043dad63 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2164,6 +2164,19 @@ YouShouldSetThisToOff=You should set this to 0 or off InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s OldImplementation=Old implementation PDF_SHOW_LINK_TO_ONLINE_PAYMENT=If some online payment modules are enabled (Paypal, Stripe, ...), add a link on the PDF to make the online payment +DashboardDisableGlobal=Disable totally dashboard +BoxstatsDisableGlobal=Disable totally box statistics +DashboardDisableBlocks=Dashboard - Blocks to disable +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 EnabledCondition=Condition to have field enabled (if not enabled, visibility will always be off) IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sale tax IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sale tax