Merge pull request #5078 from atm-maxime/new_stats_on_home
New stats on home (contacts and interventions)
This commit is contained in:
commit
143a70c893
@ -107,6 +107,47 @@ class Contact extends CommonObject
|
||||
$this->db = $db;
|
||||
$this->statut = 1; // By default, status is enabled
|
||||
}
|
||||
|
||||
/**
|
||||
* Load indicators into this->nb for board
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
$clause = "WHERE";
|
||||
|
||||
$sql = "SELECT count(sp.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (sp.fk_soc = s.rowid)";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= ' '.$clause.' s.entity IN ('.getEntity($this->element, 1).')';
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["contacts"]=$obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a contact into database
|
||||
|
||||
@ -89,6 +89,46 @@ class Fichinter extends CommonObject
|
||||
$this->statuts_logo[3]='statut4';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load indicators into this->nb for board
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
$clause = "WHERE";
|
||||
|
||||
$sql = "SELECT count(fi.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as fi";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element, 1).")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["fichinters"]=$obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an intervention into data base
|
||||
|
||||
@ -162,6 +162,7 @@ if (empty($user->societe_id))
|
||||
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
|
||||
! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
|
||||
! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
|
||||
! empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
|
||||
! empty($conf->adherent->enabled) && $user->rights->adherent->lire,
|
||||
! empty($conf->product->enabled) && $user->rights->produit->lire,
|
||||
! empty($conf->service->enabled) && $user->rights->service->lire,
|
||||
@ -169,6 +170,7 @@ if (empty($user->societe_id))
|
||||
! empty($conf->commande->enabled) && $user->rights->commande->lire,
|
||||
! empty($conf->facture->enabled) && $user->rights->facture->lire,
|
||||
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
|
||||
! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
|
||||
! 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->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
|
||||
@ -181,6 +183,7 @@ if (empty($user->societe_id))
|
||||
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."/contact/class/contact.class.php",
|
||||
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
|
||||
DOL_DOCUMENT_ROOT."/product/class/product.class.php",
|
||||
DOL_DOCUMENT_ROOT."/product/class/service.class.php",
|
||||
@ -188,6 +191,7 @@ if (empty($user->societe_id))
|
||||
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
|
||||
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
|
||||
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
|
||||
DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
|
||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
|
||||
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
|
||||
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
|
||||
@ -199,6 +203,7 @@ if (empty($user->societe_id))
|
||||
'Client',
|
||||
'Client',
|
||||
'Fournisseur',
|
||||
'Contact',
|
||||
'Adherent',
|
||||
'Product',
|
||||
'Service',
|
||||
@ -206,6 +211,7 @@ if (empty($user->societe_id))
|
||||
'Commande',
|
||||
'Facture',
|
||||
'Contrat',
|
||||
'Fichinter',
|
||||
'CommandeFournisseur',
|
||||
'FactureFournisseur',
|
||||
'SupplierProposal',
|
||||
@ -217,6 +223,7 @@ if (empty($user->societe_id))
|
||||
'customers',
|
||||
'prospects',
|
||||
'suppliers',
|
||||
'contacts',
|
||||
'members',
|
||||
'products',
|
||||
'services',
|
||||
@ -224,6 +231,7 @@ if (empty($user->societe_id))
|
||||
'orders',
|
||||
'invoices',
|
||||
'Contracts',
|
||||
'fichinters',
|
||||
'supplier_orders',
|
||||
'supplier_invoices',
|
||||
'askprice',
|
||||
@ -235,6 +243,7 @@ if (empty($user->societe_id))
|
||||
'company',
|
||||
'company',
|
||||
'company',
|
||||
'contact',
|
||||
'user',
|
||||
'product',
|
||||
'service',
|
||||
@ -243,6 +252,7 @@ if (empty($user->societe_id))
|
||||
'bill',
|
||||
'order',
|
||||
'order',
|
||||
'order',
|
||||
'bill',
|
||||
'propal',
|
||||
'trip',
|
||||
@ -253,6 +263,7 @@ if (empty($user->societe_id))
|
||||
"ThirdPartyCustomersStats",
|
||||
"ThirdPartyProspectsStats",
|
||||
"Suppliers",
|
||||
"Contacts",
|
||||
"Members",
|
||||
"Products",
|
||||
"Services",
|
||||
@ -260,6 +271,7 @@ if (empty($user->societe_id))
|
||||
"CustomersOrders",
|
||||
"BillsCustomers",
|
||||
"Contracts",
|
||||
"Interventions",
|
||||
"SuppliersOrders",
|
||||
"SuppliersInvoices",
|
||||
"SupplierProposalShort",
|
||||
@ -272,6 +284,7 @@ if (empty($user->societe_id))
|
||||
DOL_URL_ROOT.'/societe/list.php?type=c',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=p',
|
||||
DOL_URL_ROOT.'/societe/list.php?type=f',
|
||||
DOL_URL_ROOT.'/contact/list.php',
|
||||
DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
|
||||
DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
|
||||
DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
|
||||
@ -279,6 +292,7 @@ if (empty($user->societe_id))
|
||||
DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial',
|
||||
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
|
||||
DOL_URL_ROOT.'/contrat/list.php',
|
||||
DOL_URL_ROOT.'/fichinter/list.php',
|
||||
DOL_URL_ROOT.'/fourn/commande/list.php',
|
||||
DOL_URL_ROOT.'/fourn/facture/list.php',
|
||||
DOL_URL_ROOT.'/supplier_proposal/list.php',
|
||||
@ -290,6 +304,7 @@ if (empty($user->societe_id))
|
||||
"companies",
|
||||
"prospects",
|
||||
"suppliers",
|
||||
"companies",
|
||||
"members",
|
||||
"products",
|
||||
"produts",
|
||||
@ -298,6 +313,7 @@ if (empty($user->societe_id))
|
||||
"bills",
|
||||
"supplier_proposal",
|
||||
"contracts",
|
||||
"interventions",
|
||||
"trips",
|
||||
"projects"
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user