diff --git a/db/update9.5.1.sql b/db/update9.5.1.sql index 17036e2ff9..3f5b805613 100644 --- a/db/update9.5.1.sql +++ b/db/update9.5.1.sql @@ -98,3 +98,4 @@ CREATE TABLE `zt_score` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('*/5', '*', '*', '*', '*', 'moduleName=webhook&methodName=asyncSend', '异步发送Webhook', 'zentao', 1, 'normal', '0000-00-00 00:00:00'); +ALTER TABLE `zt_projectstory` ADD `order` smallint(6) unsigned NOT NULL; diff --git a/module/file/control.php b/module/file/control.php index 6928e0002b..ee06434a15 100644 --- a/module/file/control.php +++ b/module/file/control.php @@ -485,6 +485,8 @@ class file extends control if(empty($file) or !file_exists($file->realPath)) return false; $mime = in_array($file->extension, $this->config->file->imageExtensions) ? "image/{$file->extension}" : $this->config->file->mimes['default']; + ob_end_clean(); + header("Content-type: $mime"); $handle = fopen($file->realPath, "r"); diff --git a/module/project/control.php b/module/project/control.php index e651b7e440..81e089333e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -530,7 +530,7 @@ class project extends control * @access public * @return void */ - public function story($projectID = 0, $orderBy = '', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1) + public function story($projectID = 0, $orderBy = 'order', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1) { /* Load these models. */ $this->loadModel('story'); @@ -1991,6 +1991,32 @@ class project extends control } } + /** + * Story sort. + * + * @param int $projectID + * @access public + * @return void + */ + public function storySort($projectID) + { + $idList = explode(',', trim($this->post->storys, ',')); + $orderBy = $this->post->orderBy; + + $stories = $this->dao->select('story,`order`')->from(TABLE_PROJECTSTORY)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') + ->where('t1.story')->in($idList) + ->andWhere('t1.project')->eq($projectID) + ->orderBy($orderBy) + ->fetchPairs('order', 'story'); + foreach($stories as $order => $id) + { + $newID = array_shift($idList); + if($id == $newID) continue; + $this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('story')->eq($newID)->andWhere('project')->eq($projectID)->exec(); + } + } + /** * All project. * diff --git a/module/project/js/story.js b/module/project/js/story.js index 24e1358871..08d74073cb 100644 --- a/module/project/js/story.js +++ b/module/project/js/story.js @@ -2,6 +2,13 @@ $(function() { ajaxGetSearchForm(); + $('#storyList').on('sort.sortable', function(e, data) + { + var list = ''; + for(i = 0; i < data.list.length; i++) list += $(data.list[i]).attr('data-id') + ','; + $.post(createLink('project', 'storySort', 'projectID=' + projectID), {'storys' : list, 'orderBy' : orderBy}); + }); + fixedTfootAction('#projectStoryForm'); fixedTheadOfList('#storyList'); diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index b73fb46c91..d66a3a994a 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -12,6 +12,7 @@ ?> + project->confirmUnlinkStory)?> @@ -55,6 +56,7 @@
+ @@ -71,9 +73,12 @@ + + + - + createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project¶m=$project->id"); $totalEstimate += $story->estimate; ?> - + + + + -
story->bugCountAB;?> story->caseCountAB;?> actions;?> project->updateOrder);?>
@@ -147,12 +152,15 @@ } ?>
+
project->productStories, inlink('linkStory', "project={$project->id}")); @@ -193,4 +201,6 @@
+id);?> + diff --git a/module/testreport/model.php b/module/testreport/model.php index 7dcfaac737..124b229a79 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -198,8 +198,8 @@ class testreportModel extends model { $foundBugs[$bug->id] = $bug; if($bug->status == 'active' OR $bug->resolvedDate > "$end 23:59:59") $legacyBugs[$bug->id] = $bug; + if($bug->case and !empty($bug->testtask) and in_array($bug->testtask, $taskIdList)) $byCaseNum ++; } - if($bug->case and !empty($bug->testtask) and in_array($bug->testtask, $taskIdList)) $byCaseNum ++; } $severityGroups = $statusGroups = $openedByGroups = $resolvedByGroups = $resolutionGroups = $moduleGroups = $typeGroups = array(); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index f349efe784..29a25377b5 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -1793,4 +1793,26 @@ class upgradeModel extends model return !dao::isError(); } + + /** + * Init project story order. + * + * @access public + * @return bool + */ + public function initProjectStoryOrder() + { + $storyGroup = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->orderBy('story_asc')->fetchGroup('project', 'story'); + + foreach($storyGroup as $projectID => $stories) + { + $order = 1; + foreach($stories as $storyID => $projectStory) + { + $this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('project')->eq($projectID)->andWhere('story')->eq($storyID)->exec(); + $order++; + } + } + return true; + } }