diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index f69cb1b5331acc71d46e32217cfb291be8d8b78b..26dd397c913ea3e6ced1a479f54ac7b4bf48e20f 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -32,7 +32,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; /** * Class to describe and enable module Donation */ -class modDon extends DolibarrModules +class modDon extends DolibarrModules { /** diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index d7e4d84baab11683a0a1b5262985cf097f2ca9cd..74349a16271e50ce52de341318b825cd7570aade 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> - * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> + * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * * This program is free software; you can redistribute it and/or modify @@ -804,6 +804,39 @@ class Don extends CommonObject return $result; } + /** + * 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(d.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; + $sql.= " WHERE d.fk_statut > 0"; + $sql.= " AND d.entity IN (".getEntity('don', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["donations"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } /** * Return clicable name (with picto eventually) diff --git a/htdocs/index.php b/htdocs/index.php index 0fec7ea11d532b61c42d5f4114e41f5e39785203..ee7d2ea7e04dfdad3806c16a4f207c20d99fc64f 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -158,7 +158,8 @@ if (empty($user->societe_id)) ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), ! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), ! empty($conf->projet->enabled) && $user->rights->projet->lire, - ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire + ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + ! empty($conf->don->enabled) && $user->rights->don->lire ); // Class file containing the method load_state_board for each line $includes=array( @@ -179,7 +180,8 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", DOL_DOCUMENT_ROOT."/projet/class/project.class.php", - DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php" + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + DOL_DOCUMENT_ROOT."/don/class/don.class.php" ); // Name class containing the method load_state_board for each line $classes=array('User', @@ -199,7 +201,8 @@ if (empty($user->societe_id)) 'FactureFournisseur', 'SupplierProposal', 'Project', - 'ExpenseReport' + 'ExpenseReport', + 'Don' ); // Cle array returned by the method load_state_board for each line $keys=array('users', @@ -219,7 +222,8 @@ if (empty($user->societe_id)) 'supplier_invoices', 'askprice', 'projects', - 'expensereports' + 'expensereports', + 'donations' ); // Dashboard Icon lines $icons=array('user', @@ -239,7 +243,8 @@ if (empty($user->societe_id)) 'bill', 'propal', 'project', - 'trip' + 'trip', + 'generic' ); // Translation keyword $titres=array("Users", @@ -259,7 +264,8 @@ if (empty($user->societe_id)) "SuppliersInvoices", "SupplierProposalShort", "Projects", - "ExpenseReports" + "ExpenseReports", + "Donations" ); // Dashboard Link lines $links=array( @@ -280,7 +286,8 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/fourn/facture/list.php', DOL_URL_ROOT.'/supplier_proposal/list.php', DOL_URL_ROOT.'/projet/list.php?mainmenu=project', - DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm' + DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm', + DOL_URL_ROOT.'/don/list.php?leftmenu=donations' ); // Translation lang files $langfile=array("users", @@ -300,7 +307,8 @@ if (empty($user->societe_id)) "bills", "supplier_proposal", "projects", - "trips" + "trips", + "donations" );