New : add donations statistics in home statistics

This commit is contained in:
Alexandre SPANGARO 2017-03-07 22:31:34 +01:00
parent 4e4045d18a
commit fd0a46c5cf
3 changed files with 51 additions and 10 deletions

View File

@ -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
{
/**

View File

@ -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)

View File

@ -159,7 +159,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(
@ -180,7 +181,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',
@ -200,7 +202,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',
@ -220,7 +223,8 @@ if (empty($user->societe_id))
'supplier_invoices',
'askprice',
'projects',
'expensereports'
'expensereports',
'donations'
);
// Dashboard Icon lines
$icons=array('user',
@ -240,7 +244,8 @@ if (empty($user->societe_id))
'bill',
'propal',
'project',
'trip'
'trip',
'generic'
);
// Translation keyword
$titres=array("Users",
@ -260,7 +265,8 @@ if (empty($user->societe_id))
"SuppliersInvoices",
"SupplierProposalShort",
"Projects",
"ExpenseReports"
"ExpenseReports",
"Donations"
);
// Dashboard Link lines
$links=array(
@ -281,7 +287,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",
@ -301,7 +308,8 @@ if (empty($user->societe_id))
"bills",
"supplier_proposal",
"projects",
"trips"
"trips",
"donations"
);