Use dolSqlDateFilter instead of SQL function YEAR
This commit is contained in:
parent
a54a955a65
commit
cfd7c610db
@ -92,7 +92,7 @@ class AdherentStats extends Stats
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE YEAR(p.dateadh) = ".((int) $year);
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
@ -133,7 +133,7 @@ class AdherentStats extends Stats
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE YEAR(p.dateadh) = ".((int) $year);
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
@ -154,7 +154,7 @@ class AdherentStats extends Stats
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE YEAR(p.dateadh) = ".((int) $year);
|
||||
$sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user