* Finish task #36430.

This commit is contained in:
tianshujie98
2021-03-15 09:40:46 +08:00
parent c55c18093c
commit b7cf68c746
10 changed files with 133 additions and 13 deletions
+1 -1
View File
@@ -2300,7 +2300,7 @@ class execution extends control
{
if($confirm == 'no')
{
$tip = $this->app->rawModule == 'executionstory' ? $this->lang->execution->confirmUnlinkExecutionStory : $this->lang->execution->confirmUnlinkStory;
$tip = $this->app->rawModule == 'projectstory' ? $this->lang->execution->confirmUnlinkExecutionStory : $this->lang->execution->confirmUnlinkStory;
die(js::confirm($tip, $this->createLink('execution', 'unlinkstory', "executionID=$executionID&storyID=$storyID&confirm=yes")));
}
else
+1 -1
View File
@@ -25,7 +25,7 @@ $(function()
var planID = $('#plan').val();
if(planID)
{
parent.location.href = createLink('project', 'importPlanStories', 'projectID=' + projectID + '&planID=' + planID);
parent.location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID);
}
})
+69 -1
View File
@@ -2043,12 +2043,51 @@ class executionModel extends model
$data->version = $versions[$storyID];
$data->order = ++$lastOrder;
$this->dao->insert(TABLE_PROJECTSTORY)->data($data)->exec();
$this->story->setStage($storyID);
$this->linkCases($executionID, (int)$products[$storyID], $storyID);
$action = $executionID == $this->session->PRJ ? 'linked2project' : 'linked2execution';
$this->action->create('story', $storyID, $action, '', $executionID);
}
}
/**
* Link cases.
*
* @param int $executionID
* @param int $productID
* @param int $storyID
* @param string $type
* @access public
* @return void
*/
public function linkCases($executionID, $productID, $storyID, $type = '')
{
$this->loadModel('action');
$linkedCases = $this->dao->select('*')->from(TABLE_PROJECTCASE)->where('project')->eq($executionID)->orderBy('order_desc')->fetchPairs('case', 'order');
$lastCaseOrder = empty($linkedCases) ? 0 : reset($linkedCases);
$cases = $this->dao->select('id, version')->from(TABLE_CASE)->where('story')->eq($storyID)->fetchParis('id');
foreach($cases as $caseID => $case)
{
if(isset($linkedCases[$caseID])) continue;
$object = new stdclass();
$object->project = $executionID;
$object->product = $productID;
$object->case = $caseID;
$object->version = $case->version;
$object->order = ++$lastCaseOrder;
$this->dao->insert(TABLE_PROJECTCASE)->data($object)->exec();
$action = $executionID == $this->session->PRJ ? 'linked2project' : 'linked2execution';
if($type) $action = $type == 'project' ? 'linked2project' : 'linked2execution';
$this->action->create('case', $caseID, $action, '', $executionID);
}
}
/**
* Link all stories by execution.
*
@@ -2103,7 +2142,7 @@ class executionModel extends model
public function unlinkStory($executionID, $storyID)
{
$execution = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch();
if($execution->type == 'execution')
if($execution->type == 'project')
{
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('parent')->eq($executionID)->fetchAll('id');
$executionStories = $this->dao->select('project,story')->from(TABLE_PROJECTSTORY)->where('story')->eq($storyID)->andWhere('project')->in(array_keys($executions))->fetchAll();
@@ -2120,6 +2159,7 @@ class executionModel extends model
}
$this->loadModel('story')->setStage($storyID);
$this->unlinkCases($executionID, $storyID);
$objectType = $executionID == $this->session->PRJ ? unlinkedfromproject : unlinkedfromexecution;
$this->loadModel('action')->create('story', $storyID, $objectType, '', $executionID);
@@ -2133,6 +2173,34 @@ class executionModel extends model
}
}
/**
* Unlink cases.
*
* @param int $executionID
* @param int $storyID
* @access public
* @return void
*/
public function unlinkCases($executionID, $storyID)
{
$this->loadModel('action');
$cases = $this->dao->select('id')->from(TABLE_CASE)->where('story')->eq($storyID)->fetchAll('id');
foreach($cases as $caseID => $case)
{
$this->dao->delete()->from(TABLE_PROJECTCASE)->where('project')->eq($executionID)->andWhere('`case`')->eq($caseID)->limit(1)->exec();
$action = $executionID == $this->session->PRJ ? 'unlinkedfromproject' : 'unlinkedfromexecution';
$this->action->create('case', $caseID, $action, '', $executionID);
}
$order = 1;
$cases = $this->dao->select('*')->from(TABLE_PROJECTCASE)->where('project')->eq($executionID)->orderBy('order')->fetchAll();
foreach($cases as $case)
{
if($case->order != $order) $this->dao->update(TABLE_PROJECTCASE)->set('`order`')->eq($order)->where('project')->eq($executionID)->andWhere('`case`')->eq($case->case)->exec();
$order++;
}
}
/**
* Get team members.
*
+1
View File
@@ -16,6 +16,7 @@
<?php js::set('moduleID', $this->cookie->storyModuleParam);?>
<?php js::set('productID', $this->cookie->storyProductParam);?>
<?php js::set('branchID', str_replace(',', '_', $this->cookie->storyBranchParam));?>
<?php js::set('executionID', $execution->id);?>
<?php js::set('confirmUnlinkStory', $lang->execution->confirmUnlinkStory)?>
<?php js::set('typeError', sprintf($this->lang->error->notempty, $this->lang->task->type))?>
<?php js::set('workingHourError', sprintf($this->lang->error->notempty, $this->lang->workingHour))?>
+6 -2
View File
@@ -213,8 +213,12 @@ $lang->testcase->searchStories = 'Story suchen';
$lang->testcase->selectLib = 'Bibliothek wählen';
$lang->testcase->action = new stdclass();
$lang->testcase->action->fromlib = array('main' => '$date, importiert von <strong>$actor</strong> aus Bibliothek <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, überprüft von <strong>$actor</strong> und Prüfungsergebnis ist <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->fromlib = array('main' => '$date, importiert von <strong>$actor</strong> aus Bibliothek <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, überprüft von <strong>$actor</strong> und Prüfungsergebnis ist <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->linked2project = array('main' => '$date, 由 <strong>$actor</strong> 关联到项目 <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromproject = array('main' => '$date, 由 <strong>$actor</strong> 从项目 <strong>$extra</strong> 移除。');
$lang->testcase->action->linked2execution = array('main' => '$date, 由 <strong>$actor</strong> 关联到' . $lang->executionCommon . ' <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromexecution = array('main' => '$date, 由 <strong>$actor</strong> 从' . $lang->executionCommon . ' <strong>$extra</strong> 移除。');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['wait'] = 'Wartend';
+6 -2
View File
@@ -213,8 +213,12 @@ $lang->testcase->searchStories = 'Enter to search for stories';
$lang->testcase->selectLib = 'Select Library';
$lang->testcase->action = new stdclass();
$lang->testcase->action->fromlib = array('main' => '$date, imported by <strong>$actor</strong> from <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, recorded by <strong>$actor</strong> and the review result is <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->fromlib = array('main' => '$date, imported by <strong>$actor</strong> from <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, recorded by <strong>$actor</strong> and the review result is <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->linked2project = array('main' => '$date, 由 <strong>$actor</strong> 关联到项目 <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromproject = array('main' => '$date, 由 <strong>$actor</strong> 从项目 <strong>$extra</strong> 移除。');
$lang->testcase->action->linked2execution = array('main' => '$date, 由 <strong>$actor</strong> 关联到' . $lang->executionCommon . ' <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromexecution = array('main' => '$date, 由 <strong>$actor</strong> 从' . $lang->executionCommon . ' <strong>$extra</strong> 移除。');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['wait'] = 'Waiting';
+6 -2
View File
@@ -213,8 +213,12 @@ $lang->testcase->searchStories = 'Rechercher des stories';
$lang->testcase->selectLib = 'Sélectionner Library';
$lang->testcase->action = new stdclass();
$lang->testcase->action->fromlib = array('main' => '$date, importé par <strong>$actor</strong> depuis <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, enregistré par <strong>$actor</strong> et le résultat de validation est <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->fromlib = array('main' => '$date, importé par <strong>$actor</strong> depuis <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, enregistré par <strong>$actor</strong> et le résultat de validation est <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->linked2project = array('main' => '$date, 由 <strong>$actor</strong> 关联到项目 <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromproject = array('main' => '$date, 由 <strong>$actor</strong> 从项目 <strong>$extra</strong> 移除。');
$lang->testcase->action->linked2execution = array('main' => '$date, 由 <strong>$actor</strong> 关联到' . $lang->executionCommon . ' <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromexecution = array('main' => '$date, 由 <strong>$actor</strong> 从' . $lang->executionCommon . ' <strong>$extra</strong> 移除。');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['wait'] = 'En Attente';
+6 -2
View File
@@ -213,8 +213,12 @@ $lang->testcase->searchStories = 'Nhập nội dung cần tìm cho câu chuyện
$lang->testcase->selectLib = 'Chọn thư viện';
$lang->testcase->action = new stdclass();
$lang->testcase->action->fromlib = array('main' => '$date, nhập bởi <strong>$actor</strong> từ <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, ghi nhận bởi <strong>$actor</strong> và kết quả xét duyệt này là <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->fromlib = array('main' => '$date, nhập bởi <strong>$actor</strong> từ <strong>$extra</strong>.');
$lang->testcase->action->reviewed = array('main' => '$date, ghi nhận bởi <strong>$actor</strong> và kết quả xét duyệt này là <strong>$extra</strong>.', 'extra' => 'reviewResultList');
$lang->testcase->action->linked2project = array('main' => '$date, 由 <strong>$actor</strong> 关联到项目 <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromproject = array('main' => '$date, 由 <strong>$actor</strong> 从项目 <strong>$extra</strong> 移除。');
$lang->testcase->action->linked2execution = array('main' => '$date, 由 <strong>$actor</strong> 关联到' . $lang->executionCommon . ' <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromexecution = array('main' => '$date, 由 <strong>$actor</strong> 从' . $lang->executionCommon . ' <strong>$extra</strong> 移除。');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['wait'] = 'Đang đợi';
+6 -2
View File
@@ -213,8 +213,12 @@ $lang->testcase->searchStories = "键入来搜索{$lang->SRCommon}";
$lang->testcase->selectLib = '请选择库';
$lang->testcase->action = new stdclass();
$lang->testcase->action->fromlib = array('main' => '$date, 由 <strong>$actor</strong> 从用例库 <strong>$extra</strong>导入。');
$lang->testcase->action->reviewed = array('main' => '$date, 由 <strong>$actor</strong> 记录评审结果,结果为 <strong>$extra</strong>。', 'extra' => 'reviewResultList');
$lang->testcase->action->fromlib = array('main' => '$date, 由 <strong>$actor</strong> 从用例库 <strong>$extra</strong>导入。');
$lang->testcase->action->reviewed = array('main' => '$date, 由 <strong>$actor</strong> 记录评审结果,结果为 <strong>$extra</strong>。', 'extra' => 'reviewResultList');
$lang->testcase->action->linked2project = array('main' => '$date, 由 <strong>$actor</strong> 关联到项目 <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromproject = array('main' => '$date, 由 <strong>$actor</strong> 从项目 <strong>$extra</strong> 移除。');
$lang->testcase->action->linked2execution = array('main' => '$date, 由 <strong>$actor</strong> 关联到' . $lang->executionCommon . ' <strong>$extra</strong>。');
$lang->testcase->action->unlinkedfromexecution = array('main' => '$date, 由 <strong>$actor</strong> 从' . $lang->executionCommon . ' <strong>$extra</strong> 移除。');
$lang->testcase->featureBar['browse']['all'] = $lang->testcase->allCases;
$lang->testcase->featureBar['browse']['wait'] = '待评审';
+31
View File
@@ -699,6 +699,37 @@ class testcaseModel extends model
}
}
/* Process the project and execute the use case. */
if($case->story != $oldCase->story)
{
$this->loadModel('action');
$oldProjects = $this->dao->select('t1.project,t2.type')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.story')->eq($oldCase->story)
->fetchPairs();
foreach($oldProjects as $id => $type)
{
$this->dao->delete()->from(TABLE_PROJECTCASE)->where('project')->eq($id)->andWhere('`case`')->eq($caseID)->exec();
$action = $type == 'project' ? 'unlinkedfromproject' : 'unlinkedfromexecution';
$this->action->create('case', $caseID, $action, '', $executionID);
}
if($case->story != 0)
{
$this->loadModel('execution');
$projects = $this->dao->select('t1.project,t2.type')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.story')->eq($case->story)
->fetchPairs();
foreach($projects as $id => $type)
{
$this->execution->linkCases($id, $case->product, $case->story, $type);
}
}
}
/* Join the steps to diff. */
if($stepChanged and $this->post->steps)
{