From c64dd977ae0d8a59ea2bf483599b606e5de13931 Mon Sep 17 00:00:00 2001 From: pengjiangxiu Date: Thu, 9 Mar 2017 17:01:31 +0800 Subject: [PATCH] * finish task #2917. --- db/update9.0.1.sql | 1 + module/bug/config.php | 2 ++ module/bug/lang/zh-cn.php | 3 +++ module/bug/model.php | 38 +++++++++++++++++++++++++++++ module/bug/view/browse.html.php | 4 +-- module/bug/view/browsedata.html.php | 3 ++- module/bug/view/edit.html.php | 5 ++++ module/bug/view/view.html.php | 4 +++ module/search/model.php | 2 +- 9 files changed, 58 insertions(+), 4 deletions(-) diff --git a/db/update9.0.1.sql b/db/update9.0.1.sql index aa3d7fae3c..7b93fc65f2 100644 --- a/db/update9.0.1.sql +++ b/db/update9.0.1.sql @@ -46,3 +46,4 @@ CREATE TABLE `zt_testreport` ( `deleted` enum('0','1') NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; +ALTER TABLE `zt_bug` ADD `deadline` date NOT NULL; diff --git a/module/bug/config.php b/module/bug/config.php index 69a1f721d9..d87903e5ef 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -99,6 +99,7 @@ $config->bug->search['fields']['assignedDate'] = $lang->bug->assignedDate; $config->bug->search['fields']['resolvedDate'] = $lang->bug->resolvedDate; $config->bug->search['fields']['closedDate'] = $lang->bug->closedDate; $config->bug->search['fields']['lastEditedDate'] = $lang->bug->lastEditedDateAB; +$config->bug->search['fields']['deadline'] = $lang->bug->deadline; $config->bug->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->bug->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); @@ -141,6 +142,7 @@ $config->bug->search['params']['assignedDate'] = array('operator' => '=', $config->bug->search['params']['resolvedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->search['params']['lastEditedDate']= array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->bug->search['params']['deadline'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->datatable = new stdclass(); $config->bug->datatable->defaultField = array('id', 'severity', 'pri', 'title', 'status', 'openedBy', 'openedDate', 'assignedTo', 'resolvedBy', 'resolution', 'resolvedDate', 'actions'); diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index 48f09bf924..a86d3a4c91 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -49,6 +49,7 @@ $lang->bug->resolutionAB = '方案'; $lang->bug->resolvedBuild = '解决版本'; $lang->bug->resolvedDate = '解决日期'; $lang->bug->resolvedDateAB = '解决日期'; +$lang->bug->deadline = '截止日期'; $lang->bug->closedBy = '由谁关闭'; $lang->bug->closedDate = '关闭日期'; $lang->bug->duplicateBug = '重复ID'; @@ -105,6 +106,7 @@ $lang->bug->toClosed = '待关闭'; $lang->bug->unclosed = '未关闭'; $lang->bug->longLifeBugs = '久未处理'; $lang->bug->postponedBugs = '被延期'; +$lang->bug->overdueBugs = '过期Bug'; $lang->bug->allBugs = '所有'; $lang->bug->byQuery = '搜索'; $lang->bug->needConfirm = '需求变动'; @@ -365,4 +367,5 @@ $lang->bug->featureBar['browse']['unresolved'] = $lang->bug->unResolved; $lang->bug->featureBar['browse']['toclosed'] = $lang->bug->toClosed; $lang->bug->featureBar['browse']['longlifebugs'] = $lang->bug->longLifeBugs; $lang->bug->featureBar['browse']['postponedbugs'] = $lang->bug->postponedBugs; +$lang->bug->featureBar['browse']['overdueBugs'] = $lang->bug->overdueBugs; $lang->bug->featureBar['browse']['needconfirm'] = $lang->bug->needConfirm; diff --git a/module/bug/model.php b/module/bug/model.php index 2622376624..abbb422b14 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -244,6 +244,17 @@ class bugModel extends model elseif($browseType == 'postponedbugs') $bugs = $this->getByPostponedbugs($productID, $branch, $modules, $projects, $sort, $pager); elseif($browseType == 'needconfirm') $bugs = $this->getByNeedconfirm($productID, $branch, $modules, $projects, $sort, $pager); elseif($browseType == 'bysearch') $bugs = $this->getBySearch($productID, $queryID, $sort, $pager, $branch); + elseif($browseType == 'overduebugs') $bugs = $this->getByOverdueBugs($productID, $branch, $modules, $projects, $sort, $pager); + + /* Delayed or not?. */ + foreach ($bugs as $bug) + { + if($bug->deadline != '0000-00-00') + { + $delay = helper::diffDate(helper::today(), $bug->deadline); + if($delay > 0) $bug->delay = $delay; + } + } return $bugs; } @@ -1896,6 +1907,33 @@ class bugModel extends model ->orderBy($orderBy)->page($pager)->fetchAll(); } + /** + * Get bugs the overdueBugs is active or unclosed. + * + * @param int $productID + * @param int $branch + * @param array $modules + * @param array $projects + * @param string $status + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getByOverdueBugs($productID,$branch,$modules, $projects, $orderBy, $pager) + { + return $this->dao->select('*')->from(TABLE_BUG) + ->where('project')->in(array_keys($projects)) + ->andWhere('product')->eq($productID) + ->andWhere('status')->ne('closed') + ->beginIF($branch)->andWhere('branch')->in($branch)->fi() + ->beginIF($modules)->andWhere('module')->in($modules)->fi() + ->andWhere('deleted')->eq(0) + ->andWhere('deadline')->ne('0000-00-00') + ->andWhere('deadline')->lt(helper::today()) + ->orderBy($orderBy)->page($pager)->fetchAll(); + } + /** * Get bugs the status is active or unclosed. * diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 4b773a9d01..e95089896a 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -120,8 +120,8 @@ js::set('bugBrowseType', ($browseType == 'bymodule' and $this->session->bugBrows cookie->windowWidth >= $this->config->wideSize ? 12 : 10; - if($browseType == 'needconfirm') $columns = 7; + $columns = $this->cookie->windowWidth >= $this->config->wideSize ? 13 : 11; + if($browseType == 'needconfirm') $columns = 8; ?> diff --git a/module/bug/view/browsedata.html.php b/module/bug/view/browsedata.html.php index e41d249dde..b20ee586bc 100644 --- a/module/bug/view/browsedata.html.php +++ b/module/bug/view/browsedata.html.php @@ -18,6 +18,7 @@ priAB);?> bug->title);?> bug->statusAB);?> + bug->deadline);?> bug->story);?> @@ -76,7 +77,7 @@ } ?> - + deadline, 0, 4) > 0) echo substr($bug->deadline, 5, 6)?> createLink('story', 'view', "stoyID=$bug->story"), $bug->storyTitle, '_blank');?> bug->confirmStoryChange = $lang->confirm; common::printIcon('bug', 'confirmStoryChange', "bugID=$bug->id", '', 'list', '', 'hiddenwin')?> diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index 97bc2f8bf9..c30025a883 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -12,6 +12,7 @@ ?> resolvedBuild); + + bug->deadline;?> + deadline, "class='form-control form-date'");?> + bug->resolvedBy;?> resolvedBy, "class='form-control chosen'");?> diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index e2614ed586..5d29a4b0ec 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -250,6 +250,10 @@ ?> + + bug->deadline;?> + deadline) echo $bug->deadline;?> + bug->lblResolved;?> resolvedBy) echo $users[$bug->resolvedBy] . $lang->at . $bug->resolvedDate;?> diff --git a/module/search/model.php b/module/search/model.php index fd2928f39f..0780a350e4 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -110,7 +110,7 @@ class searchModel extends model /* Set filed name. */ if($operator == '=' and preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/', $value)) { - $condition = '`' . $this->post->$fieldName . "` >= '$value' AND `" . $this->post->$fieldName . "` <= '$value 24:00:00'"; + $condition = '`' . $this->post->$fieldName . "` >= '$value' AND `" . $this->post->$fieldName . "` <= '$value 23:59:59'"; $where .= " $andOr ($condition)"; } elseif($condition)