diff --git a/lib/dao/dao.class.php b/lib/dao/dao.class.php index db29797b18..c41ea6fa78 100755 --- a/lib/dao/dao.class.php +++ b/lib/dao/dao.class.php @@ -249,10 +249,33 @@ class dao */ public function count() { - $this->setMode('raw'); - $this->setMethod('select'); - $this->sqlobj = sql::select('count(*) as count'); - return $this; + /* Get the SELECT, FROM position, thus get the fields, replace it by count(*). */ + $sql = $this->processSQL(); + $sql = str_replace('SELECT', 'SELECT SQL_CALC_FOUND_ROWS ', $sql); + + /* Remove the part after order and limit. */ + $subLength = strlen($sql); + $orderPOS = strripos($sql, DAO::ORDERBY); + $limitPOS = strripos($sql , DAO::LIMIT); + if($limitPOS) $subLength = $limitPOS; + if($orderPOS) $subLength = $orderPOS; + $sql = substr($sql, 0, $subLength); + self::$querys[] = $sql; + + /* Get the records count. */ + try + { + $row = $this->dbh->query($sql)->fetch(PDO::FETCH_OBJ); + } + catch (PDOException $e) + { + $this->app->triggerError($e->getMessage() . "
The sql is: $sql
", __FILE__, __LINE__, $exit = true); + } + + $sql = 'SELECT FOUND_ROWS() as recTotal;'; + $row = $this->dbh->query($sql)->fetch(); + + return $row->recTotal; } /** diff --git a/module/bug/control.php b/module/bug/control.php index 62f747a926..a779e40a9c 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -737,7 +737,6 @@ class bug extends control $bug = $this->bug->getById($bugID); $productID = $bug->product; - $bugs = $this->bug->getProductBugPairs($productID); $this->bug->setMenu($this->products, $productID); $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve; @@ -745,7 +744,6 @@ class bug extends control $this->view->position[] = $this->lang->bug->resolve; $this->view->bug = $bug; - $this->view->bugs = $bugs; $this->view->users = $this->user->getPairs('nodeleted', $bug->openedBy); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); $this->view->actions = $this->action->getList('bug', $bugID); diff --git a/module/custom/control.php b/module/custom/control.php index 044809ba13..351760421b 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -36,12 +36,13 @@ class custom extends control $currentLang = $this->app->getClientLang(); $this->app->loadLang($module); + $this->app->loadConfig('story'); $fieldList = $this->lang->$module->$field; if(!empty($_POST)) { if($module == 'story' && $field == 'review') { - $this->loadModel('setting')->setItem('system.common.storyReview.needReview', $_POST['needReview']); + $this->loadModel('setting')->setItem('system.story.needReview', fixer::input('post')->get()->needReview); } else { @@ -66,7 +67,7 @@ class custom extends control $this->view->title = $this->lang->custom->common . $this->lang->colon . $this->lang->$module->common; $this->view->position[] = $this->lang->custom->common; $this->view->position[] = $this->lang->$module->common; - $this->view->needReview = isset($this->config->storyReview->needReview) ? $this->config->storyReview->needReview : 1; + $this->view->needReview = $this->config->story->needReview; $this->view->fieldList = $fieldList; $this->view->dbFields = $this->custom->getItems("lang=$currentLang,all&module=$module§ion=$field"); $this->view->field = $field; diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index b871626fca..70f4eadb9c 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -18,10 +18,10 @@ $lang->custom->story = new stdClass(); $lang->custom->story->fields['priList'] = 'Priority'; $lang->custom->story->fields['sourceList'] = 'Source'; $lang->custom->story->fields['reasonList'] = 'Closed reason'; -$lang->custom->story->fields['reviewResultList'] = 'Reviewed result'; $lang->custom->story->fields['stageList'] = 'Stage'; $lang->custom->story->fields['statusList'] = 'Status'; -$lang->custom->story->fields['review'] = 'Review'; +$lang->custom->story->fields['reviewResultList'] = 'Reviewed result'; +$lang->custom->story->fields['review'] = 'Reviewed procedure'; $lang->custom->task = new stdClass(); $lang->custom->task->fields['priList'] = 'Priority'; @@ -66,6 +66,6 @@ $lang->custom->confirmRestore = 'Are you sure to restore the default lang settin $lang->custom->notice = new stdclass(); $lang->custom->notice->userRole = 'The length of key must be less than 20!'; -$lang->custom->storyReview = 'Story review'; +$lang->custom->storyReview = 'Reviewed procedure'; $lang->custom->reviewList[1] = 'Open'; $lang->custom->reviewList[0] = 'Close'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index b505c34f1f..fe98f37a0a 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -18,10 +18,10 @@ $lang->custom->story = new stdClass(); $lang->custom->story->fields['priList'] = '优先级'; $lang->custom->story->fields['sourceList'] = '来源'; $lang->custom->story->fields['reasonList'] = '关闭原因'; -$lang->custom->story->fields['reviewResultList'] = '评审结果'; $lang->custom->story->fields['stageList'] = '阶段'; $lang->custom->story->fields['statusList'] = '状态'; -$lang->custom->story->fields['review'] = '评审'; +$lang->custom->story->fields['reviewResultList'] = '评审结果'; +$lang->custom->story->fields['review'] = '评审流程'; $lang->custom->task = new stdClass(); $lang->custom->task->fields['priList'] = '优先级'; @@ -66,6 +66,6 @@ $lang->custom->confirmRestore = '是否要恢复默认语言配置?'; $lang->custom->notice = new stdclass(); $lang->custom->notice->userRole = '键的长度必须小于20个字符!'; -$lang->custom->storyReview = '需求评审'; +$lang->custom->storyReview = '评审流程'; $lang->custom->reviewList[1] = '开启'; $lang->custom->reviewList[0] = '关闭'; diff --git a/module/story/config.php b/module/story/config.php index 19bf4576cf..28b49bfbab 100644 --- a/module/story/config.php +++ b/module/story/config.php @@ -3,6 +3,7 @@ $config->story = new stdclass(); $config->story->batchCreate = 10; $config->story->affectedFixedNum = 7; +$config->story->needReview = 1; $config->story->batchEdit = new stdclass(); $config->story->batchEdit->columns = 11; diff --git a/module/story/control.php b/module/story/control.php index 2a46f856c5..ff027fa5cd 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -179,7 +179,7 @@ class story extends control $this->view->verify = $verify; $this->view->keywords = $keywords; $this->view->mailto = $mailto; - $this->view->needReview = ($projectID > 0 || (isset($this->config->storyReview->needReview) && $this->config->storyReview->needReview == 0 )) ? "checked='checked'" : ""; + $this->view->needReview = ($projectID > 0 || $this->config->story->needReview == 0) ? "checked='checked'" : ""; $this->display(); } @@ -438,7 +438,7 @@ class story extends control $this->view->title = $this->lang->story->change . "STORY" . $this->lang->colon . $this->view->story->title; $this->view->users = $this->user->getPairs('nodeleted|pofirst', $this->view->story->assignedTo); $this->view->position[] = $this->lang->story->change; - $this->view->needReview = (isset($this->config->storyReview->needReview) && $this->config->storyReview->needReview == 0) ? "checked='checked'" : ""; + $this->view->needReview = $this->config->story->needReview == 0 ? "checked='checked'" : ""; $this->display(); } @@ -638,7 +638,6 @@ class story extends control /* Get story and product. */ $story = $this->story->getById($storyID); $product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id')->fetch(); - $stories = $this->story->getProductStoryPairs($product->id); /* Set menu. */ $this->product->setMenu($this->product->getPairs(), $product->id); @@ -653,7 +652,6 @@ class story extends control $this->view->product = $product; $this->view->story = $story; - $this->view->stories = $stories; $this->view->actions = $this->action->getList('story', $storyID); $this->view->users = $this->loadModel('user')->getPairs(); $this->display();