diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php
index e79c66666c..5be322c0bd 100644
--- a/module/story/view/view.html.php
+++ b/module/story/view/view.html.php
@@ -293,7 +293,7 @@
{
if(!isset($projects[$task->project])) continue;
$projectName = $projects[$task->project];
- echo "
" . html::a($this->createLink('task', 'view', "taskID=$task->id", '', true), "#$task->id $task->name", '', "class='iframe' data-width='80%'");
+ echo "" . html::a($this->createLink('task', 'view', "taskID=$task->id", '', true), "[T]$task->id $task->name", '', "class='iframe' data-width='80%'");
echo html::a($this->createLink('project', 'browse', "projectID=$task->project"), $projectName, '', "class='text-muted'") . '';
}
}
@@ -329,7 +329,7 @@
id $bug->title'>" . html::a($this->createLink('bug', 'view', "bugID=$bug->id", '', true), "#$bug->id $bug->title", '', "class='iframe' data-width='80%'") . '';
+ echo "" . html::a($this->createLink('bug', 'view', "bugID=$bug->id", '', true), "[B]$bug->id $bug->title", '', "class='iframe' data-width='80%'") . '';
}
?>
@@ -342,7 +342,7 @@
id $case->title'>" . html::a($this->createLink('testcase', 'view', "caseID=$case->id", '', true), "#$case->id $case->title", '', "class='iframe' data-width='80%'") . '';
+ echo "" . html::a($this->createLink('testcase', 'view', "caseID=$case->id", '', true), "[C]$case->id $case->title", '', "class='iframe' data-width='80%'") . '';
}
?>
@@ -357,7 +357,7 @@
$linkStories = explode(',', $story->linkStories) ;
foreach($linkStories as $linkStoryID)
{
- if(isset($story->extraStories[$linkStoryID])) echo '' . html::a($this->createLink('story', 'view', "storyID=$linkStoryID", '', true), "#$linkStoryID " . $story->extraStories[$linkStoryID], '', "class='iframe' data-width='80%'") . '';
+ if(isset($story->extraStories[$linkStoryID])) echo '' . html::a($this->createLink('story', 'view', "storyID=$linkStoryID", '', true), "[S]$linkStoryID " . $story->extraStories[$linkStoryID], '', "class='iframe' data-width='80%'") . '';
}
?>
diff --git a/module/testcase/control.php b/module/testcase/control.php
index b1017e7134..ff04edd472 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -546,9 +546,19 @@ class testcase extends control
* @access public
* @return void
*/
- public function edit($caseID, $comment = false)
+ public function edit($caseID, $comment = false, $confirm = 'no')
{
$this->loadModel('story');
+ $case = $this->testcase->getById($caseID);
+ $isLibCase = ($case->lib and empty($case->product));
+
+ if($confirm == 'yes')
+ {
+ $linkedCaseID = '';
+ if($isLibCase) $linkedCaseID = $this->dao->select('id')->from(TABLE_CASE)->where('fromCaseID')->eq($caseID)->fetchPairs();
+ if(!empty($linkedCaseID)) $this->testcase->updateLinkedCases($linkedCaseID, $case->steps);
+ die(js::locate($this->createLink('testcase', 'view', "caseID=$caseID"), 'parent'));
+ }
if(!empty($_POST))
{
@@ -569,10 +579,17 @@ class testcase extends control
$actionID = $this->action->create('case', $caseID, $action, $fileAction . $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
+
+ $stepChanged = false;
+ foreach($changes as $change)
+ {
+ if($change['field'] == 'version') $stepChanged = true;
+ }
+
+ if($isLibCase and $stepChanged) die(js::confirm($this->lang->testcase->haveLinkCase, inlink('edit', "caseID=$caseID&comment=&confirm=yes"), inlink('view', "caseID=$caseID"), 'parent', 'parent'));
die(js::locate($this->createLink('testcase', 'view', "caseID=$caseID"), 'parent'));
}
- $case = $this->testcase->getById($caseID);
if(empty($case->steps))
{
$step = new stdclass();
@@ -582,7 +599,6 @@ class testcase extends control
$case->steps[] = $step;
}
- $isLibCase = ($case->lib and empty($case->product));
if($isLibCase)
{
$libraries = $this->loadModel('testsuite')->getLibraries();
@@ -596,7 +612,6 @@ class testcase extends control
$this->view->libID = $case->lib;
$this->view->libName = $libraries[$case->lib];
$this->view->libraries = $libraries;
- $this->view->linkedCaseID = $this->testcase->getLinkedCaseID($case->lib, $caseID);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($case->lib, $viewType = 'caselib', $startModuleID = 0);
}
else
diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php
index d3d069d399..a1c35e6f06 100644
--- a/module/testcase/lang/en.php
+++ b/module/testcase/lang/en.php
@@ -139,7 +139,7 @@ $lang->testcase->confirmDelete = 'Do you want to delete this Test Case?';
$lang->testcase->confirmBatchDelete = 'Do you want to batch delete these Test Cases?';
$lang->testcase->ditto = 'Ditto';
$lang->testcase->dittoNotice = 'This Case does not belong to the Product as the previous one!';
-$lang->testcase->haveLinkCase = 'It has linked case, update this one, the linked case will change.';
+$lang->testcase->haveLinkCase = 'It has linked cases. Confirm it first and linked cases will be updated.';
$lang->testcase->reviewList[0] = 'NO';
$lang->testcase->reviewList[1] = 'YES';
diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php
index faef133b49..aa5a67c606 100644
--- a/module/testcase/lang/zh-cn.php
+++ b/module/testcase/lang/zh-cn.php
@@ -139,7 +139,7 @@ $lang->testcase->confirmDelete = '您确认要删除该测试用例吗?';
$lang->testcase->confirmBatchDelete = '您确认要批量删除这些测试用例吗?';
$lang->testcase->ditto = '同上';
$lang->testcase->dittoNotice = '该用例与上一用例不属于同一产品!';
-$lang->testcase->haveLinkCase = '此用例存在相关用例,更新后,其相关用例会一并更新。';
+$lang->testcase->haveLinkCase = '此用例存在相关用例,确认后,其相关用例会一并更新。';
$lang->testcase->reviewList[0] = '否';
$lang->testcase->reviewList[1] = '是';
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 6fb57ab2c6..8f80a7b518 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -604,24 +604,6 @@ class testcaseModel extends model
return $caseCounts;
}
- /**
- * Check have linked cases or not.
- *
- * @param int $libID
- * @param int $caseID$
- * @access public
- * @return int
- */
- public function getLinkedCaseID($libID, $caseID)
- {
- $linkedCaseID = $this->dao->select('id')->from(TABLE_CASE)
- ->where('lib')->eq($libID)
- ->andWhere('fromCaseID')->eq($caseID)
- ->andWhere('deleted')->eq(0)
- ->fetch('id');
- return $linkedCaseID;
- }
-
/**
* Update a case.
*
@@ -631,10 +613,7 @@ class testcaseModel extends model
*/
public function update($caseID)
{
- $oldCase = $this->getById($caseID);
- $isLibCase = ($oldCase->lib and empty($oldCase->product));
- $linkedCases = '';
- if($isLibCase) $linkedCases = $this->dao->select('id')->from(TABLE_CASE)->where('fromCaseID')->eq($caseID)->fetchPairs();
+ $oldCase = $this->getById($caseID);
if(!empty($_POST['lastEditedDate']) and $oldCase->lastEditedDate != $this->post->lastEditedDate)
{
dao::$errors[] = $this->lang->error->editedByOther;
@@ -687,10 +666,6 @@ class testcaseModel extends model
->get();
if(!$this->forceNotReview() and $stepChanged) $case->status = 'wait';
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec();
- if($isLibCase and $linkedCases)
- {
- foreach($linkedCases as $linkedCaseID) $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$linkedCaseID)->exec();
- }
if(!$this->dao->isError())
{
if($stepChanged)
@@ -710,15 +685,6 @@ class testcaseModel extends model
$this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
if($step->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($step->type == 'step') $parentStepID = 0;
-
- if($isLibCase and $linkedCases)
- {
- foreach($linkedCases as $linkedCaseID)
- {
- $step->case = $linkedCaseID;
- $this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
- }
- }
}
}
@@ -736,6 +702,31 @@ class testcaseModel extends model
}
}
+ /**
+ * Update linked case.
+ *
+ * @param int $linkedCaseID
+ * @param object $steps
+ * @access public
+ * @return bool
+ */
+ public function updateLinkedCases($linkedCaseID, $steps)
+ {
+ foreach($linkedCaseID as $caseID)
+ {
+ $version = $this->dao->findByID($caseID)->from(TABLE_CASE)->fetch('version');
+ $version = $version + 1;
+ foreach($steps as $step)
+ {
+ unset($step->id);
+ $step->case = $caseID;
+ $step->version = $version;
+ $this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
+ }
+ $this->dao->update(TABLE_CASE)->set('version')->eq($version)->where('id')->eq($caseID)->exec();
+ }
+ }
+
/**
* Review case
*
diff --git a/module/testcase/view/edit.html.php b/module/testcase/view/edit.html.php
index 3ad89a1bfc..9ee9fb39fa 100644
--- a/module/testcase/view/edit.html.php
+++ b/module/testcase/view/edit.html.php
@@ -125,7 +125,6 @@
lastEditedDate);?>
createLink('testcase', 'browse', "productID=$productID");?>"' />
- ' . $lang->testcase->haveLinkCase . ''; ?>