Skip to content
Snippets Groups Projects
Commit fd3837e1 authored by Laurent Destailleur's avatar Laurent Destailleur Committed by GitHub
Browse files

Merge pull request #6492 from aspangaro/6.0-donation

NEW Add donations statistics in home statistics
parents e5fc1583 fd0a46c5
Branches
Tags
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * 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> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -804,6 +804,39 @@ class Don extends CommonObject ...@@ -804,6 +804,39 @@ class Don extends CommonObject
return $result; 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) * Return clicable name (with picto eventually)
......
...@@ -158,7 +158,8 @@ if (empty($user->societe_id)) ...@@ -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_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->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->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 // Class file containing the method load_state_board for each line
$includes=array( $includes=array(
...@@ -179,7 +180,8 @@ if (empty($user->societe_id)) ...@@ -179,7 +180,8 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
DOL_DOCUMENT_ROOT."/projet/class/project.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 // Name class containing the method load_state_board for each line
$classes=array('User', $classes=array('User',
...@@ -199,7 +201,8 @@ if (empty($user->societe_id)) ...@@ -199,7 +201,8 @@ if (empty($user->societe_id))
'FactureFournisseur', 'FactureFournisseur',
'SupplierProposal', 'SupplierProposal',
'Project', 'Project',
'ExpenseReport' 'ExpenseReport',
'Don'
); );
// Cle array returned by the method load_state_board for each line // Cle array returned by the method load_state_board for each line
$keys=array('users', $keys=array('users',
...@@ -219,7 +222,8 @@ if (empty($user->societe_id)) ...@@ -219,7 +222,8 @@ if (empty($user->societe_id))
'supplier_invoices', 'supplier_invoices',
'askprice', 'askprice',
'projects', 'projects',
'expensereports' 'expensereports',
'donations'
); );
// Dashboard Icon lines // Dashboard Icon lines
$icons=array('user', $icons=array('user',
...@@ -239,7 +243,8 @@ if (empty($user->societe_id)) ...@@ -239,7 +243,8 @@ if (empty($user->societe_id))
'bill', 'bill',
'propal', 'propal',
'project', 'project',
'trip' 'trip',
'generic'
); );
// Translation keyword // Translation keyword
$titres=array("Users", $titres=array("Users",
...@@ -259,7 +264,8 @@ if (empty($user->societe_id)) ...@@ -259,7 +264,8 @@ if (empty($user->societe_id))
"SuppliersInvoices", "SuppliersInvoices",
"SupplierProposalShort", "SupplierProposalShort",
"Projects", "Projects",
"ExpenseReports" "ExpenseReports",
"Donations"
); );
// Dashboard Link lines // Dashboard Link lines
$links=array( $links=array(
...@@ -280,7 +286,8 @@ if (empty($user->societe_id)) ...@@ -280,7 +286,8 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/fourn/facture/list.php', DOL_URL_ROOT.'/fourn/facture/list.php',
DOL_URL_ROOT.'/supplier_proposal/list.php', DOL_URL_ROOT.'/supplier_proposal/list.php',
DOL_URL_ROOT.'/projet/list.php?mainmenu=project', 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 // Translation lang files
$langfile=array("users", $langfile=array("users",
...@@ -300,7 +307,8 @@ if (empty($user->societe_id)) ...@@ -300,7 +307,8 @@ if (empty($user->societe_id))
"bills", "bills",
"supplier_proposal", "supplier_proposal",
"projects", "projects",
"trips" "trips",
"donations"
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment