+ testtaskZen: add method to set configuration of search form in linkCase page of a testtask.

This commit is contained in:
liugang
2023-09-18 15:55:48 +08:00
parent fa0c57aac1
commit f5869e96ab
+52
View File
@@ -56,6 +56,58 @@ class testtaskZen extends testtask
$this->loadModel('search')->setSearchParams($searchConfig);
}
/**
* 设置测试单关联用例页面搜索表单的参数。
* Set congiruration of search form in linkCase page of testtask.
*
* @param object $product
* @param object $task
* @param string $type
* @param int $param
* @access protected
* @return void
*/
protected function setSearchParamsForLinkCase(object $product, object $task, string $type, int $param): void
{
$this->loadModel('testcase');
$searchConfig = $this->config->testcase->search;
$searchConfig['style'] = 'simple';
$searchConfig['actionURL'] = inlink('linkcase', "taskID={$task->id}&type={$type}&param={$param}");
$searchConfig['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($product->id, 'case', 0, $task->branch);
$searchConfig['params']['scene']['values'] = $this->testcase->getSceneMenu($product->id, 0, 'case', 0, 0);
$searchConfig['params']['product']['values'] = array($product->id => $product->name);
$build = $this->loadModel('build')->getByID($task->build);
if($build)
{
$searchConfig['params']['story']['values'] = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($build->stories)->fetchPairs();
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story');
}
if($type != 'bystory')
{
unset($searchConfig['fields']['story']);
unset($searchConfig['params']['story']);
}
if($product->shadow) unset($searchConfig['fields']['product']);
if($product->type == 'normal')
{
unset($searchConfig['fields']['branch']);
unset($searchConfig['params']['branch']);
}
else
{
$branchName = $this->loadModel('branch')->getById($task->branch);
$branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $task->branch => $branchName);
$searchConfig['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$searchConfig['params']['branch']['values'] = $branches;
}
if(!$this->config->testcase->needReview) unset($searchConfig['params']['status']['values']['wait']);
$this->loadModel('search')->setSearchParams($searchConfig);
}
/**
* 构建编辑的测试单数据。
* Build task for editing.