mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Implemente les stats de comptage de facture, propal et commande sur la page accueil des rsum stats, ce qui permet de supprimer la page stats.php qui fait double emploi et qui n'ait pas au norme de dev ni scurise.
This commit is contained in:
@@ -2266,6 +2266,46 @@ class Commande extends CommonObject
|
||||
$this->total_ttc = $xnbp*119.6;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Charge indicateurs this->nb de tableau de bord
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->nb=array();
|
||||
|
||||
$sql = "SELECT count(co.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as co";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = co.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
||||
}
|
||||
$sql.= " WHERE 1 = 1";
|
||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= " AND IFNULL(c.visible,1)=1";
|
||||
}
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["orders"]=$obj->nb;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user