mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix phpunit
This commit is contained in:
commit
e32f0ea2c9
|
|
@ -91,11 +91,11 @@ class DonationStats extends Stats
|
||||||
$this->join = '';
|
$this->join = '';
|
||||||
|
|
||||||
if ($status == 0 || $status == 1 || $status == 2) {
|
if ($status == 0 || $status == 1 || $status == 2) {
|
||||||
$this->where = ' d.fk_statut IN ('.((int) $status).')';
|
$this->where = " d.fk_statut = ".((int) $status);
|
||||||
} elseif ($status == 3) {
|
} elseif ($status == 3) {
|
||||||
$this->where = ' d.fk_statut IN (-1)';
|
$this->where = " d.fk_statut IN (-1)";
|
||||||
} elseif ($status == 4) {
|
} elseif ($status == 4) {
|
||||||
$this->where = ' d.fk_statut >= 0';
|
$this->where = " d.fk_statut >= 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = new Don($this->db);
|
$object = new Don($this->db);
|
||||||
|
|
@ -105,14 +105,14 @@ class DonationStats extends Stats
|
||||||
$this->where .= " AND d.fk_soc = ".((int) $socid);
|
$this->where .= " AND d.fk_soc = ".((int) $socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->where .= " AND d.entity = ".$conf->entity;
|
$this->where .= " AND d.entity = ".((int) $conf->entity);
|
||||||
if ($this->userid > 0) {
|
if ($this->userid > 0) {
|
||||||
$this->where .= ' AND d.fk_user_author = '.((int) $this->userid);
|
$this->where .= ' AND d.fk_user_author = '.((int) $this->userid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($typentid) {
|
if ($typentid) {
|
||||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = d.fk_soc';
|
$this->join .= " LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = d.fk_soc";
|
||||||
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
|
$this->where .= " AND s.fk_typent = ".((int) $typentid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ class DonationStats extends Stats
|
||||||
*/
|
*/
|
||||||
public function getNbByYear()
|
public function getNbByYear()
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(d.datedon,'%Y') as dm, COUNT(*) as nb, SUM(d.".$this->field.")";
|
$sql = "SELECT date_format(d.datedon,'%Y') as dm, COUNT(*) as nb, SUM(d.".$this->db->sanitize($this->field).")";
|
||||||
$sql .= " FROM ".$this->from;
|
$sql .= " FROM ".$this->from;
|
||||||
$sql .= $this->join;
|
$sql .= $this->join;
|
||||||
$sql .= " WHERE ".$this->where;
|
$sql .= " WHERE ".$this->where;
|
||||||
|
|
@ -162,7 +162,7 @@ class DonationStats extends Stats
|
||||||
*/
|
*/
|
||||||
public function getAmountByMonth($year, $format = 0)
|
public function getAmountByMonth($year, $format = 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(d.datedon,'%m') as dm, sum(d.".$this->field.")";
|
$sql = "SELECT date_format(d.datedon,'%m') as dm, sum(d.".$this->db->sanitize($this->field).")";
|
||||||
$sql .= " FROM ".$this->from;
|
$sql .= " FROM ".$this->from;
|
||||||
$sql .= $this->join;
|
$sql .= $this->join;
|
||||||
$sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1);
|
$sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1);
|
||||||
|
|
@ -181,7 +181,7 @@ class DonationStats extends Stats
|
||||||
*/
|
*/
|
||||||
public function getAverageByMonth($year)
|
public function getAverageByMonth($year)
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(d.datedon,'%m') as dm, avg(d.".$this->field.")";
|
$sql = "SELECT date_format(d.datedon,'%m') as dm, avg(d.".$this->db->sanitize($this->field).")";
|
||||||
$sql .= " FROM ".$this->from;
|
$sql .= " FROM ".$this->from;
|
||||||
$sql .= $this->join;
|
$sql .= $this->join;
|
||||||
$sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1);
|
$sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1);
|
||||||
|
|
@ -199,7 +199,7 @@ class DonationStats extends Stats
|
||||||
*/
|
*/
|
||||||
public function getAllByYear()
|
public function getAllByYear()
|
||||||
{
|
{
|
||||||
$sql = "SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->field.") as total, AVG(".$this->field.") as avg";
|
$sql = "SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->db->sanitize($this->field).") as total, AVG(".$this->field.") as avg";
|
||||||
$sql .= " FROM ".$this->from;
|
$sql .= " FROM ".$this->from;
|
||||||
$sql .= $this->join;
|
$sql .= $this->join;
|
||||||
$sql .= " WHERE ".$this->where;
|
$sql .= " WHERE ".$this->where;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user