From d1f73499e90e1a01d796ec9c9f12e02bddcf328e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 15 Feb 2015 15:01:28 +0100 Subject: [PATCH 1/5] Refactored dashboard indicator --- htdocs/adherents/class/adherent.class.php | 26 ++- htdocs/comm/action/class/actioncomm.class.php | 30 ++-- htdocs/comm/mailing/card.php | 4 +- htdocs/comm/propal/class/propal.class.php | 39 +++-- htdocs/commande/class/commande.class.php | 29 ++-- htdocs/compta/bank/class/account.class.php | 28 +-- htdocs/compta/facture/class/facture.class.php | 29 ++-- .../cheque/class/remisecheque.class.php | 27 ++- htdocs/contrat/class/contrat.class.php | 40 +++-- htdocs/core/class/BoardResponse.class.php | 69 ++++++++ .../class/fournisseur.commande.class.php | 24 ++- .../fourn/class/fournisseur.facture.class.php | 24 ++- htdocs/index.php | 161 ++++-------------- 13 files changed, 296 insertions(+), 234 deletions(-) create mode 100644 htdocs/core/class/BoardResponse.class.php diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 98d971acbd0..1f8ae82dcbd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1725,17 +1725,15 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf; - - $now=dol_now(); + global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $this->nbtodo=$this->nbtodolate=0; + $now=dol_now(); $sql = "SELECT a.rowid, a.datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; @@ -1746,12 +1744,24 @@ class Adherent extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $langs->load("members"); + + $response = new BoardResponse(); + $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; + $response->label=$langs->trans("MembersWithSubscriptionToReceive"); + $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; + $response->img=img_object($langs->trans("Members"),"user"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->adherent->cotisation->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($this->db->jdate($obj->datefin) < ($now - $conf->adherent->cotisation->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index b20a3afa3ea..d13f32f157c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -712,18 +712,14 @@ class ActionComm extends CommonObject } /** - * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * - * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @param User $user Objet user + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; - - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; + global $conf, $user, $langs; $sql = "SELECT a.id, a.datep as dp"; $sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a"; @@ -739,13 +735,25 @@ class ActionComm extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $now = dol_now(); + + $response = new BoardResponse(); + $response->warning_delay = $conf->actions->warning_delay/60/60/24; + $response->label = $langs->trans("ActionsToDo"); + $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; + $response->img = img_object($langs->trans("Actions"),"action"); + // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if (isset($obj->dp) && $this->db->jdate($obj->dp) < ($now - $conf->actions->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if (isset($obj->dp) && $this->db->jdate($obj->dp) < ($now - $conf->actions->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 267fde415f6..1a574fa434a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -140,9 +140,7 @@ if (empty($reshook)) { if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { - //TODO: What is this for? - // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message + // As security measure, we don't allow send from the GUI setEventMessage($langs->trans("MailingNeedCommand"), 'warnings'); setEventMessage('', 'warnings'); setEventMessage($langs->trans("MailingNeedCommand2"), 'warnings'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8fae698ba94..2c20e5ea1c7 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -116,10 +116,6 @@ class Propal extends CommonObject var $labelstatut=array(); var $labelstatut_short=array(); - // Pour board - var $nbtodo; - var $nbtodolate; - var $specimen; @@ -2349,15 +2345,12 @@ class Propal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user,$mode) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin"; @@ -2376,25 +2369,43 @@ class Propal extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if ($mode == 'opened') $delay_warning=$conf->propal->cloture->warning_delay; - if ($mode == 'signed') $delay_warning=$conf->propal->facturation->warning_delay; + $langs->load("propal"); + $now=dol_now(); + + if ($mode == 'opened') { + $delay_warning=$conf->propal->cloture->warning_delay; + $statut = 1; + $label = $langs->trans("PropalsToClose"); + } + if ($mode == 'signed') { + $delay_warning=$conf->propal->facturation->warning_delay; + $statut = 2; + $label = $langs->trans("PropalsToBill"); + } + + $response = new BoardResponse(); + $response->warning_delay = $delay_warning; + $response->label = $label; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; + $response->img = img_object($langs->trans("Propals"),"propal"); // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; + $response->nbtodo++; if ($mode == 'opened') { $datelimit = $this->db->jdate($obj->datefin); if ($datelimit < ($now - $delay_warning)) { - $this->nbtodolate++; + $response->nbtodolate++; } } // TODO Definir regle des propales a facturer en retard // if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; } - return 1; + + return $response; } else { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 27c320b3326..511af75a967 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -106,10 +106,6 @@ class Commande extends CommonOrder var $lines = array(); - // Pour board - var $nbtodo; - var $nbtodolate; - /** * Constructor @@ -2729,15 +2725,12 @@ class Commande extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT c.rowid, c.date_creation as datec, c.date_livraison as delivery_date, c.fk_statut"; @@ -2756,14 +2749,26 @@ class Commande extends CommonOrder $resql=$this->db->query($sql); if ($resql) { + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; + $response->label=$langs->trans("OrdersToProcess"); + $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; + $response->img=img_object($langs->trans("Orders"),"order"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; + $response->nbtodo++; $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; - if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) $this->nbtodolate++; + + if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->client->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 598ccc2c8d8..c2929fb33a4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -881,18 +881,14 @@ class Account extends CommonObject * * @param User $user Objet user * @param int $filteraccountid To get info for a particular account id - * @return int <0 if KO, 0=Nothing to show, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user,$filteraccountid=0) { - global $conf; + global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; @@ -902,17 +898,27 @@ class Account extends CommonObject $sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid; - //print $sql; $resql=$this->db->query($sql); if ($resql) { - $num=$this->db->num_rows($resql); + $langs->load("banks"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; + $response->label=$langs->trans("TransactionsToConciliate"); + $response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; + $response->img=img_object($langs->trans("TransactionsToConciliate"),"payment"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) { + $response->nbtodolate++; + } } - return $num; + + return $response; } else { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5c645783cc1..3bbf76c79fe 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -117,9 +117,6 @@ class Facture extends CommonInvoice var $lines=array(); var $line; var $extraparams=array(); - //! Pour board - var $nbtodo; - var $nbtodolate; var $specimen; var $fac_rec; @@ -3088,15 +3085,12 @@ class Facture extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT f.rowid, f.date_lim_reglement as datefin"; @@ -3115,12 +3109,25 @@ class Facture extends CommonInvoice $resql=$this->db->query($sql); if ($resql) { + $langs->load("bills"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; + $response->label=$langs->trans("CustomerBillsUnpaid"); + $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; + $response->img=img_object($langs->trans("Bills"),"bill"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->facture->client->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($this->db->jdate($obj->datefin) < ($now - $conf->facture->client->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 11a61874e7e..6bb1429d0a0 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -432,18 +432,14 @@ class RemiseCheque extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf; + global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; @@ -456,12 +452,25 @@ class RemiseCheque extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $langs->load("banks"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; + $response->label=$langs->trans("BankChecksToReceipt"); + $response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; + $response->img=img_object($langs->trans("BankChecksToReceipt"),"payment"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->cheque->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->cheque->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index bbecab53a30..19001edf92c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1881,15 +1881,11 @@ class Contrat extends CommonObject * * @param User $user Objet user * @param string $mode "inactive" pour services a activer, "expired" pour services expires - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user,$mode) { - global $conf, $user; - - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; + global $conf, $user, $langs; $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; $this->from.= ", ".MAIN_DB_PREFIX."contratdet as cd"; @@ -1920,15 +1916,35 @@ class Contrat extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $langs->load("contracts"); + $now=dol_now(); + + if ($mode == 'inactives') { + $warning_delay = $conf->contrat->services->inactifs->warning_delay; + $label = $langs->trans("BoardNotActivatedServices"); + $url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0'; + } else { + $warning_delay = $conf->contrat->services->expires->warning_delay; + $url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired'; + $label = $langs->trans("BoardRunningServices"); + } + + $response = new BoardResponse(); + $response->warning_delay = $warning_delay/60/60/24; + $response->label = $label; + $response->url = $url; + $response->img = img_object($langs->trans("Contract"),"contract"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if ($mode == 'inactives') - if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $conf->contrat->services->inactifs->warning_delay)) $this->nbtodolate++; - if ($mode == 'expired') - if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $conf->contrat->services->expires->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + + if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/core/class/BoardResponse.class.php b/htdocs/core/class/BoardResponse.class.php new file mode 100644 index 00000000000..9cf12e7a702 --- /dev/null +++ b/htdocs/core/class/BoardResponse.class.php @@ -0,0 +1,69 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/class/BoardResponse.class.php + * \brief Class that represents response of load_board functions + */ + +class BoardResponse +{ + + /** + * Image URL to represent the board item + * @var string + */ + public $img; + + /** + * Label of the warning + * @var string + */ + public $label; + + /** + * URL to list to do items + * @var string + */ + public $url; + + /** + * Delay time to mark an item as late + * @var int + */ + public $warning_delay; + + /** + * (optional) If set, to do late items will link to this url + * @var string + */ + public $lateurl; + + /** + * Number of items to do + * @var int + */ + public $nbtodo = 0; + + /** + * Number of to do items which are late + * @var int + */ + public $nbtodolate = 0; + +} \ No newline at end of file diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 64131be840b..c5765772c3b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2000,15 +2000,12 @@ class CommandeFournisseur extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; $sql = "SELECT c.rowid, c.date_creation as datec, c.fk_statut,c.date_livraison as delivery_date"; @@ -2026,14 +2023,25 @@ class CommandeFournisseur extends CommonOrder $resql=$this->db->query($sql); if ($resql) { + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; + $response->label=$langs->trans("SuppliersOrdersToProcess"); + $response->url=DOL_URL_ROOT.'/fourn/commande/index.php'; + $response->img=img_object($langs->trans("Orders"),"order"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; + $response->nbtodo++; $date_to_test = empty($obj->delivery_date) ? $obj->datec : $obj->delivery_date; - if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) $this->nbtodolate++; + if ($obj->fk_statut != 3 && $this->db->jdate($date_to_test) < ($now - $conf->commande->fournisseur->warning_delay)) { + $response->nbtodolate++; + } } - return 1; + + return $response; } else { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 71e5c320dfa..3b029eff79c 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1421,15 +1421,12 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return int <0 if KO, >0 if OK + * @return BoardResponse|int <0 if KO, BoardResponse if OK */ function load_board($user) { - global $conf, $user; + global $conf, $user, $langs; - $now=dol_now(); - - $this->nbtodo=$this->nbtodolate=0; $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1442,13 +1439,24 @@ class FactureFournisseur extends CommonInvoice $resql=$this->db->query($sql); if ($resql) { + $langs->load("bills"); + $now=dol_now(); + + $response = new BoardResponse(); + $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; + $response->label=$langs->trans("SupplierBillsToPay"); + $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; + $response->img=img_object($langs->trans("Bills"),"bill"); + while ($obj=$this->db->fetch_object($resql)) { - $this->nbtodo++; - if (! empty($obj->datefin) && $this->db->jdate($obj->datefin) < ($now - $conf->facture->fournisseur->warning_delay)) $this->nbtodolate++; + $response->nbtodo++; + if (! empty($obj->datefin) && $this->db->jdate($obj->datefin) < ($now - $conf->facture->fournisseur->warning_delay)) { + $response->nbtodolate++; + } } $this->db->free($resql); - return 1; + return $response; } else { diff --git a/htdocs/index.php b/htdocs/index.php index 55252f6533f..9439e14995d 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -291,7 +291,8 @@ print '
'; * Dolibarr Working Board with weather */ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0; -$rowspan=0; + +//Array that contains all BoardResponse classes to process them $dashboardlines=array(); print ''."\n"; @@ -309,18 +310,14 @@ print ''."\n"; // Do not include sections without management permission // +require DOL_DOCUMENT_ROOT.'/core/class/BoardResponse.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); - $board->load_board($user); - $board->warning_delay=$conf->actions->warning_delay/60/60/24; - $board->label=$langs->trans("ActionsToDo"); - $board->url=DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; - $board->img=img_object($langs->trans("Actions"),"action"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of customer orders a deal @@ -328,13 +325,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $board=new Commande($db); - $board->load_board($user); - $board->warning_delay=$conf->commande->client->warning_delay/60/60/24; - $board->label=$langs->trans("OrdersToProcess"); - $board->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; - $board->img=img_object($langs->trans("Orders"),"order"); - $rowspan++; - $dashboardlines[]=$board; + + $dashboardlines[] = $board->load_board($user); } // Number of suppliers orders a deal @@ -342,172 +334,89 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board=new CommandeFournisseur($db); - $board->load_board($user); - $board->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; - $board->label=$langs->trans("SuppliersOrdersToProcess"); - $board->url=DOL_URL_ROOT.'/fourn/commande/index.php'; - $board->img=img_object($langs->trans("Orders"),"order"); - $rowspan++; - $dashboardlines[]=$board; + + $dashboardlines[] = $board->load_board($user); } // Number of commercial proposals opened (expired) if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { - $langs->load("propal"); - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board=new Propal($db); - $board->load_board($user,"opened"); - $board->warning_delay=$conf->propal->cloture->warning_delay/60/60/24; - $board->label=$langs->trans("PropalsToClose"); - $board->url=DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1'; - $board->img=img_object($langs->trans("Propals"),"propal"); - $rowspan++; - $dashboardlines[]=$board; -} + $dashboardlines[] = $board->load_board($user,"opened"); -// Number of commercial proposals CLOSED signed (billed) -if (! empty($conf->propal->enabled) && $user->rights->propale->lire) -{ - $langs->load("propal"); - - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $board=new Propal($db); - $board->load_board($user,"signed"); - $board->warning_delay=$conf->propal->facturation->warning_delay/60/60/24; - $board->label=$langs->trans("PropalsToBill"); - $board->url=DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=2'; - $board->img=img_object($langs->trans("Propals"),"propal"); - $rowspan++; - $dashboardlines[]=$board; + // Number of commercial proposals CLOSED signed (billed) + $dashboardlines[] = $board->load_board($user,"signed"); } // Number of services enabled (delayed) if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { - $langs->load("contracts"); - include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $board=new Contrat($db); - $board->load_board($user,"inactives"); - $board->warning_delay=$conf->contrat->services->inactifs->warning_delay/60/60/24; - $board->label=$langs->trans("BoardNotActivatedServices"); - $board->url=DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0'; - $board->img=img_object($langs->trans("Contract"),"contract"); - $rowspan++; - $dashboardlines[]=$board; -} + $dashboardlines[] = $board->load_board($user,"inactives"); -// Number of active services (expired) -if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) -{ - $langs->load("contracts"); - - include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - $board=new Contrat($db); - $board->load_board($user,"expired"); - $board->warning_delay=$conf->contrat->services->expires->warning_delay/60/60/24; - $board->label=$langs->trans("BoardRunningServices"); - $board->url=DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired'; - $board->img=img_object($langs->trans("Contract"),"contract"); - $rowspan++; - $dashboardlines[]=$board; + // Number of active services (expired) + $dashboardlines[] = $board->load_board($user,"expired"); } // Number of invoices customers (has paid) if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - $langs->load("bills"); - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $board=new Facture($db); - $board->load_board($user); - $board->warning_delay=$conf->facture->client->warning_delay/60/60/24; - $board->label=$langs->trans("CustomerBillsUnpaid"); - $board->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; - $board->img=img_object($langs->trans("Bills"),"bill"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of supplier invoices (has paid) if (! empty($conf->fournisseur->enabled) && ! empty($conf->facture->enabled) && $user->rights->facture->lire) { - $langs->load("bills"); - include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board=new FactureFournisseur($db); - $board->load_board($user); - $board->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; - $board->label=$langs->trans("SupplierBillsToPay"); - $board->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; - $board->img=img_object($langs->trans("Bills"),"bill"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of transactions to conciliate if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id) { - $langs->load("banks"); - include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $board=new Account($db); - $found=$board->load_board($user); - if ($found > 0) - { - $board->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; - $board->label=$langs->trans("TransactionsToConciliate"); - $board->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; - $board->img=img_object($langs->trans("TransactionsToConciliate"),"payment"); - $rowspan++; - $dashboardlines[]=$board; - } + $dashboardlines[] = $board->load_board($user); } // Number of cheque to send if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->societe_id) { - $langs->load("banks"); - include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board=new RemiseCheque($db); - $board->load_board($user); - $board->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; - $board->label=$langs->trans("BankChecksToReceipt"); - $board->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; - $board->img=img_object($langs->trans("BankChecksToReceipt"),"payment"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Number of foundation members if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $user->societe_id) { - $langs->load("members"); - include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $board=new Adherent($db); - $board->load_board($user); - $board->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; - $board->label=$langs->trans("MembersWithSubscriptionToReceive"); - $board->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; - $board->img=img_object($langs->trans("Members"),"user"); - $rowspan++; - $dashboardlines[]=$board; + $dashboardlines[] = $board->load_board($user); } // Calculate total nb of late $totallate=0; -foreach($dashboardlines as $key => $board) -{ - if ($board->nbtodolate > 0) $totallate+=$board->nbtodolate; -} - -// Show dashboard $var=true; -foreach($dashboardlines as $key => $board) + +$valid_dashboardlines = array_filter($dashboardlines, function ($board) { + return $board instanceof BoardResponse; +}); + +$rowspan = count($valid_dashboardlines); + +foreach($valid_dashboardlines as $board) { + if ($board->nbtodolate > 0) { + $totallate += $board->nbtodolate; + } + + // Show dashboard + $var=!$var; print ''; print ''; @@ -531,8 +440,6 @@ foreach($dashboardlines as $key => $board) if ($rowspan <= 2) $options='height="24"'; // Weather logo is smaller if dashboard has few elements else if ($rowspan <= 3) $options='height="48"'; // Weather logo is smaller if dashboard has few elements print showWeather($totallate,$text,$options); - //print showWeather(0,''); - //print showWeather(40,$text); print ''; $showweather=0; } From bab0163c44ce34516f1c828d8064ad43e3ecf88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 15 Feb 2015 15:07:24 +0100 Subject: [PATCH 2/5] Missing Copyright info --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/comm/action/class/actioncomm.class.php | 1 + htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 1 + htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 1 + htdocs/contrat/class/contrat.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/index.php | 1 + 11 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1f8ae82dcbd..890458b9a30 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d13f32f157c..c0628635374 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2c20e5ea1c7..cc24bcb219a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2010-2011 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 511af75a967..0b5df167931 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c2929fb33a4..d2d9db7b378 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2010 Regis Houssin * Copytight (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3bbf76c79fe..fe7d48ee6b4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012-2014 Christophe Battarel - * Copyright (C) 2012-2014 Marcos García + * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Cedric Gross diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 6bb1429d0a0..66083d3a84d 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 19001edf92c..14f406017ae 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c5765772c3b..bebce59806a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2010-2014 Philippe Grand - * Copyright (C) 2012-2014 Marcos García + * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 3b029eff79c..b9d77903b60 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 diff --git a/htdocs/index.php b/htdocs/index.php index 9439e14995d..f79413e51ab 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 From d5fd20e9119f148d82a8c67bd9f4f94e5a1182ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 15 Feb 2015 15:10:51 +0100 Subject: [PATCH 3/5] Renamed BoardResponse to WorkBoardResponse --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- .../compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 4 ++-- ...oardResponse.class.php => WorkBoardResponse.class.php} | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/index.php | 8 +++++--- 12 files changed, 27 insertions(+), 25 deletions(-) rename htdocs/core/class/{BoardResponse.class.php => WorkBoardResponse.class.php} (94%) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 890458b9a30..b275369be4e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1726,7 +1726,7 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -1747,7 +1747,7 @@ class Adherent extends CommonObject { $langs->load("members"); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c0628635374..e49b67604d5 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -716,7 +716,7 @@ class ActionComm extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -738,7 +738,7 @@ class ActionComm extends CommonObject { $now = dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay = $conf->actions->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index cc24bcb219a..80cfb5b3266 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2345,7 +2345,7 @@ class Propal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user,$mode) { @@ -2383,7 +2383,7 @@ class Propal extends CommonObject $label = $langs->trans("PropalsToBill"); } - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay = $delay_warning; $response->label = $label; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0b5df167931..19fd5c98a2b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2725,7 +2725,7 @@ class Commande extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -2751,7 +2751,7 @@ class Commande extends CommonOrder { $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index d2d9db7b378..85a6ad24b85 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -882,7 +882,7 @@ class Account extends CommonObject * * @param User $user Objet user * @param int $filteraccountid To get info for a particular account id - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user,$filteraccountid=0) { @@ -905,7 +905,7 @@ class Account extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->label=$langs->trans("TransactionsToConciliate"); $response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fe7d48ee6b4..71328871323 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3085,7 +3085,7 @@ class Facture extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -3112,7 +3112,7 @@ class Facture extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 66083d3a84d..88f9d573737 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -433,7 +433,7 @@ class RemiseCheque extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -456,7 +456,7 @@ class RemiseCheque extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; $response->label=$langs->trans("BankChecksToReceipt"); $response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 14f406017ae..9a5afc0aea1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1881,7 +1881,7 @@ class Contrat extends CommonObject * * @param User $user Objet user * @param string $mode "inactive" pour services a activer, "expired" pour services expires - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user,$mode) { @@ -1929,7 +1929,7 @@ class Contrat extends CommonObject $label = $langs->trans("BoardRunningServices"); } - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay = $warning_delay/60/60/24; $response->label = $label; $response->url = $url; diff --git a/htdocs/core/class/BoardResponse.class.php b/htdocs/core/class/WorkBoardResponse.class.php similarity index 94% rename from htdocs/core/class/BoardResponse.class.php rename to htdocs/core/class/WorkBoardResponse.class.php index 9cf12e7a702..4cb0a1be0e7 100644 --- a/htdocs/core/class/BoardResponse.class.php +++ b/htdocs/core/class/WorkBoardResponse.class.php @@ -17,11 +17,11 @@ */ /** - * \file htdocs/core/class/BoardResponse.class.php + * \file htdocs/core/class/WorkBoardResponse.class.php * \brief Class that represents response of load_board functions */ -class BoardResponse +class WorkBoardResponse { /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index bebce59806a..300a1ad1260 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2000,7 +2000,7 @@ class CommandeFournisseur extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -2025,7 +2025,7 @@ class CommandeFournisseur extends CommonOrder { $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); $response->url=DOL_URL_ROOT.'/fourn/commande/index.php'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b9d77903b60..c8735362cca 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1421,7 +1421,7 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return BoardResponse|int <0 if KO, BoardResponse if OK + * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK */ function load_board($user) { @@ -1442,7 +1442,7 @@ class FactureFournisseur extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new BoardResponse(); + $response = new WorkBoardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; diff --git a/htdocs/index.php b/htdocs/index.php index f79413e51ab..54cda381489 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -293,7 +293,7 @@ print '
'; */ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0; -//Array that contains all BoardResponse classes to process them +//Array that contains all WorkBoardResponse classes to process them $dashboardlines=array(); print '
'.$board->img.''.$board->label.''.$board->nbtodo.'
'."\n"; @@ -311,7 +311,7 @@ print ''."\n"; // Do not include sections without management permission // -require DOL_DOCUMENT_ROOT.'/core/class/BoardResponse.class.php'; +require DOL_DOCUMENT_ROOT.'/core/class/WorkBoardResponse.class.php'; // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) @@ -404,8 +404,10 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use $totallate=0; $var=true; +//Remove any invalid response +//load_board can return an integer if failed or WorkBoardResponse if OK $valid_dashboardlines = array_filter($dashboardlines, function ($board) { - return $board instanceof BoardResponse; + return $board instanceof WorkBoardResponse; }); $rowspan = count($valid_dashboardlines); From c01281a538b300caa4d729ec094f8479190d1335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 23:45:52 +0100 Subject: [PATCH 4/5] Renamed WorkBoardResponse::$late_url to WorkBoardResponse::$url_late --- htdocs/core/class/WorkBoardResponse.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/WorkBoardResponse.class.php b/htdocs/core/class/WorkBoardResponse.class.php index 4cb0a1be0e7..ae82c7e3a48 100644 --- a/htdocs/core/class/WorkBoardResponse.class.php +++ b/htdocs/core/class/WorkBoardResponse.class.php @@ -42,18 +42,18 @@ class WorkBoardResponse */ public $url; + /** + * (optional) If set, to do late items will link to this url + * @var string + */ + public $url_late; + /** * Delay time to mark an item as late * @var int */ public $warning_delay; - /** - * (optional) If set, to do late items will link to this url - * @var string - */ - public $lateurl; - /** * Number of items to do * @var int From fa55c60c35db0023e9763101445da545e0f7b35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 16 Feb 2015 23:49:07 +0100 Subject: [PATCH 5/5] Renamed WorkBoardResponse to WorkboardResponse --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- .../compta/paiement/cheque/class/remisecheque.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 4 ++-- ...oardResponse.class.php => WorkboardResponse.class.php} | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/index.php | 8 ++++---- 12 files changed, 26 insertions(+), 26 deletions(-) rename htdocs/core/class/{WorkBoardResponse.class.php => WorkboardResponse.class.php} (94%) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b275369be4e..9a385becff3 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1726,7 +1726,7 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -1747,7 +1747,7 @@ class Adherent extends CommonObject { $langs->load("members"); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index e49b67604d5..5cfe1dc7310 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -716,7 +716,7 @@ class ActionComm extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -738,7 +738,7 @@ class ActionComm extends CommonObject { $now = dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay = $conf->actions->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 80cfb5b3266..edc6d7bfd94 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2345,7 +2345,7 @@ class Propal extends CommonObject * * @param User $user Object user * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user,$mode) { @@ -2383,7 +2383,7 @@ class Propal extends CommonObject $label = $langs->trans("PropalsToBill"); } - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay = $delay_warning; $response->label = $label; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 19fd5c98a2b..d5c6b3f7715 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2725,7 +2725,7 @@ class Commande extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -2751,7 +2751,7 @@ class Commande extends CommonOrder { $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 85a6ad24b85..a2d9aec8ad4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -882,7 +882,7 @@ class Account extends CommonObject * * @param User $user Objet user * @param int $filteraccountid To get info for a particular account id - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user,$filteraccountid=0) { @@ -905,7 +905,7 @@ class Account extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->label=$langs->trans("TransactionsToConciliate"); $response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&mainmenu=bank'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 71328871323..50a68b2c66a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3085,7 +3085,7 @@ class Facture extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -3112,7 +3112,7 @@ class Facture extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); $response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 88f9d573737..ddda11bb556 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -433,7 +433,7 @@ class RemiseCheque extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -456,7 +456,7 @@ class RemiseCheque extends CommonObject $langs->load("banks"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->bank->cheque->warning_delay/60/60/24; $response->label=$langs->trans("BankChecksToReceipt"); $response->url=DOL_URL_ROOT.'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9a5afc0aea1..3cd35db15b5 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1881,7 +1881,7 @@ class Contrat extends CommonObject * * @param User $user Objet user * @param string $mode "inactive" pour services a activer, "expired" pour services expires - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user,$mode) { @@ -1929,7 +1929,7 @@ class Contrat extends CommonObject $label = $langs->trans("BoardRunningServices"); } - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay = $warning_delay/60/60/24; $response->label = $label; $response->url = $url; diff --git a/htdocs/core/class/WorkBoardResponse.class.php b/htdocs/core/class/WorkboardResponse.class.php similarity index 94% rename from htdocs/core/class/WorkBoardResponse.class.php rename to htdocs/core/class/WorkboardResponse.class.php index ae82c7e3a48..c36b50b421e 100644 --- a/htdocs/core/class/WorkBoardResponse.class.php +++ b/htdocs/core/class/WorkboardResponse.class.php @@ -17,11 +17,11 @@ */ /** - * \file htdocs/core/class/WorkBoardResponse.class.php + * \file htdocs/core/class/WorkboardResponse.class.php * \brief Class that represents response of load_board functions */ -class WorkBoardResponse +class WorkboardResponse { /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 300a1ad1260..4917ebd2779 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2000,7 +2000,7 @@ class CommandeFournisseur extends CommonOrder * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -2025,7 +2025,7 @@ class CommandeFournisseur extends CommonOrder { $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); $response->url=DOL_URL_ROOT.'/fourn/commande/index.php'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c8735362cca..d7252d188db 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1421,7 +1421,7 @@ class FactureFournisseur extends CommonInvoice * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @return WorkBoardResponse|int <0 if KO, WorkBoardResponse if OK + * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ function load_board($user) { @@ -1442,7 +1442,7 @@ class FactureFournisseur extends CommonInvoice $langs->load("bills"); $now=dol_now(); - $response = new WorkBoardResponse(); + $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=paye:0'; diff --git a/htdocs/index.php b/htdocs/index.php index 54cda381489..32b13c7a63f 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -293,7 +293,7 @@ print '
'; */ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0; -//Array that contains all WorkBoardResponse classes to process them +//Array that contains all WorkboardResponse classes to process them $dashboardlines=array(); print '
'."\n"; @@ -311,7 +311,7 @@ print ''."\n"; // Do not include sections without management permission // -require DOL_DOCUMENT_ROOT.'/core/class/WorkBoardResponse.class.php'; +require DOL_DOCUMENT_ROOT.'/core/class/WorkboardResponse.class.php'; // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) @@ -405,9 +405,9 @@ $totallate=0; $var=true; //Remove any invalid response -//load_board can return an integer if failed or WorkBoardResponse if OK +//load_board can return an integer if failed or WorkboardResponse if OK $valid_dashboardlines = array_filter($dashboardlines, function ($board) { - return $board instanceof WorkBoardResponse; + return $board instanceof WorkboardResponse; }); $rowspan = count($valid_dashboardlines);