From 95d5a1088b63ee7cd7d955bfd80131a3991dd967 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jun 2018 16:49:14 +0200 Subject: [PATCH] Fix error on sql error (field does not exists) --- htdocs/projet/class/projectstats.class.php | 1 + htdocs/projet/class/taskstats.class.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 5643533239f..413ffa6be5e 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -143,6 +143,7 @@ class ProjectStats extends Stats if (! empty($this->userid)) $sqlwhere[] = ' t.fk_user_resp=' . $this->userid; + // Forced filter on socid is similar to forced filter on project. TODO Use project assignement to allow to not use filter on project if (! empty($this->socid)) $sqlwhere[] = ' t.fk_soc=' . $this->socid; if (! empty($this->year) && empty($this->yearmonth)) diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index c3add03828c..20a3a67d1d3 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -138,8 +138,9 @@ class TaskStats extends Stats if (! empty($this->userid)) $sqlwhere[] = ' t.fk_user_resp=' . $this->userid; + // Forced filter on socid is similar to forced filter on project. TODO Use project assignement to allow to not use filter on project if (! empty($this->socid)) - $sqlwhere[] = ' t.fk_soc=' . $this->socid; + $sqlwhere[] = ' p.fk_soc=' . $this->socid; // Link on thirdparty is on project, not on task if (! empty($this->year) && empty($this->yearmonth)) $sqlwhere[] = " date_format(t.datec,'%Y')='" . $this->db->escape($this->year) . "'"; if (! empty($this->yearmonth))