diff --git a/db/zentao.sql b/db/zentao.sql index 704a818e5b..8ca08a0424 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -966,8 +966,8 @@ CREATE TABLE IF NOT EXISTS `zt_kanbanregion` ( `order` mediumint(8) NOT NULL DEFAULT '0', `createdBy` char(30) NOT NULL, `createdDate` datetime NOT NULL, - `lastEditedBy` char(30) NOT NULL, - `lastEditedDate` datetime NOT NULL, + `lastEditedBy` char(30) NOT NULL DEFAULT '', + `lastEditedDate` datetime NULL, `deleted` enum('0', '1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/lib/dao/dm.class.php b/lib/dao/dm.class.php index 43a991b677..efeea6b44f 100644 --- a/lib/dao/dm.class.php +++ b/lib/dao/dm.class.php @@ -217,6 +217,20 @@ class dm extends dao return parent::groupBy($groupBy); } + /** + * 创建ORDER BY部分。 + * Create the order by part. + * + * @param string $order + * @access public + * @return static|sql the sql object. + */ + public function orderBy($order) + { + $order = str_replace('"', '', $order); + return parent::orderBy($order); + } + /** * 创建ON部分。 * Create the on part. diff --git a/lib/dbh/dbh.class.php b/lib/dbh/dbh.class.php index 2084729a85..e9cf2d9b73 100644 --- a/lib/dbh/dbh.class.php +++ b/lib/dbh/dbh.class.php @@ -256,6 +256,7 @@ class dbh public function formatDmSQL($sql) { $sql = trim($sql); + $sql = str_replace(array('\r', '\n'), ' ', $sql); $actionPos = strpos($sql, ' '); $action = strtoupper(substr($sql, 0, $actionPos)); $setPos = 0; diff --git a/module/bug/control.php b/module/bug/control.php index e6a755bd70..77e404814d 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -919,7 +919,7 @@ class bug extends control $projects = $this->loadModel('product')->getProjectPairsByProduct($productID, $bug->branch); $this->session->set("project", key($projects), 'project'); - + $this->executeHooks($bugID); /* Header and positon. */ diff --git a/module/project/model.php b/module/project/model.php index bdcdcf62a4..5b42f71382 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -238,14 +238,13 @@ class projectModel extends model ->groupBy('t1.root') ->fetchAll('root'); - $condition = 't2.project as project'; - $estimates = $this->dao->select("$condition, sum(estimate) as estimate")->from(TABLE_TASK)->alias('t1') + $estimates = $this->dao->select("t2.project as project, sum(estimate) as estimate")->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id') ->where('t1.parent')->lt(1) ->andWhere('t2.project')->in($projectIdList) ->andWhere('t1.deleted')->eq(0) ->andWhere('t2.deleted')->eq(0) - ->groupBy('project') + ->groupBy('t2.project') ->fetchAll('project'); $this->app->loadClass('pager', $static = true); diff --git a/module/repo/control.php b/module/repo/control.php index 32ea458c9f..c6f894d54f 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1469,7 +1469,7 @@ class repo extends control } } - $latestInDB = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1') + $latestInDB = $this->dao->select('t1.*')->from(TABLE_REPOHISTORY)->alias('t1') ->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision') ->where('t1.repo')->eq($repoID) ->beginIF($repo->SCM == 'Git' and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi() @@ -1538,7 +1538,7 @@ class repo extends control $this->repo->setRepoBranch($branch); setcookie("syncBranch", $branch, 0, $this->config->webRoot, '', $this->config->cookieSecure, true); - $latestInDB = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1') + $latestInDB = $this->dao->select('t1.*')->from(TABLE_REPOHISTORY)->alias('t1') ->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision') ->where('t1.repo')->eq($repoID) ->beginIF(in_array($repo->SCM, $this->config->repo->gitTypeList) and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi() diff --git a/module/repo/model.php b/module/repo/model.php index 1495a87fd5..abfacaf628 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -780,7 +780,7 @@ class repoModel extends model ->beginIF($begin)->andWhere('t1.time')->ge($begin)->fi() ->beginIF($end)->andWhere('t1.time')->le($end)->fi() ->orderBy('time desc'); - if($entry == '/' or empty($entry))$comments->page($pager, 't1.id'); + if($entry == '/' or empty($entry)) $comments->page($pager, 't1.id'); $comments = $comments->fetchAll('revision'); foreach($comments as $repoComment)