From 2d9d78fd8c79d4ba67afab6376cc22028c3cacdd Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 26 Feb 2019 11:45:18 +0800 Subject: [PATCH 01/37] * adjust for sort lib. --- module/doc/view/side.html.php | 112 ++++++++++++++++------------------ 1 file changed, 53 insertions(+), 59 deletions(-) diff --git a/module/doc/view/side.html.php b/module/doc/view/side.html.php index d15f51a14d..c45180225a 100644 --- a/module/doc/view/side.html.php +++ b/module/doc/view/side.html.php @@ -162,18 +162,18 @@ if(empty($type)) $type = 'product'; -goback);?> From c31b04da6772e45f22f8e390bb4344ef41dc24bc Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 26 Feb 2019 14:06:07 +0800 Subject: [PATCH 02/37] * Code for task #5267. --- module/story/view/view.html.php | 8 ++-- module/testcase/control.php | 23 +++++++++-- module/testcase/lang/en.php | 2 +- module/testcase/lang/zh-cn.php | 2 +- module/testcase/model.php | 61 +++++++++++++----------------- module/testcase/view/edit.html.php | 1 - 6 files changed, 51 insertions(+), 46 deletions(-) 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 . ''; ?> From e35a268a319aafa5904e908fdb73a851aa22a718 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 26 Feb 2019 14:11:37 +0800 Subject: [PATCH 03/37] * Code for task #5294. --- module/doc/css/view.css | 1 + 1 file changed, 1 insertion(+) diff --git a/module/doc/css/view.css b/module/doc/css/view.css index 82677f858d..b62e842ac4 100644 --- a/module/doc/css/view.css +++ b/module/doc/css/view.css @@ -18,3 +18,4 @@ .main-row > .side-col > .cell {transition: opacity .2s;} .doc-fullscreen .main-row > .side-col {width: 0; position: relative; overflow: hidden} .doc-fullscreen .fullscreen-btn > .icon-fullscreen:before {content: '\e972'} +.right-icon a{color: #1183fb} From efe734f04af9b880c9249fcb25827090dfa6daf9 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 26 Feb 2019 14:28:26 +0800 Subject: [PATCH 04/37] * Code for task #5284. --- module/bug/model.php | 2 +- module/bug/view/view.html.php | 2 +- module/my/view/bug.html.php | 2 +- module/my/view/story.html.php | 2 +- module/my/view/task.html.php | 2 +- module/product/view/view.html.php | 2 +- module/project/view/bug.html.php | 2 +- module/project/view/view.html.php | 2 +- module/story/model.php | 2 +- module/story/view/view.html.php | 2 +- module/task/model.php | 2 +- module/task/view/view.html.php | 4 ++-- module/testreport/view/view.html.php | 2 +- module/testtask/view/view.html.php | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index f7721b011c..488731e875 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2649,7 +2649,7 @@ class bugModel extends model $params = "bugID=$bug->id"; common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'confirm', '', 'iframe', true); common::printIcon('bug', 'resolve', $params, $bug, 'list', 'checked', '', 'iframe', true); - common::printIcon('bug', 'close', $params, $bug, 'list', 'close', '', 'iframe', true); + common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'edit', $params, $bug, 'list'); common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=$params", $bug, 'list', 'copy'); break; diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index fc32f2de3e..72eeaaabb8 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -73,7 +73,7 @@ common::printIcon('bug', 'confirmBug', $params, $bug, 'button', 'search', '', 'iframe', true); common::printIcon('bug', 'assignTo', $params, $bug, 'button', '', '', 'iframe', true); common::printIcon('bug', 'resolve', $params, $bug, 'button', 'checked', '', 'iframe showinonlybody', true); - common::printIcon('bug', 'close', $params, $bug, 'button', 'close', '', 'text-danger iframe showinonlybody', true); + common::printIcon('bug', 'close', $params, $bug, 'button', '', '', 'text-danger iframe showinonlybody', true); common::printIcon('bug', 'activate', $params, $bug, 'button', '', '', 'text-success iframe showinonlybody', true); if($config->global->flow != 'onlyTest') common::printIcon('bug', 'toStory', "product=$bug->product&branch=$bug->branch&module=0&story=0&project=0&bugID=$bug->id", $bug, 'button', $lang->icons['story']); diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index b47830f627..13e5817b86 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -95,7 +95,7 @@ $params = "bugID=$bug->id"; common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'confirm', '', 'iframe', true); common::printIcon('bug', 'resolve', $params, $bug, 'list', 'checked', '', 'iframe', true); - common::printIcon('bug', 'close', $params, $bug, 'list', 'close', '', 'iframe', true); + common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'edit', $params, $bug, 'list'); common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=$params", $bug, 'list', 'copy'); ?> diff --git a/module/my/view/story.html.php b/module/my/view/story.html.php index 17f5ed9b3d..b010211ae6 100644 --- a/module/my/view/story.html.php +++ b/module/my/view/story.html.php @@ -82,7 +82,7 @@ $vars = "story={$story->id}"; common::printIcon('story', 'change', $vars, $story, 'list', 'fork'); common::printIcon('story', 'review', $vars, $story, 'list', 'glasses'); - common::printIcon('story', 'close', $vars, $story, 'list', 'close', '', 'iframe', true); + common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true); common::printIcon('story', 'edit', $vars, $story, 'list'); if($config->global->flow != 'onlyStory') common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); ?> diff --git a/module/my/view/task.html.php b/module/my/view/task.html.php index 2a4636e731..34ff273719 100644 --- a/module/my/view/task.html.php +++ b/module/my/view/task.html.php @@ -96,7 +96,7 @@ { if($task->status != 'pause') common::printIcon('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); if($task->status == 'pause') common::printIcon('task', 'restart', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', 'close', '', 'iframe', true, ''); + common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true, ''); common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true); diff --git a/module/product/view/view.html.php b/module/product/view/view.html.php index 9d9151e05b..6cfa0493e1 100644 --- a/module/product/view/view.html.php +++ b/module/product/view/view.html.php @@ -87,7 +87,7 @@ echo "
    "; if($product->status != 'closed') { - common::printIcon('product', 'close', $params, $product, 'button', 'close', '', 'iframe', true); + common::printIcon('product', 'close', $params, $product, 'button', '', '', 'iframe', true); echo "
    "; } diff --git a/module/project/view/bug.html.php b/module/project/view/bug.html.php index c2f5642cff..543809d370 100644 --- a/module/project/view/bug.html.php +++ b/module/project/view/bug.html.php @@ -101,7 +101,7 @@ $params = "bugID=$bug->id"; common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'confirm', '', 'iframe', true); common::printIcon('bug', 'resolve', $params, $bug, 'list', 'checked', '', 'iframe', true); - common::printIcon('bug', 'close', $params, $bug, 'list', 'close', '', 'iframe', true); + common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=$params", $bug, 'list', 'copy'); common::printIcon('bug', 'edit', $params, $bug, 'list'); ?> diff --git a/module/project/view/view.html.php b/module/project/view/view.html.php index e9c66cec98..33bc0ce5a9 100644 --- a/module/project/view/view.html.php +++ b/module/project/view/view.html.php @@ -157,7 +157,7 @@ common::printIcon('project', 'activate', "projectID=$project->id", $project, 'button', '', '', 'iframe', true); common::printIcon('project', 'putoff', "projectID=$project->id", $project, 'button', '', '', 'iframe', true); common::printIcon('project', 'suspend', "projectID=$project->id", $project, 'button', '', '', 'iframe', true); - common::printIcon('project', 'close', "projectID=$project->id", $project, 'button', 'close', '', 'iframe', true); + common::printIcon('project', 'close', "projectID=$project->id", $project, 'button', '', '', 'iframe', true); echo "
    "; common::printIcon('project', 'edit', $params, $project); diff --git a/module/story/model.php b/module/story/model.php index 0d4a51d22c..be8e3e58fd 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2459,7 +2459,7 @@ class storyModel extends model $vars = "story={$story->id}"; common::printIcon('story', 'change', $vars, $story, 'list', 'fork'); common::printIcon('story', 'review', $vars, $story, 'list', 'glasses'); - common::printIcon('story', 'close', $vars, $story, 'list', 'close', '', 'iframe', true); + common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true); common::printIcon('story', 'edit', $vars, $story, 'list'); if($this->config->global->flow != 'onlyStory') common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); break; diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index 5be322c0bd..8b20cd5213 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -78,7 +78,7 @@ if(common::hasPriv('story', 'batchCreate')) echo html::a($link, " " . $lang->story->subdivide, '', $misc); } - common::printIcon('story', 'close', "storyID=$story->id", $story, 'button', 'close', '', 'iframe showinonlybody', true); + common::printIcon('story', 'close', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true); common::printIcon('story', 'activate', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true); if($config->global->flow != 'onlyStory' and !isonlybody() and (common::hasPriv('testcase', 'create') or common::hasPriv('testcase', 'batchCreate'))) diff --git a/module/task/model.php b/module/task/model.php index 45f9029dba..710e70ba06 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2619,7 +2619,7 @@ class taskModel extends model if($task->status != 'pause') common::printIcon('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); if($task->status == 'pause') common::printIcon('task', 'restart', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', 'close', '', 'iframe', true); + common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true); diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index d257efcc16..1f6a7bd7a6 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -131,7 +131,7 @@ common::printIcon('task', 'activate', "taskID=$child->id", $child, 'list', '', '', 'iframe', true); common::printIcon('task', 'recordEstimate', "taskID=$child->id", $child, 'list', 'time', '', 'iframe', true); common::printIcon('task', 'finish', "taskID=$child->id", $child, 'list', '', '', 'iframe', true); - common::printIcon('task', 'close', "taskID=$child->id", $child, 'list', 'close', '', 'iframe', true); + common::printIcon('task', 'close', "taskID=$child->id", $child, 'list', '', '', 'iframe', true); common::printIcon('task', 'edit', "taskID=$child->id", $child, 'list'); ?> @@ -159,7 +159,7 @@ common::printIcon('task', 'pause', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody', true); common::printIcon('task', 'finish', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody text-success', true); common::printIcon('task', 'activate', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody text-success', true); - common::printIcon('task', 'close', "taskID=$task->id", $task, 'button', 'close', '', 'iframe showinonlybody', true); + common::printIcon('task', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody', true); common::printIcon('task', 'cancel', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody', true); if(!isonlybody()) echo "
    "; diff --git a/module/testreport/view/view.html.php b/module/testreport/view/view.html.php index 664d26938c..9b699334fe 100644 --- a/module/testreport/view/view.html.php +++ b/module/testreport/view/view.html.php @@ -16,7 +16,7 @@