diff --git a/lib/dbh/dbh.class.php b/lib/dbh/dbh.class.php index 3ffc1d5622..a8525764b0 100644 --- a/lib/dbh/dbh.class.php +++ b/lib/dbh/dbh.class.php @@ -383,8 +383,8 @@ class dbh case 'dm': /* DATE convert to TO_CHAR. */ $sql = preg_replace("/\bDATE\(([^)]*)\)/", "TO_CHAR($1, 'yyyy-mm-dd')", $sql, -1); - /* DATE_FORMAT convert to TO_CHAR. */ - $sql = preg_replace("/\bDATE_FORMAT\(([^)]*)\)/", "TO_CHAR($1, 'yyyy-mm-dd')", $sql, -1); + /* DATE_FORMAT(openedDate, '%Y-%m-%d') convert to TO_CHAR(openedDate, 'yyyy-mm-dd'). */ + $sql = preg_replace('/DATE_FORMAT\((\w+),\s*'%Y-%m-%d'\)/', "TO_CHAR($1, \'yyyy-mm-dd\')", $sql, -1); return $sql; diff --git a/module/bug/model.php b/module/bug/model.php index 551a4f943b..48cfd52023 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2409,7 +2409,7 @@ class bugModel extends model */ public function getDataOfOpenedBugsPerDay() { - return $this->dao->select('DATE_FORMAT(openedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->reportCondition())->groupBy('name')->orderBy('openedDate')->fetchAll(); + return $this->dao->select("DATE_FORMAT(openedDate, '%Y-%m-%d') AS name, COUNT(*) AS value")->from(TABLE_BUG)->where($this->reportCondition())->groupBy('name')->orderBy('openedDate')->fetchAll(); } /** @@ -2420,7 +2420,7 @@ class bugModel extends model */ public function getDataOfResolvedBugsPerDay() { - return $this->dao->select('DATE_FORMAT(resolvedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG) + return $this->dao->select("DATE_FORMAT(resolvedDate, '%Y-%m-%d') AS name, COUNT(*) AS value")->from(TABLE_BUG) ->where($this->reportCondition())->groupBy('name') ->having('name != 0000-00-00') ->orderBy('resolvedDate') @@ -2435,7 +2435,7 @@ class bugModel extends model */ public function getDataOfClosedBugsPerDay() { - return $this->dao->select('DATE_FORMAT(closedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG) + return $this->dao->select("DATE_FORMAT(closedDate, '%Y-%m-%d') AS name, COUNT(*) AS value")->from(TABLE_BUG) ->where($this->reportCondition())->groupBy('name') ->having('name != 0000-00-00') ->orderBy('closedDate')->fetchAll();