Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2017-03-22 14:12:51 +08:00
4 changed files with 81 additions and 10 deletions
+23 -7
View File
@@ -727,7 +727,7 @@ class testcase extends control
$this->view->cases = $cases;
$this->display();
}
}
/**
* Review case.
@@ -806,6 +806,21 @@ class testcase extends control
}
}
/**
* Batch delete cases.
*
* @param int $productID
* @access public
* @return void
*/
public function batchDelete($productID = 0)
{
$caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList));
foreach($caseIDList as $caseID) $this->testcase->delete(TABLE_CASE, $caseID);
die(js::locate($this->session->caseList));
}
/**
* Batch change the module of case.
*
@@ -833,18 +848,19 @@ class testcase extends control
}
/**
* Batch delete cases.
* Batch review case.
*
* @param int $productID
* @param string $result
* @access public
* @return void
*/
public function batchDelete($productID = 0)
public function batchCaseTypeChange($result)
{
$caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList));
$caseIdList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList, 'parent'));
$this->testcase->batchCaseTypeChange($caseIdList, $result);
foreach($caseIDList as $caseID) $this->testcase->delete(TABLE_CASE, $caseID);
die(js::locate($this->session->caseList));
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate($this->session->caseList, 'parent'));
}
/**
+1
View File
@@ -77,6 +77,7 @@ $lang->testcase->batchChangeModule = "批量修改模块";
$lang->testcase->delete = "删除";
$lang->testcase->batchDelete = "批量删除 ";
$lang->testcase->batchConfirmStoryChange = "确认变更";
$lang->testcase->batchCaseTypeChange = "用例类型";
$lang->testcase->browse = "用例列表";
$lang->testcase->groupCase = "分组浏览用例";
$lang->testcase->import = "导入";
+27
View File
@@ -798,9 +798,36 @@ class testcaseModel extends model
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->where('id')->eq((int)$caseID)->exec();
if(!dao::isError()) $allChanges[$caseID] = common::createChanges($oldCase, $case);
}
return $allChanges;
}
/**
* Batch case type change.
*
* @param array $caseIDList
* @param string $result
* @access public
* @return array
*/
public function batchCaseTypeChange($caseIdList, $result)
{
$now = helper::now();
$actions = array();
$this->loadModel('action');
foreach($caseIdList as $caseID)
{
$case = new stdClass();
$case->lastEditedBy = $this->app->user->account;
$case->lastEditedDate = $now;
$case->type = $result;
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->where('id')->eq($caseID)->exec();
$this->action->create('case', $caseID, 'Edited', '', ucfirst($result));
}
}
/**
* Join steps to a string, thus can diff them.
*
+30 -3
View File
@@ -85,9 +85,17 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
echo '<li>' . html::a('javascript:;', $lang->testcase->review, '', $class) . '</li>';
}
$actionLink = $this->createLink('testcase', 'batchConfirmStoryChange', "productID=$productID");
$misc = common::hasPriv('testcase', 'batchConfirmStoryChange') ? "onclick=\"setFormAction('$actionLink')\"" : $class;
echo "<li>" . html::a('#', $lang->testcase->batchConfirmStoryChange, '', $misc) . "</li>";
if(common::hasPriv('testcase', 'batchConfirmStoryChange'))
{
$actionLink = $this->createLink('testcase', 'batchConfirmStoryChange', "productID=$productID");
$misc = common::hasPriv('testcase', 'batchConfirmStoryChange') ? "onclick=\"setFormAction('$actionLink')\"" : $class;
echo "<li>" . html::a('#', $lang->testcase->batchConfirmStoryChange, '', $misc) . "</li>";
}
else
{
echo '<li>' . html::a('javascript:;', $lang->testcase->batchConfirmStoryChange, '', $class) . '</li>';
}
$actionLink = $this->createLink('testtask', 'batchRun', "productID=$productID&orderBy=$orderBy");
$misc = common::hasPriv('testtask', 'batchRun') ? "onclick=\"setFormAction('$actionLink')\"" : $class;
@@ -113,6 +121,25 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete);
{
echo '<li>' . html::a('javascript:;', $lang->testcase->moduleAB, '', $class) . '</li>';
}
if(common::hasPriv('testcase', 'batchCaseTypeChange'))
{
echo "<li class='dropdown-submenu'>";
echo html::a('javascript:;', $lang->testcase->batchCaseTypeChange, '', "id='typeChangeItem'");
echo "<ul class='dropdown-menu'>";
unset($lang->testcase->typeList['']);
foreach($lang->testcase->typeList as $key => $result)
{
$actionLink = $this->createLink('testcase', 'batchCaseTypeChange', "result=$key");
echo '<li>' . html::a('#', $result, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . '</li>';
}
echo '</ul></li>';
}
else
{
echo '<li>' . html::a('javascript:;', $lang->testcase->batchCaseTypeChange, '', $class) . '</li>';
}
?>
</ul>
</div>