From 4e84e5cbd71258d7ec62af8e6a084430f7dbc330 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Thu, 17 Feb 2022 17:35:11 +0800 Subject: [PATCH] * Finish task #49284. --- db/update16.4.sql | 2 ++ db/zentao.sql | 3 ++- module/bug/config.php | 2 ++ module/bug/model.php | 2 +- module/execution/config.php | 2 ++ module/product/config.php | 2 ++ module/story/config.php | 5 +++++ module/story/lang/zh-cn.php | 1 + module/story/model.php | 1 + module/task/config.php | 5 +++++ module/task/lang/zh-cn.php | 1 + module/task/model.php | 1 + module/upgrade/model.php | 26 ++++++++++++++++++++++++++ 13 files changed, 51 insertions(+), 2 deletions(-) diff --git a/db/update16.4.sql b/db/update16.4.sql index 1868e6b66c..b3d36f62ff 100644 --- a/db/update16.4.sql +++ b/db/update16.4.sql @@ -16,3 +16,5 @@ ALTER TABLE `zt_block` ADD `vision` varchar(10) NOT NULL DEFAULT 'rnd' AFTER `ac ALTER TABLE `zt_block` DROP INDEX `account_module_type_order`, ADD UNIQUE `account_vision_module_type_order` (`account`, `vision`, `module`, `type`, `order`); ALTER TABLE `zt_effort` ADD `vision` varchar(10) NOT NULL DEFAULT 'rnd' AFTER `id`; ALTER TABLE `zt_story` ADD `vision` varchar(10) NOT NULL DEFAULT 'rnd' AFTER `id`; +ALTER TABLE `zt_story` ADD `activatedDate` datetime NOT NULL DEFAULT '0000-00-00' AFTER `deleted`; +ALTER TABLE `zt_task` MODIFY `activatedDate` datetime NOT NULL; diff --git a/db/zentao.sql b/db/zentao.sql index 0b860bcaca..287a433090 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -1293,6 +1293,7 @@ CREATE TABLE IF NOT EXISTS `zt_story` ( `closedBy` varchar(30) NOT NULL default '', `closedDate` datetime NOT NULL, `closedReason` varchar(30) NOT NULL, + `activatedDate` datetime NOT NULL, `toBug` mediumint(8) unsigned NOT NULL, `childStories` varchar(255) NOT NULL, `linkStories` varchar(255) NOT NULL, @@ -1395,7 +1396,7 @@ CREATE TABLE IF NOT EXISTS `zt_task` ( `closedReason` varchar(30) NOT NULL, `lastEditedBy` varchar(30) NOT NULL, `lastEditedDate` datetime NOT NULL, - `activatedDate` date NOT NULL, + `activatedDate` datetime NOT NULL, `repo` mediumint(8) unsigned NOT NULL, `mr` mediumint(8) unsigned NOT NULL, `entry` varchar(255) NOT NULL, diff --git a/module/bug/config.php b/module/bug/config.php index 034f24bc42..4d51c0c15b 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -105,6 +105,7 @@ $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['fields']['activatedDate'] = $lang->bug->activatedDate; $config->bug->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->bug->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); @@ -149,6 +150,7 @@ $config->bug->search['params']['resolvedDate'] = array('operator' => '=', $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->search['params']['activatedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->datatable = new stdclass(); $config->bug->datatable->defaultField = array('id', 'severity', 'pri', 'confirmed', 'title', 'status', 'openedBy', 'openedDate', 'assignedTo', 'resolution', 'actions'); diff --git a/module/bug/model.php b/module/bug/model.php index 65a8a45bcb..fc0121c831 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1365,7 +1365,7 @@ class bugModel extends model if($browseType == 'bySearch') { $bug = $this->getById($bugID); - $bugIDList = $bug->id . ',' . $bug->linkBug; + $bugIDList = $bug->id . ',' . $bug->linkBug; $bugs2Link = $this->getBySearch($bug->product, 'all', $queryID, 'id', $bugIDList, $pager); return $bugs2Link; } diff --git a/module/execution/config.php b/module/execution/config.php index 69eeeb5f7d..0c20808ff2 100644 --- a/module/execution/config.php +++ b/module/execution/config.php @@ -78,6 +78,7 @@ $config->execution->search['fields']['finishedDate'] = $lang->task->finishedDa $config->execution->search['fields']['closedDate'] = $lang->task->closedDate; $config->execution->search['fields']['canceledDate'] = $lang->task->canceledDate; $config->execution->search['fields']['lastEditedDate'] = $lang->task->lastEditedDate; +$config->execution->search['fields']['activatedDate'] = $lang->task->activatedDate; $config->execution->search['params']['name'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->execution->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->statusList); @@ -112,6 +113,7 @@ $config->execution->search['params']['finishedDate'] = array('operator' => '=' $config->execution->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->execution->search['params']['canceledDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->execution->search['params']['lastEditedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->execution->search['params']['activatedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->printKanban = new stdClass(); $config->printKanban->col['story'] = 1; diff --git a/module/product/config.php b/module/product/config.php index 2e04f57f05..16854ff7a3 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -51,6 +51,7 @@ $config->product->search['fields']['reviewedDate'] = $lang->story->reviewedDat $config->product->search['fields']['assignedDate'] = $lang->story->assignedDate; $config->product->search['fields']['closedDate'] = $lang->story->closedDate; $config->product->search['fields']['lastEditedDate'] = $lang->story->lastEditedDate; +$config->product->search['fields']['activatedDate'] = $lang->story->activatedDate; $config->product->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->product->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); @@ -84,6 +85,7 @@ $config->product->search['params']['reviewedDate'] = array('operator' => '=', $config->product->search['params']['assignedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->product->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->product->search['params']['lastEditedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->product->search['params']['activatedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->product->create = new stdclass(); $config->product->edit = new stdclass(); diff --git a/module/story/config.php b/module/story/config.php index 67bec65085..6c6dc77ffb 100644 --- a/module/story/config.php +++ b/module/story/config.php @@ -166,6 +166,11 @@ $config->story->datatable->fieldList['lastEditedDate']['fixed'] = 'no'; $config->story->datatable->fieldList['lastEditedDate']['width'] = '90'; $config->story->datatable->fieldList['lastEditedDate']['required'] = 'no'; +$config->story->datatable->fieldList['activatedDate']['title'] = 'activatedDate'; +$config->story->datatable->fieldList['activatedDate']['fixed'] = 'no'; +$config->story->datatable->fieldList['activatedDate']['width'] = '90'; +$config->story->datatable->fieldList['activatedDate']['required'] = 'no'; + $config->story->datatable->fieldList['feedbackBy']['title'] = 'feedbackBy'; $config->story->datatable->fieldList['feedbackBy']['fixed'] = 'no'; $config->story->datatable->fieldList['feedbackBy']['width'] = '100'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 21ae4f5184..4a704cff40 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -126,6 +126,7 @@ $lang->story->rejectedReason = '拒绝原因'; $lang->story->reviewedBy = '由谁评审'; $lang->story->reviewers = '评审人员'; $lang->story->reviewedDate = '评审时间'; +$lang->story->activatedDate = '激活日期'; $lang->story->version = '版本号'; $lang->story->feedbackBy = '反馈者'; $lang->story->notifyEmail = '通知邮箱'; diff --git a/module/story/model.php b/module/story/model.php index b5a9453a7a..170873cb62 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1968,6 +1968,7 @@ class storyModel extends model ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->setDefault('assignedDate', $now) + ->setDefault('activatedDate', $now) ->remove('comment') ->get(); $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq($storyID)->exec(); diff --git a/module/task/config.php b/module/task/config.php index 17bb90c08f..317f4b44a3 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -189,6 +189,11 @@ $config->task->datatable->fieldList['lastEditedDate']['fixed'] = 'no'; $config->task->datatable->fieldList['lastEditedDate']['width'] = '120'; $config->task->datatable->fieldList['lastEditedDate']['required'] = 'no'; +$config->task->datatable->fieldList['activatedDate']['title'] = 'activatedDate'; +$config->task->datatable->fieldList['activatedDate']['fixed'] = 'no'; +$config->task->datatable->fieldList['activatedDate']['width'] = '90'; +$config->task->datatable->fieldList['activatedDate']['required'] = 'no'; + $config->task->datatable->fieldList['actions']['title'] = 'actions'; $config->task->datatable->fieldList['actions']['fixed'] = 'right'; $config->task->datatable->fieldList['actions']['width'] = '180'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 4fb358e04c..12aa712844 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -40,6 +40,7 @@ $lang->task->cancel = "取消"; $lang->task->cancelAction = "取消任务"; $lang->task->activateAction = "激活任务"; $lang->task->activate = "激活"; +$lang->task->activatedDate = "激活日期"; $lang->task->export = "导出数据"; $lang->task->exportAction = "导出任务"; $lang->task->reportChart = "报表统计"; diff --git a/module/task/model.php b/module/task/model.php index a3bd1a75d9..c81c045d3a 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1906,6 +1906,7 @@ class taskModel extends model ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', helper::now()) ->setDefault('assignedDate', helper::now()) + ->setDefault('activatedDate', helper::now()) ->remove('comment') ->get(); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 318d31f635..76efcbf94c 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -760,6 +760,11 @@ class upgradeModel extends model $this->saveLogs('Execute 16_3'); $this->execSQL($this->getUpgradeFile('16.3')); $this->appendExec('16_3'); + case '16_4': + $this->saveLogs('Execute 16_4'); + $this->execSQL($this->getUpgradeFile('16.4')); + $this->updateActivatedDate(); + $this->appendExec('16_4'); } $this->deletePatch(); @@ -5608,4 +5613,25 @@ class upgradeModel extends model } return true; } + + /** + * updateActivatedDate + * + * @access public + * @return bool + */ + public function updateActivatedDate() + { + $actions = $this->dao->select('*')->from(TABLE_ACTION)->where('action')->eq('activated')->andWhere('objectType')->in('story, task, bug')->fetchAll('id'); + foreach($actions as $action) + { + $objectType = $action->objectType; + $date = $action->date; + $objectID = $action->objectID; + if($objectType == "story") $this->dao->update(TABLE_STORY)->set('activatedDate')->eq($date)->where('id')->eq($objectID)->exec(); + if($objectType == "task") $this->dao->update(TABLE_TASK)->set('activatedDate')->eq($date)->where('id')->eq($objectID)->exec(); + if($objectType == "bug") $this->dao->update(TABLE_BUG)->set('activatedDate')->eq($date)->where('id')->eq($objectID)->exec(); + } + return true; + } }