From 15ab56b7856bce7e5cbc24dccb4815ad789e686d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 22 Mar 2017 15:04:10 +0800 Subject: [PATCH] * fix bug #1035. --- module/testcase/model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index ef6185fc95..5f9bf547a3 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -923,6 +923,7 @@ class testcaseModel extends model ->fetchGroup('case'); $oldCases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($_POST['id'])->fetchAll('id'); } + $storyVersionPairs = $this->dao->select('id,version')->from(TABLE_STORY)->where('id')->in($data->story)->fetchPairs('id', 'version'); $cases = array(); foreach($data->product as $key => $product) @@ -1003,7 +1004,8 @@ class testcaseModel extends model $version = $stepChanged ? $oldCase->version + 1 : $oldCase->version; $caseData->version = $version; - $changes = common::createChanges($oldCase, $caseData); + $changes = common::createChanges($oldCase, $caseData); + if($caseData->story != $oldCase->story) $caseData->storyVersion = zget($storyVersionPairs, $caseData->story, 1); if(!$changes and !$stepChanged) continue; if($changes or $stepChanged) @@ -1044,6 +1046,7 @@ class testcaseModel extends model $caseData->openedBy = $this->app->user->account; $caseData->openedDate = $now; $caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch; + if($caseData->story) $caseData->storyVersion = zget($storyVersionPairs, $caseData->story, 1); if($forceReview) $caseData->status = 'wait'; $this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec();