forked from Wavyzz/dolibarr
code syntax fichinter directory
This commit is contained in:
@@ -64,8 +64,7 @@ class FichinterStats extends Stats
|
||||
$this->userid = $userid;
|
||||
$this->cachefilesuffix = $mode;
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
if ($mode == 'customer') {
|
||||
$object = new Fichinter($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
@@ -73,14 +72,17 @@ class FichinterStats extends Stats
|
||||
$this->field_line = '0';
|
||||
//$this->where.= " AND c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$this->where .= ($this->where ? ' AND ' : '')."c.entity IN (".getEntity('fichinter').')';
|
||||
|
||||
if ($this->socid)
|
||||
{
|
||||
if ($this->socid) {
|
||||
$this->where .= " AND c.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where .= ' AND c.fk_user_author = '.$this->userid;
|
||||
if ($this->userid > 0) {
|
||||
$this->where .= ' AND c.fk_user_author = '.$this->userid;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +98,9 @@ class FichinterStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -118,7 +122,9 @@ class FichinterStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%Y') as dm, COUNT(*) as nb, 0";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
@@ -139,7 +145,9 @@ class FichinterStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, 0";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -161,7 +169,9 @@ class FichinterStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, 0";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
@@ -181,7 +191,9 @@ class FichinterStats extends Stats
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%Y') as year, COUNT(*) as nb, 0 as total, 0 as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
Reference in New Issue
Block a user