diff --git a/module/story/control.php b/module/story/control.php
index 8f5a2bcf9a..09250d6d3d 100644
--- a/module/story/control.php
+++ b/module/story/control.php
@@ -610,7 +610,8 @@ class story extends control
$users = $this->user->getPairs('pofirst|nodeleted|noclosed', "$story->assignedTo,$story->openedBy,$story->closedBy");
$isShowReviewer = true;
- $reviewerList = $this->dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($story->id)->andWhere('version')->eq($story->version)->fetchPairs('reviewer');
+ $reviewerList = $this->story->getReviewerPairs($story->id, $story->version);
+ $reviewerList = array_keys($reviewerList);
$reviewedBy = explode(',', trim($story->reviewedBy, ','));
if(!array_diff($reviewerList, $reviewedBy)) $isShowReviewer = false;
@@ -835,7 +836,7 @@ class story extends control
$this->app->loadLang('execution');
$story = $this->story->getById($storyID);
- $reviewer = $this->dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($story->version)->fetchAll('reviewer');
+ $reviewer = $this->story->getReviewerPairs($storyID, $story->version);
/* Assign. */
$this->view->title = $this->lang->story->change . "STORY" . $this->lang->colon . $this->view->story->title;
@@ -897,6 +898,8 @@ class story extends control
$story = $this->story->getById($storyID, $version, true);
if(!$story) die(js::error($this->lang->notFound) . js::locate('back'));
+ $story = $this->story->mergeReviewer($story, true);
+
$this->story->replaceURLang($story->type);
$story->files = $this->loadModel('file')->getByObject('story', $storyID);
@@ -907,8 +910,8 @@ class story extends control
$cases = $this->dao->select('id,title')->from(TABLE_CASE)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->fetchAll();
$modulePath = $this->tree->getParents($story->module);
$storyModule = empty($story->module) ? '' : $this->tree->getById($story->module);
- $users = $this->user->getPairs('noletter');
- $reviewers = $this->dao->select('reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($story->version)->fetchAll('reviewer');
+
+ $reviewers = $this->story->getReviewerPairs($storyID, $story->version);
/* Set the menu. */
$from = $this->app->openApp;
@@ -945,7 +948,7 @@ class story extends control
$this->view->cases = $cases;
$this->view->story = $story;
$this->view->track = $this->story->getTrackByID($story->id);
- $this->view->users = $users;
+ $this->view->users = $this->user->getPairs('noletter');
$this->view->reviewers = array_keys($reviewers);
$this->view->relations = $this->story->getStoryRelation($story->id, $story->type);
$this->view->executions = $this->execution->getPairs(0, 'all', 'nocode');
@@ -1012,15 +1015,8 @@ class story extends control
if($changes)
{
- $result = $this->post->result;
- $reasonParam = $result == 'reject' ? ',' . $this->post->closedReason : '';
- $story = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
- $reviewers = $this->dao->select('reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($story->version)->fetchAll('reviewer');
- $reviewedBy = explode(',', trim($story->reviewedBy, ','));
- $actionID = $this->action->create('story', $storyID, 'Reviewed', $this->post->comment, ucfirst($result) . $reasonParam);
- if($story->status == 'closed') $actionID = $this->action->create('story', $storyID, 'ReviewClosed');
- if($story->status == 'active') $actionID = $this->action->create('story', $storyID, 'PassReviewed');
- if(!array_diff(array_keys($reviewers), $reviewedBy) and ($story->status == 'draft' || $story->status == 'changed')) $actionID = $this->action->create('story', $storyID, 'ClarifyReviewed');
+ $story = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch();
+ $actionID = $this->story->recordReviewAction($story, $this->post->result, $this->post->closedReason);
$this->action->logHistory($actionID, $changes);
}
@@ -1028,7 +1024,6 @@ class story extends control
if(isonlybody()) die(js::reload('parent.parent'));
-
$module = $from == 'project' ? 'projectstory' : 'story';
die(js::locate($this->createLink($module, 'view', "storyID=$storyID"), 'parent'));
}
@@ -1055,10 +1050,13 @@ class story extends control
}
/* Set the review result options. */
- $reviewers = $this->dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($story->version)->fetchAll('reviewer');
+ $reviewers = $this->story->getReviewerPairs($storyID, $story->version);
$this->lang->story->resultList = $this->lang->story->reviewResultList;
+
if($story->status == 'draft' and $story->version == 1) unset($this->lang->story->resultList['revert']);
+
if($story->status == 'changed') unset($this->lang->story->resultList['reject']);
+
if(count($reviewers) > 1) unset($this->lang->story->resultList['revert']);
$this->view->title = $this->lang->story->review . "STORY" . $this->lang->colon . $story->title;
@@ -1947,20 +1945,20 @@ class story extends control
if(!empty($children))
{
- $reorderStory = array();
+ $reorderStories = array();
foreach($stories as $story)
{
- $reorderStory[$story->id] = $story;
+ $reorderStories[$story->id] = $story;
if(isset($children[$story->id]))
{
foreach($children[$story->id] as $childrenID => $childrenStory)
{
- $reorderStory[$childrenID] = $childrenStory;
+ $reorderStories[$childrenID] = $childrenStory;
}
}
unset($stories[$story->id]);
}
- $stories = $reorderStory;
+ $stories = $reorderStories;
}
}
diff --git a/module/story/js/create.js b/module/story/js/create.js
index 761ef291f8..473c38bd5f 100644
--- a/module/story/js/create.js
+++ b/module/story/js/create.js
@@ -5,11 +5,11 @@ $(function()
$('#reviewer').attr('disabled', $(this).is(':checked') ? 'disabled' : null).trigger('chosen:updated');
if($(this).is(':checked'))
{
- $('#reviewerTd').removeClass('required');
+ $('#reviewerBox').removeClass('required');
}
else
{
- $('#reviewerTd').addClass('required');
+ $('#reviewerBox').addClass('required');
}
getStatus('create', "product=" + $('#product').val() + ",execution=" + executionID + ",needNotReview=" + ($(this).prop('checked') ? 1 : 0));
diff --git a/module/story/model.php b/module/story/model.php
index 8deb4be27d..085e5a6bd1 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -356,7 +356,7 @@ class storyModel extends model
foreach($_POST['needReview'] as $index => $value)
{
if($_POST['title'][$index] and isset($_POST['reviewer'][$index])) $_POST['reviewer'][$index] = array_filter($_POST['reviewer'][$index]);
- if($_POST['title'][$index] and $value and !isset($_POST['reviewer'][$index]))
+ if($_POST['title'][$index] and $value and empty($_POST['reviewer'][$index]))
{
dao::$errors[] = $this->lang->story->errorEmptyReviewedBy;
return false;
@@ -409,8 +409,8 @@ class storyModel extends model
$story->category = $stories->category[$i];
$story->pri = $stories->pri[$i];
$story->estimate = $stories->estimate[$i];
- $story->status = ($this->app->openApp == project || $this->app->openApp == execution ||($stories->needReview[$i] == 0 and !$forceReview)) ? 'active' : 'draft';
- $story->stage = ($this->app->openApp == project || $this->app->openApp == execution) ? 'projected' : 'wait';
+ $story->status = ($this->app->openApp == project or $this->app->openApp == execution or ($stories->needReview[$i] == 0 and !$forceReview)) ? 'active' : 'draft';
+ $story->stage = ($this->app->openApp == project or $this->app->openApp == execution) ? 'projected' : 'wait';
$story->keywords = $stories->keywords[$i];
$story->sourceNote = $stories->sourceNote[$i];
$story->product = $productID;
@@ -633,14 +633,14 @@ class storyModel extends model
unset($story->spec);
unset($oldStory->spec);
- $this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->notin(implode(',', $_POST['reviewer']))->exec();
+ if(isset($_POST['reviewer'])) $this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->notin(implode(',', $_POST['reviewer']))->exec();
}
/* Update the reviewer. */
- $oldReviewerList = $this->dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->fetchPairs('reviewer');
+ $oldReviewerList = $this->getReviewerPairs($storyID, $oldStory->version);
foreach($_POST['reviewer'] as $reviewer)
{
- if(!$specChanged and in_array($reviewer, $oldReviewerList)) continue;
+ if(!$specChanged and in_array($reviewer, array_keys($oldReviewerList))) continue;
$reviewData = new stdclass();
$reviewData->story = $storyID;
@@ -808,17 +808,16 @@ class storyModel extends model
if(empty($oldStory->plan) or empty($story->plan)) $this->setStage($storyID); // Set new stage for this story.
}
- $_POST['reviewer'] = array_filter($_POST['reviewer']);
- $oldReviewer = $this->dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->fetchAll('reviewer');
+ $_POST['reviewer'] = array_filter($_POST['reviewer']);
+ $oldReviewer = $this->getReviewerPairs($storyID, $oldStory->version);
$oldStory->reviewers = implode(',', array_keys($oldReviewer));
$story->reviewers = implode(',', $_POST['reviewer']);
/* Update story reviewer. */
$this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->notin(implode(',', $_POST['reviewer']))->exec();
- $existedReviewer = $this->dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->fetchPairs('reviewer');
foreach($_POST['reviewer'] as $reviewer)
{
- if(in_array($reviewer, $existedReviewer)) continue;
+ if(in_array($reviewer, array_keys($oldReviewer))) continue;
$reviewData = new stdclass();
$reviewData->story = $storyID;
@@ -1192,6 +1191,7 @@ class storyModel extends model
$story = fixer::input('post')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
+ ->setDefault('status', $oldStory->status)
->setIF($this->post->result == 'revert', 'version', $this->post->preVersion)
->setIF($this->post->result == 'revert', 'status', 'active')
->removeIF($this->post->result != 'reject', 'closedReason, duplicateStory, childStories')
@@ -1208,11 +1208,12 @@ class storyModel extends model
$this->dao->update(TABLE_STORYREVIEW)->set('result')->eq($this->post->result)->set('reviewDate')->eq($now)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->eq($this->app->user->account)->exec();
/* Update the story status by review rules. */
- $reviewerList = $this->dao->select('reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->fetchPairs('reviewer', 'result');
- $reviewedBy = explode(',', trim($story->reviewedBy, ','));
+ $reviewerList = $this->getReviewerPairs($storyID, $oldStory->version);
+ $reviewedBy = explode(',', trim($story->reviewedBy, ','));
if(!array_diff(array_keys($reviewerList), $reviewedBy))
{
- $story->status = $this->setStatusByReviewRules($reviewerList);
+ $status = $this->setStatusByReviewRules($reviewerList);
+ $story->status = $status ? $status : $oldStory->status;
if($story->status == 'closed')
{
$story->closedBy = $this->app->user->account;
@@ -1261,29 +1262,35 @@ class storyModel extends model
$actions = array();
$this->loadModel('action');
- $oldStories = $this->getByList($storyIdList);
+ $oldStories = $this->getByList($storyIdList);
+ $hasResult = $this->dao->select('story,version,result')->from(TABLE_STORYREVIEW)->where('story')->in($storyIdList)->andWhere('reviewer')->eq($this->app->user->account)->andWhere('result')->ne('')->orderBy('version')->fetchAll('story');
+ $reviewerList = $this->dao->select('story,reviewer,result,version')->from(TABLE_STORYREVIEW)->where('story')->in($storyIdList)->orderBy('version')->fetchGroup('story', 'reviewer');
foreach($storyIdList as $storyID)
{
$oldStory = $oldStories[$storyID];
if($oldStory->status != 'draft' and $oldStory->status != 'changed') continue;
- $hasResult = $this->dao->select('result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->eq($this->app->user->account)->fetch('result');
- if($hasResult) continue;
+ if(isset($hasResult[$storyID])) continue;
$story = new stdClass();
$story->reviewedDate = $now;
$story->lastEditedBy = $this->app->user->account;
$story->lastEditedDate = $now;
$story->reviewedBy = $oldStory->reviewedBy . ',' . $this->app->user->account;
+ $story->status = $oldStory->status;
$this->dao->update(TABLE_STORYREVIEW)->set('result')->eq($result)->set('reviewDate')->eq($now)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->eq($this->app->user->account)->exec();
/* Update the story status by review rules. */
- $reviewerList = $this->dao->select('reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->fetchPairs('reviewer', 'result');
- $reviewedBy = explode(',', trim($story->reviewedBy, ','));
- if(!array_diff(array_keys($reviewerList), $reviewedBy))
+ $reviewedBy = explode(',', trim($story->reviewedBy, ','));
+ if(!array_diff(array_keys($reviewerList[$storyID]), $reviewedBy))
{
- $status = $this->setStatusByReviewRules($reviewerList);
+ $reviewerPairs = array();
+ foreach($reviewerList[$storyID] as $reviewer => $reviewInfo) $reviewerPairs[$reviewer] = $reviewInfo->result;
+ $reviewerPairs[$this->app->user->account] = $result;
+
+ $status = $this->setStatusByReviewRules($reviewerPairs);
$story->status = $status ? $status : $oldStory->status;
+
if($story->status == 'closed')
{
$story->closedBy = $this->app->user->account;
@@ -1297,14 +1304,9 @@ class storyModel extends model
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq($storyID)->exec();
$this->setStage($storyID);
- $reasonParam = $result == 'reject' ? ',' . $reason : '';
- $reviewers = $this->dao->select('reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->fetchAll('reviewer');
- $reviewedBy = explode(',', trim($story->reviewedBy, ','));
- $actions[$storyID] = $this->action->create('story', $storyID, 'Reviewed', '', ucfirst($result) . $reasonParam);
-
- if($story->status == 'closed') $this->action->create('story', $storyID, 'ReviewClosed');
- if($story->status == 'active') $this->action->create('story', $storyID, 'PassReviewed');
- if(!array_diff(array_keys($reviewers), $reviewedBy) and ($story->status == 'draft' || $story->status == 'changed')) $this->action->create('story', $storyID, 'ClarifyReviewed');
+ $story->id = $storyID;
+ $story->version = $oldStory->version;
+ $actions[$storyID] = $this->recordReviewAction($story, $result, $reason);
}
return $actions;
@@ -3273,12 +3275,13 @@ class storyModel extends model
if($story->parent < 0 and $action != 'edit' and $action != 'batchcreate') return false;
- global $config, $app, $dao;
- $notReview = $dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($story->id)->andWhere('version')->eq($story->version)->andWhere('result')->eq('')->fetchAll('reviewer');
- $reviewers = $dao->select('reviewer')->from(TABLE_STORYREVIEW)->where('story')->eq($story->id)->andWhere('version')->eq($story->version)->fetchAll('reviewer');
+ global $app;
- if($action == 'change') return (count($reviewers) == 0 || count($notReview) == 0) and $story->status != 'closed';
- if($action == 'review') return in_array($app->user->account, array_keys($notReview)) and ($story->status == 'draft' or $story->status == 'changed');
+ $story->reviewer = isset($story->reviewer) ? $story->reviewer : array();
+ $story->notReview = isset($story->notReview) ? $story->notReview : array();
+
+ if($action == 'change') return (count($story->reviewer) == 0 || count($story->notReview) == 0) and $story->status != 'closed';
+ if($action == 'review') return in_array($app->user->account, $story->notReview) and ($story->status == 'draft' or $story->status == 'changed');
if($action == 'close') return $story->status != 'closed';
if($action == 'activate') return $story->status == 'closed';
if($action == 'assignto') return $story->status != 'closed';
@@ -3369,6 +3372,39 @@ class storyModel extends model
return $stories;
}
+ /**
+ * Merge story reviewers.
+ *
+ * @param array|object $stories
+ * @param bool $isObject
+ * @access public
+ * @return array|object
+ */
+ public function mergeReviewer($stories, $isObject = false)
+ {
+ if($isObject)
+ {
+ $story = $stories;
+ $stories = (array)$stories;
+ $stories[$story->id] = $story;
+ }
+
+ $allReviewers = $this->dao->select('story,reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->in(array_keys($stories))->orderBy('version')->fetchGroup('story', 'reviewer');
+
+ foreach($allReviewers as $storyID => $reviewerList)
+ {
+ $stories[$storyID]->reviewer = array_keys($reviewerList);
+ $stories[$storyID]->notReview = array();
+ foreach($reviewerList as $reviewer => $reviewInfo)
+ {
+ if($reviewInfo->result == '') $stories[$storyID]->notReview[] = $reviewer;
+ }
+ }
+
+ if($isObject) return $stories[$story->id];
+ return $stories;
+ }
+
/**
* Print cell data
*
@@ -4220,6 +4256,19 @@ class storyModel extends model
}
}
+ /**
+ * Get story reviewer pairs.
+ *
+ * @param int $storyID
+ * @param int version
+ * @access public
+ * @return array
+ */
+ public function getReviewerPairs($storyID, $version)
+ {
+ return $this->dao->select('reviewer,result')->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($version)->fetchPairs('reviewer', 'result');
+ }
+
/**
* Set story status by review rules.
*
@@ -4229,6 +4278,7 @@ class storyModel extends model
*/
public function setStatusByReviewRules($reviewerList)
{
+ $status = '';
$passCount = 0;
$rejectCount = 0;
$reviewRule = $this->config->story->reviewRules;
@@ -4252,4 +4302,30 @@ class storyModel extends model
return $status;
}
+
+ /**
+ * Record story review actions.
+ *
+ * @param object $story
+ * @param string $result
+ * @param string $reason
+ * @access public
+ * @return int
+ */
+ public function recordReviewAction($story, $result, $reason)
+ {
+ $reasonParam = $result == 'reject' ? ',' . $reason : '';
+ $reviewers = $this->getReviewerPairs($story->id, $story->version);
+ $reviewedBy = explode(',', trim($story->reviewedBy, ','));
+
+ $comment = isset($_POST['comment']) ? $this->post->comment : '';
+ $actionID = $this->loadModel('action')->create('story', $story->id, 'Reviewed', $comment, ucfirst($result) . $reasonParam);
+
+ if($story->status == 'closed') $this->action->create('story', $story->id, 'ReviewClosed');
+ if($story->status == 'active') $this->action->create('story', $story->id, 'PassReviewed');
+ if(!array_diff(array_keys($reviewers), $reviewedBy) and ($story->status == 'draft' || $story->status == 'changed')) $this->action->create('story', $story->id, 'ClarifyReviewed');
+
+ return $actionID;
+ }
+
}
diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php
index bd288c529a..147187c88c 100644
--- a/module/story/view/create.html.php
+++ b/module/story/view/create.html.php
@@ -101,7 +101,7 @@
| story->reviewedBy;?> |
- id='reviewerTd'>
+ | id='reviewerBox'>
PO : '', "class='form-control chosen' multiple");?>
diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php
index 0304e64e90..2f38ee0ae5 100644
--- a/module/story/view/view.html.php
+++ b/module/story/view/view.html.php
@@ -501,7 +501,7 @@
id $case->title'>" . html::a($this->createLink('testcase', 'view', "caseID=$case->id", '', true), "[C] #$case->id $case->title") . '';
+ echo " " . html::a($this->createLink('testcase', 'view', "caseID=$case->id", '', true), "[C] #$case->id $case->title", '',"data-toggle='modal'") . '';
}
?>
diff --git a/module/testreport/control.php b/module/testreport/control.php
index 748bc72b94..4b5af5bc96 100644
--- a/module/testreport/control.php
+++ b/module/testreport/control.php
@@ -310,8 +310,13 @@ class testreport extends control
$this->view->cases = $cases;
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $begin, $end);
- $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $cases, $begin, $end);
- $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $cases, $begin, $end);
+ $caseList = array();
+ foreach($cases as $taskID => $casesList)
+ {
+ foreach($casesList as $caseID => $case) $caseList[$caseID] = $case;
+ }
+ $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, array_keys($caseList), $begin, $end);
+ $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, array_keys($caseList), $begin, $end);
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
@@ -439,8 +444,8 @@ class testreport extends control
$this->view->cases = $cases;
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $begin, $end);
- $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $cases, $begin, $end);
- $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $cases, $begin, $end);
+ $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $report->cases, $begin, $end);
+ $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $report->cases, $begin, $end);
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
@@ -511,11 +516,10 @@ class testreport extends control
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = pager::init($recTotal, $recPerPage, $pageID);
- $tasks = $report->tasks ? $this->testtask->getByList($report->tasks) : array();;
- $builds = $report->builds ? $this->build->getByList($report->builds) : array();
- $cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end, $report->cases, $pager);
- $caseIdList = $this->testreport->getCaseIdList($reportID);
- $bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds);
+ $tasks = $report->tasks ? $this->testtask->getByList($report->tasks) : array();;
+ $builds = $report->builds ? $this->build->getByList($report->builds) : array();
+ $cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end);
+ $bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds);
if($report->objectType == 'testtask')
{
@@ -537,15 +541,15 @@ class testreport extends control
$this->view->stories = $stories;
$this->view->bugs = $report->bugs ? $this->bug->getByList($report->bugs) : array();
$this->view->builds = $builds;
- $this->view->cases = $cases;
+ $this->view->cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end, $report->cases, $pager);
$this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted');
$this->view->actions = $this->loadModel('action')->getList('testreport', $reportID);
$this->view->storySummary = $this->product->summary($stories);
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $report->begin, $report->end);
- $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $caseIdList, $report->begin, $report->end);
- $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $caseIdList, $report->begin, $report->end);
+ $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $report->cases, $report->begin, $report->end);
+ $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $report->cases, $report->begin, $report->end);
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
diff --git a/module/testreport/model.php b/module/testreport/model.php
index 2007b22bcd..7dcf955db5 100644
--- a/module/testreport/model.php
+++ b/module/testreport/model.php
@@ -438,7 +438,7 @@ class testreportModel extends model
->on('t1.run= t2.id')
->where('t2.task')->in(array_keys($tasks))
->andwhere('t1.date = t2.lastRunDate')
- ->andWhere('t1.`case`')->in(array_keys($cases))
+ ->andWhere('t1.`case`')->in($cases)
->andWhere('t1.date')->ge($begin)
->andWhere('t1.date')->le($end . " 23:59:59")
->groupBy('name')
@@ -470,7 +470,7 @@ class testreportModel extends model
->on('t1.run= t2.id')
->where('t2.task')->in(array_keys($tasks))
->andwhere('t1.date = t2.lastRunDate')
- ->andWhere('t1.`case`')->in(array_keys($cases))
+ ->andWhere('t1.`case`')->in($cases)
->andWhere('t1.date')->ge($begin)
->andWhere('t1.date')->le($end . " 23:59:59")
->groupBy('name')
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 755885865e..0c4a35f008 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -244,7 +244,7 @@ class testtask extends control
$executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
- $testreports = empty($build) ? array() : $this->dao->select('id,title')->from(TABLE_TESTREPORT)->where('builds')->like('%' . $build . '%')->fetchPairs('id','title');
+ $testreports = $this->testtask->getTestReportPairsByBuild($build);
/* Set menu. */
$productID = $this->product->saveState($productID, $this->products);
@@ -750,7 +750,7 @@ class testtask extends control
$projectID = $this->lang->navGroup->testtask == 'qa' ? 0 : $this->session->project;
$executions = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
- $testreports = $this->dao->select('id,title')->from(TABLE_TESTREPORT)->where('builds')->like('%' . $task->build . '%')->fetchPairs('id','title');
+ $testreports = $this->testtask->getTestReportPairsByBuild($task->build);
$this->view->task = $task;
$this->view->executions = $executions;
@@ -1451,7 +1451,7 @@ class testtask extends control
public function ajaxGetTestReports($buildID)
{
/* Testreport list. */
- $pairs = $this->dao->select('id,title')->from(TABLE_TESTREPORT)->where('builds')->like('%' . $buildID . '%')->fetchPairs('id','title');
+ $pairs = $this->testtask->getTestReportPairsByBuild($buildID);
die(html::select('testreport', $pairs, '', "class='form-control chosen'"));
}
}
diff --git a/module/testtask/model.php b/module/testtask/model.php
index ab78506bb5..f9ef55c25e 100644
--- a/module/testtask/model.php
+++ b/module/testtask/model.php
@@ -492,6 +492,20 @@ class testtaskModel extends model
->fetchAll();
}
+ /**
+ * Get test report pairs by build.
+ *
+ * @param string $build
+ * @access public
+ * @return array
+ */
+ public function getTestReportPairsByBuild($build = '')
+ {
+ if(empty($build)) return array();
+
+ return $this->dao->select('id,title')->from(TABLE_TESTREPORT)->where("CONCAT(',', builds, ',')")->like("%,$build,%")->fetchPairs('id','title');
+ }
+
/**
* Get related test tasks.
*
@@ -885,7 +899,6 @@ class testtaskModel extends model
$this->loadModel('action')->create('case', $caseID, 'linked2testtask', '', $taskID);
}
}
-
}
/**
diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php
index a2beb118cd..47294aecae 100644
--- a/module/testtask/view/browse.html.php
+++ b/module/testtask/view/browse.html.php
@@ -105,9 +105,9 @@ $status = $this->session->testTaskVersionStatus;
echo ' ';
common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'list', 'sitemap');
common::printIcon('testtask', 'linkCase', "taskID=$task->id&type=all¶m=myQueryID", $task, 'list', 'link');
- common::printIcon('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id", $task, 'list','flag');
+ common::printIcon('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id", $task, 'list', 'flag');
echo ' ';
- common::printIcon('testtask', 'view', "taskID=$task->id", '', 'list', 'list-alt','','iframe',true, "data-width='90%'");
+ common::printIcon('testtask', 'view', "taskID=$task->id", '', 'list', 'list-alt', '', 'iframe', true, "data-width='90%'");
common::printIcon('testtask', 'edit', "taskID=$task->id", $task, 'list');
if(common::hasPriv('testtask', 'delete', $task))
{
diff --git a/module/testtask/view/edit.html.php b/module/testtask/view/edit.html.php
index 888e3ae0c3..73ddc6c136 100644
--- a/module/testtask/view/edit.html.php
+++ b/module/testtask/view/edit.html.php
@@ -36,7 +36,7 @@
|
| testtask->build;?> |
- build, "class='form-control chosen'");?> |
+ build, "class='form-control chosen' onchange='loadTestReports(this.value)'");?> |
|
diff --git a/module/todo/config.php b/module/todo/config.php
index 3c1cf4bdf0..91e5d79ecf 100644
--- a/module/todo/config.php
+++ b/module/todo/config.php
@@ -27,4 +27,16 @@ $config->todo->custom = new stdclass();
$config->todo->custom->batchCreateFields = 'type,pri,desc,beginAndEnd';
$config->todo->custom->batchEditFields = 'pri,beginAndEnd,status';
-$config->todo->moduleList = array('bug', 'task', 'story', 'issue', 'risk', 'review', 'testtask', 'opportunity');
+$config->todo->moduleList = array('bug', 'task', 'story', 'testtask');
+
+$config->todo->getUserObjectsMethod = array();
+$config->todo->getUserObjectsMethod['bug'] = 'ajaxGetUserBugs';
+$config->todo->getUserObjectsMethod['task'] = 'ajaxGetUserTasks';
+$config->todo->getUserObjectsMethod['story'] = 'ajaxGetUserStories';
+$config->todo->getUserObjectsMethod['testtask'] = 'ajaxGetUserTestTasks';
+
+$config->todo->objectList = array();
+$config->todo->objectList['bug'] = 'bugs';
+$config->todo->objectList['task'] = 'tasks';
+$config->todo->objectList['story'] = 'stories';
+$config->todo->objectList['testtask'] = 'testtasks';
diff --git a/module/todo/control.php b/module/todo/control.php
index bc2af3e8d0..e938ff903e 100644
--- a/module/todo/control.php
+++ b/module/todo/control.php
@@ -24,7 +24,6 @@ class todo extends control
$this->loadModel('task');
$this->loadModel('bug');
$this->loadModel('my')->setMenu();
- if(!isset($this->config->qcVersion)) unset($this->lang->todo->typeList['review']);
}
/**
@@ -194,16 +193,17 @@ class todo extends control
$bugs = $this->bug->getUserBugPairs($account);
$tasks = $this->task->getUserTaskPairs($account, $status);
$storys = $this->loadModel('story')->getUserStoryPairs($account);
+ if(isset($this->config->bizVersion) or isset($this->config->maxVersion)) $this->view->feedbacks = $this->loadModel('feedback')->getUserFeedbackPairs($account);
if(isset($this->config->maxVersion))
{
$issues = $this->loadModel('issue')->getUserIssuePairs($account);
- $risks = $this->loadmodel('risk')->getuserriskpairs($account);
+ $risks = $this->loadmodel('risk')->getUserRiskPairs($account);
$opportunities = $this->loadmodel('opportunity')->getUserOpportunityPairs($account);
}
$testtasks = $this->loadModel('testtask')->getUserTestTaskPairs($account);
$reviews = array();
- if(isset($this->config->qcVersion)) $reviews = $this->loadModel('review')->getUserReviewPairs($account);
+ if(isset($this->config->qcVersion) or isset($this->config->maxVersion)) $reviews = $this->loadModel('review')->getUserReviewPairs($account);
$allTodos = $this->todo->getList($type, $account, $status);
if($this->post->todoIDList) $todoIDList = $this->post->todoIDList;
@@ -394,7 +394,7 @@ class todo extends control
$this->view->from = $from;
$this->view->projects = $projects;
$this->view->executions = $this->loadModel('execution')->getPairs($this->session->project);
- $this->view->products = $this->loadModel('product')->getPairs();
+ $this->view->products = $todo->type == 'opportunity' ? $this->loadModel('product')->getPairsByProjectModel('waterfall') : $this->loadModel('product')->getPairs();
$this->view->projectProducts = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$this->display();
diff --git a/module/todo/js/common.js b/module/todo/js/common.js
index af797a3d15..bd8e00ce07 100644
--- a/module/todo/js/common.js
+++ b/module/todo/js/common.js
@@ -25,44 +25,12 @@ function loadList(type, id)
var param = 'userID=' + userID;
if(id) param += '&id=' + id;
- if(type == 'bug')
+ if(moduleList.indexOf(type) !== -1)
{
- link = createLink('bug', 'ajaxGetUserBugs', param);
- }
- else if(type == 'task')
- {
- link = createLink('task', 'ajaxGetUserTasks', param);
- }
- else if(type == 'story')
- {
- link = createLink('story', 'ajaxGetUserStories', param);
- }
- else if(type == 'issue')
- {
- link = createLink('issue', 'ajaxGetUserIssues', param);
- }
- else if(type == 'risk')
- {
- link = createLink('risk', 'ajaxGetUserRisks', param);
- }
- else if(type == 'opportunity')
- {
- link = createLink('opportunity', 'ajaxGetUseropportunities', param);
- }
- else if(type == 'testtask')
- {
- link = createLink('testtask', 'ajaxGetUserTestTasks', param);
- }
- else if(type == 'review')
- {
- link = createLink('review', 'ajaxGetUserReviews', param);
- }
- else if(type == 'feedback')
- {
- link = createLink('feedback', 'ajaxGetUserFeedback', param);
+ link = createLink(type, objectsMethod[type], param);
}
- if(type == 'bug' || type == 'task' || type == 'story' || type == 'issue' || type == 'risk' || type == 'testtask' || type == 'review' || type == 'feedback' || type == 'opportunity')
+ if(moduleList.indexOf(type) !== -1)
{
$.get(link, function(data, status)
{
diff --git a/module/todo/lang/de.php b/module/todo/lang/de.php
index 26dffdeb3c..7d1eb36eaa 100644
--- a/module/todo/lang/de.php
+++ b/module/todo/lang/de.php
@@ -97,7 +97,6 @@ $lang->todo->typeList['cycle'] = 'Wiederkehrend';
$lang->todo->typeList['bug'] = 'Bug';
$lang->todo->typeList['task'] = 'Aufgabe';
$lang->todo->typeList['story'] = 'Story';
-$lang->todo->typeList['review'] = 'Review';
$lang->todo->typeList['testtask'] = 'Testtask';
$lang->todo->confirmDelete = "Möchten Sie diesen ToDo löschen?";
diff --git a/module/todo/lang/en.php b/module/todo/lang/en.php
index 15fa7ac310..2028431127 100644
--- a/module/todo/lang/en.php
+++ b/module/todo/lang/en.php
@@ -98,7 +98,6 @@ $lang->todo->typeList['cycle'] = 'Recur';
$lang->todo->typeList['bug'] = 'Bug';
$lang->todo->typeList['task'] = 'Task';
$lang->todo->typeList['story'] = 'Story';
-$lang->todo->typeList['review'] = 'Review';
$lang->todo->typeList['testtask'] = 'Testtask';
$lang->todo->confirmDelete = "Do you want to delete this todo?";
diff --git a/module/todo/lang/fr.php b/module/todo/lang/fr.php
index 89ccead940..dbd582426a 100644
--- a/module/todo/lang/fr.php
+++ b/module/todo/lang/fr.php
@@ -97,7 +97,6 @@ $lang->todo->typeList['cycle'] = 'Récur';
$lang->todo->typeList['bug'] = 'Bug';
$lang->todo->typeList['task'] = 'Tâche';
$lang->todo->typeList['story'] = 'Story';
-$lang->todo->typeList['review'] = 'Review';
$lang->todo->typeList['testtask'] = 'Testtask';
$lang->todo->confirmDelete = "Voulez-vous supprimer cette entrée de l'agenda ?";
diff --git a/module/todo/lang/vi.php b/module/todo/lang/vi.php
index 7230793679..9a3a86806d 100644
--- a/module/todo/lang/vi.php
+++ b/module/todo/lang/vi.php
@@ -97,7 +97,6 @@ $lang->todo->typeList['cycle'] = 'Lặp lại';
$lang->todo->typeList['bug'] = 'Bug';
$lang->todo->typeList['task'] = 'Nhiệm vụ';
$lang->todo->typeList['story'] = 'Câu chuyện';
-$lang->todo->typeList['review'] = 'Review';
$lang->todo->typeList['testtask'] = 'Testtask';
$lang->todo->confirmDelete = "Bạn có muốn xóa việc này?";
diff --git a/module/todo/lang/zh-cn.php b/module/todo/lang/zh-cn.php
index 29a5f6b1c2..6121619b1d 100644
--- a/module/todo/lang/zh-cn.php
+++ b/module/todo/lang/zh-cn.php
@@ -98,7 +98,6 @@ $lang->todo->typeList['cycle'] = '周期';
$lang->todo->typeList['bug'] = 'Bug';
$lang->todo->typeList['task'] = '任务';
$lang->todo->typeList['story'] = $lang->SRCommon;
-$lang->todo->typeList['review'] = '评审';
$lang->todo->typeList['testtask'] = '测试单';
$lang->todo->confirmDelete = "您确定要删除这条待办吗?";
diff --git a/module/todo/model.php b/module/todo/model.php
index 67dd7b7327..6c8acbd854 100644
--- a/module/todo/model.php
+++ b/module/todo/model.php
@@ -39,44 +39,9 @@ class todoModel extends model
->remove(implode(',', $this->config->todo->moduleList) . ',uid')
->get();
- if(!isset($todo->pri))
+ if(!isset($todo->pri) and in_array($this->post->type, $this->config->todo->moduleList) and $this->post->type !== 'review' and $this->post->type !== 'feedback')
{
- if($this->post->type == 'task')
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_TASK)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'bug')
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_BUG)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'story')
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_STORY)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'testtask')
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_TESTTASK)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'issue' and isset($this->config->maxVersion))
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_ISSUE)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'risk' and isset($this->config->maxVersion))
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_RISK)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'review' and isset($this->config->maxVersion))
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_REVIEW)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'feedback' and isset($this->config->maxVersion))
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_FEEDBACK)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
- elseif($this->post->type == 'opportunity' and isset($this->config->maxVersion))
- {
- $todo->pri = $this->dao->select('pri')->from(TABLE_OPPORTUNITY)->where('id')->eq($this->post->idvalue)->fetch('pri');
- }
+ $todo->pri = $this->dao->select('pri')->from($this->config->objectTables[$this->post->type])->where('id')->eq($this->post->idvalue)->fetch('pri');
if($todo->pri == 'high') $todo->pri = 1;
if($todo->pri == 'middle') $todo->pri = 2;
@@ -155,7 +120,17 @@ class todoModel extends model
$validTodos = array();
for($i = 0; $i < $this->config->todo->batchCreate; $i++)
{
- if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1]) || isset($todos->stories[$i + 1]) || isset($todos->issues[$i + 1]) || isset($todos->risks[$i + 1]) || isset($todos->reviews[$i + 1]) || isset($todos->testtasks[$i + 1]) || isset($todos->opportunities[$i + 1]))
+ $isExist = false;
+ foreach($this->config->todo->objectList as $objects)
+ {
+ if(isset($todos->{$objects}[$i + 1]))
+ {
+ $isExist = true;
+ break;
+ }
+ }
+
+ if($todos->names[$i] != '' || $isExist)
{
$todo = new stdclass();
$todo->account = $this->app->user->account;
@@ -178,14 +153,7 @@ class todoModel extends model
$todo->private = 0;
$todo->idvalue = 0;
- if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0;
- if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0;
- if($todo->type == 'story') $todo->idvalue = isset($todos->stories[$i + 1]) ? $todos->stories[$i + 1] : 0;
- if($todo->type == 'issue') $todo->idvalue = isset($todos->issues[$i + 1]) ? $todos->issues[$i + 1] : 0;
- if($todo->type == 'risk') $todo->idvalue = isset($todos->risks[$i + 1]) ? $todos->risks[$i + 1] : 0;
- if($todo->type == 'opportunity') $todo->idvalue = isset($todos->opportunities[$i + 1]) ? $todos->opportunities[$i + 1] : 0;
- if($todo->type == 'review') $todo->idvalue = isset($todos->reviews[$i + 1]) ? $todos->reviews[$i + 1] : 0;
- if($todo->type == 'testtask') $todo->idvalue = isset($todos->testtasks[$i + 1]) ? $todos->testtasks[$i + 1] : 0;
+ if(in_array($todo->type, $this->config->todo->moduleList)) $todo->idvalue = isset($todos->{$this->config->todo->objectList[$todo->type]}[$i + 1]) ? $todos->{$this->config->todo->objectList[$todo->type]}[$i + 1] : 0;
if($todo->type != 'custom' and $todo->idvalue)
{
@@ -329,16 +297,11 @@ class todoModel extends model
$todo->name = ($todo->type == 'custom' or $todo->type == 'cycle' or $todo->type == 'feedback') ? $data->names[$todoID] : '';
$todo->begin = isset($data->begins[$todoID]) ? $data->begins[$todoID] : 2400;
$todo->end = isset($data->ends[$todoID]) ? $data->ends[$todoID] : 2400;
- if($todo->type == 'task') $todo->idvalue = isset($data->tasks[$todoID]) ? $data->tasks[$todoID] : 0;
- if($todo->type == 'bug') $todo->idvalue = isset($data->bugs[$todoID]) ? $data->bugs[$todoID] : 0;
- if($todo->type == 'story') $todo->idvalue = isset($data->storys[$todoID]) ? $data->storys[$todoID] : 0;
- if($todo->type == 'issue') $todo->idvalue = isset($data->issues[$todoID]) ? $data->issues[$todoID] : 0;
- if($todo->type == 'risk') $todo->idvalue = isset($data->risks[$todoID]) ? $data->risks[$todoID] : 0;
- if($todo->type == 'opportunity') $todo->idvalue = isset($data->opportunities[$todoID]) ? $data->opportunities[$todoID] : 0;
- if($todo->type == 'review') $todo->idvalue = isset($data->reviews[$todoID]) ? $data->reviews[$todoID] : 0;
- if($todo->type == 'testtask') $todo->idvalue = isset($data->testtasks[$todoID]) ? $data->testtasks[$todoID] : 0;
- if($todo->type == 'feedback') $todo->idvalue = isset($data->feedbacks[$todoID]) ? $data->feedbacks[$todoID] : 0;
+ if(in_array($todo->type, $this->config->todo->moduleList))
+ {
+ $todo->idvalue = isset($data->{$this->config->todo->objectList[$todo->type]}[$todoID]) ? $data->{$this->config->todo->objectList[$todo->type]}[$todoID] : 0;
+ }
if($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
$todos[$todoID] = $todo;
diff --git a/module/todo/view/batchcreate.html.php b/module/todo/view/batchcreate.html.php
index fbe62153aa..1d1b307da9 100755
--- a/module/todo/view/batchcreate.html.php
+++ b/module/todo/view/batchcreate.html.php
@@ -12,7 +12,8 @@
?>
-
+todo->moduleList)?>
+todo->getUserObjectsMethod)?>
| project->acl;?> |
- program->subAclList, 'open', '', 'block'));?> |
+ project->subAclList, 'open', '', 'block'));?> |