Skip to content
Snippets Groups Projects
Commit 9d3451b3 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW Add thumb of users into thumbs stats on home page

parent ff4f1e7a
No related branches found
No related tags found
No related merge requests found
...@@ -1503,7 +1503,6 @@ class ExpenseReport extends CommonObject ...@@ -1503,7 +1503,6 @@ class ExpenseReport extends CommonObject
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
} }
/** /**
......
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
...@@ -146,6 +146,7 @@ if (empty($user->societe_id)) ...@@ -146,6 +146,7 @@ if (empty($user->societe_id))
{ {
// Condition to be checked for each display line dashboard // Condition to be checked for each display line dashboard
$conditions=array( $conditions=array(
$user->rights->user->user->lire,
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), ! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
...@@ -160,7 +161,9 @@ if (empty($user->societe_id)) ...@@ -160,7 +161,9 @@ if (empty($user->societe_id))
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire, ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire,
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire); ! empty($conf->expensereport->enabled) && $user->rights->expensereport->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(DOL_DOCUMENT_ROOT."/societe/class/client.class.php", $includes=array(
DOL_DOCUMENT_ROOT."/user/class/user.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/societe/class/client.class.php", DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
...@@ -174,7 +177,8 @@ if (empty($user->societe_id)) ...@@ -174,7 +177,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."/expensereport/class/expensereport.class.php"); DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.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('Client', $classes=array('User',
'Client',
'Client', 'Client',
'Fournisseur', 'Fournisseur',
'Adherent', 'Adherent',
...@@ -188,7 +192,8 @@ if (empty($user->societe_id)) ...@@ -188,7 +192,8 @@ if (empty($user->societe_id))
'FactureFournisseur', 'FactureFournisseur',
'ExpenseReport'); 'ExpenseReport');
// 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('customers', $keys=array('users',
'customers',
'prospects', 'prospects',
'suppliers', 'suppliers',
'members', 'members',
...@@ -202,7 +207,8 @@ if (empty($user->societe_id)) ...@@ -202,7 +207,8 @@ if (empty($user->societe_id))
'supplier_invoices', 'supplier_invoices',
'expensereports'); 'expensereports');
// Dashboard Icon lines // Dashboard Icon lines
$icons=array('company', $icons=array('user',
'company',
'company', 'company',
'company', 'company',
'user', 'user',
...@@ -216,7 +222,8 @@ if (empty($user->societe_id)) ...@@ -216,7 +222,8 @@ if (empty($user->societe_id))
'bill', 'bill',
'trip'); 'trip');
// Translation keyword // Translation keyword
$titres=array("ThirdPartyCustomersStats", $titres=array("Users",
"ThirdPartyCustomersStats",
"ThirdPartyProspectsStats", "ThirdPartyProspectsStats",
"Suppliers", "Suppliers",
"Members", "Members",
...@@ -231,6 +238,7 @@ if (empty($user->societe_id)) ...@@ -231,6 +238,7 @@ if (empty($user->societe_id))
"ExpenseReports"); "ExpenseReports");
// Dashboard Link lines // Dashboard Link lines
$links=array( $links=array(
DOL_URL_ROOT.'/user/list.php',
DOL_URL_ROOT.'/societe/list.php?type=c', DOL_URL_ROOT.'/societe/list.php?type=c',
DOL_URL_ROOT.'/societe/list.php?type=p', DOL_URL_ROOT.'/societe/list.php?type=p',
DOL_URL_ROOT.'/societe/list.php?type=f', DOL_URL_ROOT.'/societe/list.php?type=f',
...@@ -245,7 +253,8 @@ if (empty($user->societe_id)) ...@@ -245,7 +253,8 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/fourn/facture/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');
// Translation lang files // Translation lang files
$langfile=array("companies", $langfile=array("users",
"companies",
"prospects", "prospects",
"suppliers", "suppliers",
"members", "members",
......
...@@ -2578,5 +2578,41 @@ class User extends CommonObject ...@@ -2578,5 +2578,41 @@ class User extends CommonObject
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); 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."user as u";
$sql.= " WHERE u.statut > 0";
$sql.= " AND u.entity IN (".getEntity('user', 1).")";
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$this->nb["users"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
return -1;
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment