* finish task #983.
This commit is contained in:
+18
-8
@@ -506,17 +506,27 @@ class commonModel extends model
|
||||
else
|
||||
{
|
||||
/* Get objectIDs. */
|
||||
$queryCondition = $type . 'QueryCondition';
|
||||
$queryCondition = $type . 'QueryCondition';
|
||||
$typeOnlyCondition = $type . 'OnlyCondition';
|
||||
$queryCondition = $this->session->$queryCondition;
|
||||
$orderBy = $type . 'OrderBy';
|
||||
$orderBy = $this->session->$orderBy;
|
||||
$orderBy = str_replace('`left`', 'left', $orderBy); // process the `left` to left.
|
||||
$objects = $this->dao->select('*')->from($table)
|
||||
->beginIF($queryCondition != false)->where($queryCondition)->fi()
|
||||
->beginIF($orderBy != false)->orderBy($orderBy)->fi()
|
||||
->fetchAll();
|
||||
|
||||
if($this->session->$typeOnlyCondition)
|
||||
{
|
||||
$objects = $this->dao->select('*')->from($table)
|
||||
->beginIF($queryCondition != false)->where($queryCondition)->fi()
|
||||
->beginIF($orderBy != false)->orderBy($orderBy)->fi()
|
||||
->fetchAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
$objects = $this->dbh->query($queryCondition . " ORDER BY $orderBy")->fetchAll();
|
||||
}
|
||||
|
||||
$tmpObjectIDs = array();
|
||||
foreach($objects as $object) $tmpObjectIDs[$object->id] = $object->id;
|
||||
foreach($objects as $object) $tmpObjectIDs[$object->id] = (!$this->session->$typeOnlyCondition and $type == 'testcase') ? $object->case : $object->id;
|
||||
$objectIDs = ',' . implode(',', $tmpObjectIDs) . ',';
|
||||
$this->session->set($type . 'IDs', $objectIDs);
|
||||
}
|
||||
@@ -563,10 +573,10 @@ class commonModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveQueryCondition($sql, $objectType, $onlyCondition = 'true')
|
||||
public function saveQueryCondition($sql, $objectType, $onlyCondition = true)
|
||||
{
|
||||
/* Set the query condition session. */
|
||||
if($onlyCondition == 'true')
|
||||
if($onlyCondition)
|
||||
{
|
||||
$queryCondition = explode('WHERE', $sql);
|
||||
$queryCondition = explode('ORDER', $queryCondition[1]);
|
||||
|
||||
@@ -32,6 +32,7 @@ $config->company->browse->search['fields']['realname'] = $lang->user->realname;
|
||||
$config->company->browse->search['fields']['email'] = $lang->user->email;
|
||||
$config->company->browse->search['fields']['dept'] = $lang->user->dept;
|
||||
$config->company->browse->search['fields']['account'] = $lang->user->account;
|
||||
$config->company->browse->search['fields']['role'] = $lang->user->role;
|
||||
$config->company->browse->search['fields']['phone'] = $lang->user->phone;
|
||||
$config->company->browse->search['fields']['join'] = $lang->user->join;
|
||||
$config->company->browse->search['fields']['id'] = $lang->user->id;
|
||||
@@ -51,6 +52,7 @@ $config->company->browse->search['params']['realname'] = array('operator' => 'in
|
||||
$config->company->browse->search['params']['email'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->company->browse->search['params']['dept'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
|
||||
$config->company->browse->search['params']['account'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->company->browse->search['params']['role'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->user->roleList);
|
||||
$config->company->browse->search['params']['phone'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
$config->company->browse->search['params']['join'] = array('operator' => '>=', 'control' => 'input', 'values' => '', 'class' => 'date');
|
||||
$config->company->browse->search['params']['id'] = array('operator' => '=', 'control' => 'input', 'values' => '');
|
||||
|
||||
@@ -503,7 +503,7 @@ class project extends control
|
||||
|
||||
/* The pager. */
|
||||
$stories = $this->story->getProjectStories($projectID, $orderBy);
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story', 'false');
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story', false);
|
||||
$storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID);
|
||||
$users = $this->user->getPairs('noletter');
|
||||
|
||||
|
||||
@@ -878,7 +878,7 @@ class story extends control
|
||||
|
||||
/* Get stories. */
|
||||
$stories = array();
|
||||
if($this->session->storyOnlyCondition == 'true')
|
||||
if($this->session->storyOnlyCondition)
|
||||
{
|
||||
$stories = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyQueryCondition)
|
||||
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
|
||||
|
||||
@@ -530,7 +530,7 @@ class testcase extends control
|
||||
}
|
||||
|
||||
/* Get cases. */
|
||||
if($this->session->testcaseOnlyCondition == 'true')
|
||||
if($this->session->testcaseOnlyCondition)
|
||||
{
|
||||
if($taskID)
|
||||
{
|
||||
|
||||
@@ -230,7 +230,7 @@ class testtask extends control
|
||||
{
|
||||
$this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $orderBy, $pager);
|
||||
}
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', 'false');
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
|
||||
|
||||
/* Save testcaseIDs session for get the pre and next testcase. */
|
||||
$testcaseIDs = '';
|
||||
@@ -443,7 +443,19 @@ class testtask extends control
|
||||
if(!$caseID) $run = $this->testtask->getRunById($runID);
|
||||
if($caseID) $run->case = $this->loadModel('testcase')->getById($caseID, $version);
|
||||
|
||||
$this->view->run = $run;
|
||||
$nextCase = '';
|
||||
$caseID = $caseID ? $caseID : $run->case->id;
|
||||
$preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID);
|
||||
if($runID and $preAndNext->next) $preAndNext->next = $this->dao->select('*')->from(TABLE_TESTRUN)->where('`case`')->eq($preAndNext->next->id)->fetch();
|
||||
if($preAndNext->next)
|
||||
{
|
||||
$nextCase['runID'] = $runID ? $preAndNext->next->id : 0;
|
||||
$nextCase['caseID'] = $runID ? $preAndNext->next->case : $preAndNext->next->id;
|
||||
$nextCase['version'] = $preAndNext->next->version;
|
||||
}
|
||||
|
||||
$this->view->run = $run;
|
||||
$this->view->nextCase = $nextCase;
|
||||
|
||||
die($this->display());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ $lang->testtask->results = "Result";
|
||||
$lang->testtask->createBug = "Bug(+)";
|
||||
$lang->testtask->assign = 'Assign';
|
||||
$lang->testtask->cases = 'Cases';
|
||||
$lang->testtask->next = 'Next';
|
||||
|
||||
$lang->testtask->common = 'Test task';
|
||||
$lang->testtask->id = 'ID';
|
||||
|
||||
@@ -25,6 +25,7 @@ $lang->testtask->results = "结果";
|
||||
$lang->testtask->createBug = "提Bug";
|
||||
$lang->testtask->assign = '指派';
|
||||
$lang->testtask->cases = '用例';
|
||||
$lang->testtask->next = '下一个';
|
||||
|
||||
$lang->testtask->common = '测试任务';
|
||||
$lang->testtask->id = '任务编号';
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
echo html::hidden('case', $run->case->id);
|
||||
echo html::hidden('version', $run->case->version);
|
||||
if($run->case->steps) echo html::hidden('passall', 0);
|
||||
if($nextCase) echo html::linkButton($lang->testtask->next, inlink('runCase', "runID={$nextCase['runID']}&caseID={$nextCase['caseID']}&version={$nextCase['version']}"));
|
||||
if(!$run->case->steps) echo html::hidden('result', '');
|
||||
?>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user