diff --git a/htdocs/index.php b/htdocs/index.php index af3636f2b99ac6f6614c9e929282ed45ba4b0d19..3050758b7d166747ae8cd302ba60fb3015516671 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -168,7 +168,9 @@ if (empty($user->societe_id)) ! empty($conf->contrat->enabled) && $user->rights->contrat->activer, ! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), - ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire); + ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + ! empty($conf->projet->enabled) && $user->rights->projet->lire + ); // Class file containing the method load_state_board for each line $includes=array( DOL_DOCUMENT_ROOT."/user/class/user.class.php", @@ -184,7 +186,9 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", - DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php"); + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + DOL_DOCUMENT_ROOT."/projet/class/project.class.php" + ); // Name class containing the method load_state_board for each line $classes=array('User', 'Client', @@ -199,7 +203,9 @@ if (empty($user->societe_id)) 'Contrat', 'CommandeFournisseur', 'FactureFournisseur', - 'ExpenseReport'); + 'ExpenseReport', + 'Project' + ); // Cle array returned by the method load_state_board for each line $keys=array('users', 'customers', @@ -214,7 +220,9 @@ if (empty($user->societe_id)) 'Contracts', 'supplier_orders', 'supplier_invoices', - 'expensereports'); + 'expensereports', + 'projects' + ); // Dashboard Icon lines $icons=array('user', 'company', @@ -229,7 +237,9 @@ if (empty($user->societe_id)) 'order', 'order', 'bill', - 'trip'); + 'trip', + 'project' + ); // Translation keyword $titres=array("Users", "ThirdPartyCustomersStats", @@ -244,7 +254,9 @@ if (empty($user->societe_id)) "Contracts", "SuppliersOrders", "SuppliersInvoices", - "ExpenseReports"); + "ExpenseReports", + "Projects" + ); // Dashboard Link lines $links=array( DOL_URL_ROOT.'/user/index.php', @@ -260,7 +272,9 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/contrat/list.php', DOL_URL_ROOT.'/fourn/commande/list.php', DOL_URL_ROOT.'/fourn/facture/list.php', - DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'); + DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm', + DOL_URL_ROOT.'/projet/list.php?mainmenu=project' + ); // Translation lang files $langfile=array("users", "companies", @@ -273,7 +287,9 @@ if (empty($user->societe_id)) "orders", "bills", "contracts", - "trips"); + "trips", + "projects" + ); // Loop and displays each line of table diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index bf08da2231e490b388521fb69f0aee7a02f584a2..b9a0e8ab55a4f8e05f112180cf11e4547e2d4804 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1664,6 +1664,44 @@ class Project extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + + /** + * Charge indicateurs this->nb pour le tableau de bord + * + * @return int <0 if KO, >0 if OK + */ + function load_state_board() + { + global $conf; + + $this->nb=array(); + + $sql = "SELECT count(u.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."projet as u"; + $sql.= " WHERE"; + //$sql.= " WHERE u.fk_statut > 0"; + //$sql.= " AND employee != 0"; + $sql.= " u.entity IN (".getEntity('projet', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["projects"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + + /** * Is the action delayed? *