diff --git a/module/action/model.php b/module/action/model.php
index acd67125b3..dba284409b 100755
--- a/module/action/model.php
+++ b/module/action/model.php
@@ -1751,6 +1751,12 @@ class actionModel extends model
{
$products = $this->product->getProducts($project->id, 'all', '', false);
if(!empty($products)) $this->loadModel('user')->updateUserView(array_keys($products), 'product');
+
+ if($action->objectType == 'execution')
+ {
+ $execution = $this->dao->select('id, project, grade, parent, status, deleted')->from(TABLE_EXECUTION)->where('id')->eq($action->objectID)->fetch();
+ $this->loadModel('common')->syncExecutionByChild($execution);
+ }
}
/* Revert doclib when undelete product or project. */
diff --git a/module/bug/control.php b/module/bug/control.php
index fff3fed27a..bb3f353043 100755
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -1133,6 +1133,8 @@ class bug extends control
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
if(!isset($moduleOptionMenu[$bug->module])) $moduleOptionMenu += $this->tree->getModulesName($bug->module);
+ $cases = $this->loadmodel('testcase')->getPairsByProduct($bug->product, array(0, $bug->branch));
+
/* Get assigned to member. */
if($bug->execution)
{
@@ -1166,6 +1168,7 @@ class bug extends control
$this->view->testtasks = $this->loadModel('testtask')->getPairs($bug->product, $bug->execution, $bug->testtask);
$this->view->users = $this->user->getPairs('', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy");
$this->view->assignedToList = $assignedToList;
+ $this->view->cases = array('' => '') + $cases;
$this->view->openedBuilds = $openedBuilds;
$this->view->resolvedBuilds = array('' => '') + $openedBuilds + $oldResolvedBuild;
$this->view->actions = $this->action->getList('bug', $bugID);
diff --git a/module/bug/js/browse.js b/module/bug/js/browse.js
index 6d469700d9..0cc3ce246d 100644
--- a/module/bug/js/browse.js
+++ b/module/bug/js/browse.js
@@ -8,4 +8,27 @@ $(function()
$("#sidebarHeader").toggle("fast");
});
if($("main").is(".hide-sidebar")) $("#sidebarHeader").hide();
+
+ $('#bugList').on('change', "[name='bugIDList[]']", checkClosed);
});
+
+/**
+ * Closed bugs are not assignable.
+ *
+ * @access public
+ * @return void
+ */
+function checkClosed()
+{
+ var disabledAssigned = $('#bugList tr.checked .c-assignedTo a').length > 0 ? true : false;
+ $('#bugList tr.checked .c-assignedTo a').each(function()
+ {
+ if(!$(this).hasClass('disabled'))
+ {
+ disabledAssigned = false;
+ return false;
+ }
+ });
+
+ $('#mulAssigned').prop('disabled', disabledAssigned);
+}
diff --git a/module/bug/model.php b/module/bug/model.php
index bbe186a8bb..803fba1cf8 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -721,6 +721,7 @@ class bugModel extends model
->setIF($this->post->resolution != '', 'confirmed', 1)
->setIF($this->post->story != false and $this->post->story != $oldBug->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->setIF(!$this->post->linkBug, 'linkBug', '')
+ ->setIF($this->post->case === '', 'case', 0)
->remove('comment,files,labels,uid,contactListMenu')
->get();
@@ -844,7 +845,7 @@ class bugModel extends model
$bug->plan = empty($data->plans[$bugID]) ? 0 : $data->plans[$bugID];
$bug->branch = empty($data->branches[$bugID]) ? 0 : $data->branches[$bugID];
$bug->module = $data->modules[$bugID];
- $bug->assignedTo = $data->assignedTos[$bugID];
+ $bug->assignedTo = $bug->status == 'closed' ? $oldBug->assignedTo : $data->assignedTos[$bugID];
$bug->deadline = $data->deadlines[$bugID];
$bug->resolvedBy = $data->resolvedBys[$bugID];
$bug->keywords = $data->keywords[$bugID];
@@ -1008,6 +1009,8 @@ class bugModel extends model
{
$now = helper::now();
$oldBug = $this->getById($bugID);
+ if($oldBug->status == 'closed') return false;
+
$bug = fixer::input('post')
->add('id', $bugID)
->setDefault('lastEditedBy', $this->app->user->account)
@@ -3556,7 +3559,7 @@ class bugModel extends model
$toStoryParams = "product=$bug->product&branch=$bug->branch&module=0&story=0&execution=0&bugID=$bug->id";
$menu .= $this->buildMenu('bug', 'confirmBug', $params, $bug, $type, 'ok', '', "iframe", true);
- if($type == 'view') $menu .= $this->buildMenu('bug', 'assignTo', $params, $bug, $type, '', '', "iframe", true);
+ if($type == 'view' and $bug->status != 'closed') $menu .= $this->buildMenu('bug', 'assignTo', $params, $bug, $type, '', '', "iframe", true);
$menu .= $this->buildMenu('bug', 'resolve', $params, $bug, $type, 'checked', '', "iframe showinonlybody", true);
$menu .= $this->buildMenu('bug', 'close', $params, $bug, $type, '', '', "text-danger iframe showinonlybody", true);
if($type == 'view') $menu .= $this->buildMenu('bug', 'activate', $params, $bug, $type, '', '', "text-success iframe showinonlybody", true);
diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php
index 3f8296b34a..20ecce70db 100644
--- a/module/bug/view/batchedit.html.php
+++ b/module/bug/view/batchedit.html.php
@@ -132,7 +132,7 @@
unset($assignedToList['closed']);
}
?>
-
-
+
6;?>
diff --git a/module/bug/view/linkbugs.html.php b/module/bug/view/linkbugs.html.php
index 6f883c20ae..ba9f34c460 100644
--- a/module/bug/view/linkbugs.html.php
+++ b/module/bug/view/linkbugs.html.php
@@ -90,7 +90,7 @@ $(function()
output += checkbox;
});
$.closeModal();
- parent.$('#linkBugsBox').html(output);
+ parent.$('#linkBugsBox').html(output).closest('tr').removeClass('hidden');
return false;
});
});
diff --git a/module/common/model.php b/module/common/model.php
index 98e5f4df58..24e444425c 100644
--- a/module/common/model.php
+++ b/module/common/model.php
@@ -66,7 +66,7 @@ class commonModel extends model
if($rawModule == 'execution')
{
$executionID = $objectID;
- $execution = $this->dao->select('id, project, grade, parent')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch();
+ $execution = $this->dao->select('id, project, grade, parent, status, deleted')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch();
$this->syncExecutionByChild($execution);
$project = $this->syncProjectStatus($execution);
$this->syncProgramStatus($project);
@@ -153,7 +153,7 @@ class commonModel extends model
$today = helper::today();
$parentExecution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($parentExecutionID)->fetch();
- if($parentExecution->status == 'wait')
+ if($execution->deleted == '0' and $execution->status == 'doing' and in_array($parentExecution->status, array('wait', 'closed')))
{
$this->dao->update(TABLE_EXECUTION)
->set('status')->eq('doing')
@@ -163,6 +163,32 @@ class commonModel extends model
$this->loadModel('action')->create('execution', $parentExecutionID, 'syncexecutionbychild');
}
+ if($parentExecution->type == 'stage')
+ {
+ $childExecutions = $this->dao->select('*')->from(TABLE_EXECUTION)->where('parent')->eq($parentExecutionID)->andWhere('deleted')->eq('0')->fetchAll('id');
+ if($execution->deleted == '1' and count($childExecutions) > 0)
+ {
+ $childWait = true;
+ $childClosed = true;
+ foreach($childExecutions as $childExecution)
+ {
+ if($childExecution->status != 'wait') $childWait = false;
+ if($childExecution->status != 'closed') $childClosed = false;
+ }
+
+ if($childWait and $parentExecution->status != 'wait')
+ {
+ $this->dao->update(TABLE_EXECUTION)->set('status')->eq('wait')->where('id')->eq($parentExecutionID)->exec();
+ $this->loadModel('action')->create('execution', $parentExecutionID, 'waitbychilddelete');
+ }
+ if($childClosed and $parentExecution->status != 'closed')
+ {
+ $this->dao->update(TABLE_EXECUTION)->set('status')->eq('closed')->where('id')->eq($parentExecutionID)->exec();
+ $this->loadModel('action')->create('execution', $parentExecutionID, 'closebychilddelete');
+ }
+ }
+ }
+
return $parentExecution;
}
@@ -185,6 +211,11 @@ class commonModel extends model
{
$this->dao->update(TABLE_EXECUTION)->set('status')->eq('doing')->set('realBegan')->eq($today)->where('id')->eq($execution->id)->exec();
$this->loadModel('action')->create('execution', $execution->id, 'syncexecution');
+ if($execution->parent)
+ {
+ $execution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($execution->id)->fetch(); // Get updated execution.
+ $this->syncExecutionByChild($execution);
+ }
}
return $execution;
}
diff --git a/module/execution/control.php b/module/execution/control.php
index 5cfefc4e8e..c8b7475689 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -469,10 +469,13 @@ class execution extends control
*
* @param int $executionID
* @param int $fromExecution
+ * @param int $recTotal
+ * @param int $recPerPage
+ * @param int $pageID
* @access public
* @return void
*/
- public function importTask($toExecution, $fromExecution = 0)
+ public function importTask($toExecution, $fromExecution = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
if(!empty($_POST))
{
@@ -509,13 +512,20 @@ class execution extends control
$tasks2Imported = zget($tasks, $fromExecution, array());
}
+ /* Pager. */
+ $this->app->loadClass('pager', $static = true);
+ $recTotal = count($tasks2Imported);
+ $pager = new pager($recTotal, $recPerPage, $pageID);
+ $tasks2ImportedList = array_chunk($tasks2Imported, $pager->recPerPage, true);
+
/* Save session. */
$this->app->session->set('taskList', $this->app->getURI(true), 'execution');
$this->view->title = $execution->name . $this->lang->colon . $this->lang->execution->importTask;
+ $this->view->pager = $pager;
$this->view->position[] = html::a(inlink('browse', "executionID=$toExecution"), $execution->name);
$this->view->position[] = $this->lang->execution->importTask;
- $this->view->tasks2Imported = $tasks2Imported;
+ $this->view->tasks2Imported = empty($tasks2ImportedList) ? $tasks2ImportedList : $tasks2ImportedList[$pageID - 1];
$this->view->executions = $executions;
$this->view->executionID = $execution->id;
$this->view->fromExecution = $fromExecution;
@@ -2179,15 +2189,9 @@ class execution extends control
if(!empty($_POST))
{
- $this->loadModel('action');
- $changes = $this->execution->activate($executionID);
+ $this->execution->activate($executionID);
if(dao::isError()) return print(js::error(dao::getError()));
- if($this->post->comment != '' or !empty($changes))
- {
- $actionID = $this->action->create($this->objectType, $executionID, 'Activated', $this->post->comment);
- $this->action->logHistory($actionID, $changes);
- }
$this->executeHooks($executionID);
if(isonlybody() and $from == 'kanban')
{
@@ -2230,16 +2234,10 @@ class execution extends control
if(!empty($_POST))
{
- $this->loadModel('action');
$this->execution->computeBurn($executionID);
- $changes = $this->execution->close($executionID);
+ $this->execution->close($executionID);
if(dao::isError()) return print(js::error(dao::getError()));
- if($this->post->comment != '' or !empty($changes))
- {
- $actionID = $this->action->create($this->objectType, $executionID, 'Closed', $this->post->comment);
- $this->action->logHistory($actionID, $changes);
- }
$this->executeHooks($executionID);
if(isonlybody() and $from == 'kanban')
{
@@ -2890,6 +2888,7 @@ class execution extends control
$this->dao->update(TABLE_EXECUTION)->set('deleted')->eq(1)->where('id')->eq($executionID)->exec();
$this->loadModel('action')->create('execution', $executionID, 'deleted', '', ACTIONMODEL::CAN_UNDELETED);
$this->execution->updateUserView($executionID);
+ $this->loadModel('common')->syncPPEStatus($executionID);
$this->session->set('execution', '');
$message = $this->executeHooks($executionID);
diff --git a/module/execution/js/bug.js b/module/execution/js/bug.js
index ce07804c40..7a73ac2808 100644
--- a/module/execution/js/bug.js
+++ b/module/execution/js/bug.js
@@ -2,4 +2,27 @@ $(function()
{
if(browseType != 'bysearch') $('#module' + param).closest('li').addClass('active');
if($('#bugList thead th.c-title').width() < 150) $('#bugList thead th.c-title').width(150);
+
+ $('#bugList').on('change', "[name='bugIDList[]']", checkClosed);
});
+
+/**
+ * Closed bugs are not assignable.
+ *
+ * @access public
+ * @return void
+ */
+function checkClosed()
+{
+ var disabledAssigned = $('#bugList tr.checked .c-assignedTo a').length > 0 ? true : false;
+ $('#bugList tr.checked .c-assignedTo a').each(function()
+ {
+ if(!$(this).hasClass('disabled'))
+ {
+ disabledAssigned = false;
+ return false;
+ }
+ });
+
+ $('#mulAssigned').prop('disabled', disabledAssigned);
+}
diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php
index 7ab7927d18..1cc9cb51bd 100644
--- a/module/execution/lang/de.php
+++ b/module/execution/lang/de.php
@@ -536,10 +536,19 @@ $lang->execution->treeLevel['task'] = 'Aufgabe anzeigen';
$lang->execution->treeLevel['story'] = 'Story anzeigen';
$lang->execution->action = new stdclass();
-$lang->execution->action->opened = '$date, created by
$actor. $extra' . "\n";
-$lang->execution->action->managed = '$date, managed by
$actor. $extra' . "\n";
-$lang->execution->action->edited = '$date, edited by
$actor. $extra' . "\n";
-$lang->execution->action->extra = 'Linked products is %s.';
+$lang->execution->action->opened = '$date, created by
$actor. $extra' . "\n";
+$lang->execution->action->managed = '$date, managed by
$actor. $extra' . "\n";
+$lang->execution->action->edited = '$date, edited by
$actor. $extra' . "\n";
+$lang->execution->action->extra = 'Linked products is %s.';
+$lang->execution->action->startbychildactivate = '$date, activating the sub stage sets the execution status as Ongoing.' . "\n";
+$lang->execution->action->waitbychilddelete = '$date, deleting the sub stage sets the execution status as waitting.' . "\n";
+$lang->execution->action->closebychilddelete = '$date, deleting the sub stage sets the execution status as closing.' . "\n";
+$lang->execution->action->closebychildclose = '$date, closing the sub stage sets the execution status as closing.' . "\n";
+
+$lang->execution->startbychildactivate = 'activated';
+$lang->execution->waitbychilddelete = 'stop';
+$lang->execution->closebychilddelete = 'closed';
+$lang->execution->closebychildclose = 'closed';
$lang->execution->statusColorList = array();
$lang->execution->statusColorList['wait'] = '#0991FF';
diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php
index cf11af6af7..4c34595681 100644
--- a/module/execution/lang/en.php
+++ b/module/execution/lang/en.php
@@ -536,10 +536,19 @@ $lang->execution->treeLevel['task'] = 'Stories&Tasks';
$lang->execution->treeLevel['story'] = 'Only Stories';
$lang->execution->action = new stdclass();
-$lang->execution->action->opened = '$date, created by
$actor. $extra' . "\n";
-$lang->execution->action->managed = '$date, managed by
$actor. $extra' . "\n";
-$lang->execution->action->edited = '$date, edited by
$actor. $extra' . "\n";
-$lang->execution->action->extra = 'Linked products is %s.';
+$lang->execution->action->opened = '$date, created by
$actor. $extra' . "\n";
+$lang->execution->action->managed = '$date, managed by
$actor. $extra' . "\n";
+$lang->execution->action->edited = '$date, edited by
$actor. $extra' . "\n";
+$lang->execution->action->extra = 'Linked products is %s.';
+$lang->execution->action->startbychildactivate = '$date, activating the sub stage sets the execution status as Ongoing.' . "\n";
+$lang->execution->action->waitbychilddelete = '$date, deleting the sub stage sets the execution status as waitting.' . "\n";
+$lang->execution->action->closebychilddelete = '$date, deleting the sub stage sets the execution status as closing.' . "\n";
+$lang->execution->action->closebychildclose = '$date, closing the sub stage sets the execution status as closing.' . "\n";
+
+$lang->execution->startbychildactivate = 'activated';
+$lang->execution->waitbychilddelete = 'stop';
+$lang->execution->closebychilddelete = 'closed';
+$lang->execution->closebychildclose = 'closed';
$lang->execution->statusColorList = array();
$lang->execution->statusColorList['wait'] = '#0991FF';
diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php
index 6dea9a32aa..3e71a37d6b 100644
--- a/module/execution/lang/fr.php
+++ b/module/execution/lang/fr.php
@@ -536,10 +536,19 @@ $lang->execution->treeLevel['task'] = 'Stories&Tâches';
$lang->execution->treeLevel['story'] = 'Seulement Stories';
$lang->execution->action = new stdclass();
-$lang->execution->action->opened = '$date, created by
$actor. $extra' . "\n";
-$lang->execution->action->managed = '$date, managed by
$actor. $extra' . "\n";
-$lang->execution->action->edited = '$date, edited by
$actor. $extra' . "\n";
-$lang->execution->action->extra = 'Linked products is %s.';
+$lang->execution->action->opened = '$date, created by
$actor. $extra' . "\n";
+$lang->execution->action->managed = '$date, managed by
$actor. $extra' . "\n";
+$lang->execution->action->edited = '$date, edited by
$actor. $extra' . "\n";
+$lang->execution->action->extra = 'Linked products is %s.';
+$lang->execution->action->startbychildactivate = '$date, activating the sub stage sets the execution status as Ongoing.' . "\n";
+$lang->execution->action->waitbychilddelete = '$date, deleting the sub stage sets the execution status as waitting.' . "\n";
+$lang->execution->action->closebychilddelete = '$date, deleting the sub stage sets the execution status as closing.' . "\n";
+$lang->execution->action->closebychildclose = '$date, closing the sub stage sets the execution status as closing.' . "\n";
+
+$lang->execution->startbychildactivate = 'activated';
+$lang->execution->waitbychilddelete = 'stop';
+$lang->execution->closebychilddelete = 'closed';
+$lang->execution->closebychildclose = 'closed';
$lang->execution->statusColorList = array();
$lang->execution->statusColorList['wait'] = '#0991FF';
diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php
index a064ccd15c..046e868a9d 100644
--- a/module/execution/lang/zh-cn.php
+++ b/module/execution/lang/zh-cn.php
@@ -536,10 +536,19 @@ $lang->execution->treeLevel['task'] = '全部显示';
$lang->execution->treeLevel['story'] = "只看{$lang->SRCommon}";
$lang->execution->action = new stdclass();
-$lang->execution->action->opened = '$date, 由
$actor 创建。$extra' . "\n";
-$lang->execution->action->managed = '$date, 由
$actor 维护。$extra' . "\n";
-$lang->execution->action->edited = '$date, 由
$actor 编辑。$extra' . "\n";
-$lang->execution->action->extra = '相关产品为 %s。';
+$lang->execution->action->opened = '$date, 由
$actor 创建。$extra' . "\n";
+$lang->execution->action->managed = '$date, 由
$actor 维护。$extra' . "\n";
+$lang->execution->action->edited = '$date, 由
$actor 编辑。$extra' . "\n";
+$lang->execution->action->extra = '相关产品为 %s。';
+$lang->execution->action->startbychildactivate = '$date, 系统判断由于子阶段激活,将' . $lang->executionCommon . '状态置为进行中。' . "\n";
+$lang->execution->action->waitbychilddelete = '$date, 系统判断由于子阶段删除,将' . $lang->executionCommon . '状态置为未开始。' . "\n";
+$lang->execution->action->closebychilddelete = '$date, 系统判断由于子阶段删除,将' . $lang->executionCommon . '状态置为已关闭。' . "\n";
+$lang->execution->action->closebychildclose = '$date, 系统判断由于子阶段关闭,将' . $lang->executionCommon . '状态置为已关闭。' . "\n";
+
+$lang->execution->startbychildactivate = '激活了';
+$lang->execution->waitbychilddelete = '停止了';
+$lang->execution->closebychilddelete = '关闭了';
+$lang->execution->closebychildclose = '关闭了';
$lang->execution->statusColorList = array();
$lang->execution->statusColorList['wait'] = '#0991FF';
diff --git a/module/execution/model.php b/module/execution/model.php
index 98153d49c7..4a164bbe74 100644
--- a/module/execution/model.php
+++ b/module/execution/model.php
@@ -1005,17 +1005,24 @@ class executionModel extends model
}
}
+ $changes = common::createChanges($oldExecution, $execution);
+ if($this->post->comment != '' or !empty($changes))
+ {
+ $this->loadModel('action');
+ $actionID = $this->action->create('execution', $executionID, 'Activated', $this->post->comment);
+ $this->action->logHistory($actionID, $changes);
+ }
+
/* Update the status of the parent stage. */
if($oldExecution->type == 'stage')
{
$parent = $this->getByID($oldExecution->parent);
- if($parent->type == 'stage' and $parent->status == 'closed')
+ if($parent->type == 'stage' and in_array($parent->status, array('closed', 'wait')))
{
$this->dao->update(TABLE_EXECUTION)->set('status')->eq('doing')->where('id')->eq($parent->id)->exec();
+ $this->loadModel('action')->create('execution', $parent->id, 'startbychildactivate');
}
}
-
- if(!dao::isError()) return common::createChanges($oldExecution, $execution);
}
/**
@@ -1058,6 +1065,15 @@ class executionModel extends model
if(!dao::isError())
{
+
+ $changes = common::createChanges($oldExecution, $execution);
+ if($this->post->comment != '' or !empty($changes))
+ {
+ $this->loadModel('action');
+ $actionID = $this->action->create('execution', $executionID, 'Closed', $this->post->comment);
+ $this->action->logHistory($actionID, $changes);
+ }
+
/* Update the status of the parent stage. */
if($oldExecution->type == 'stage')
{
@@ -1071,12 +1087,15 @@ class executionModel extends model
if($childExecution->status != 'closed') $isClosed = false;
}
- if($isClosed) $this->dao->update(TABLE_EXECUTION)->set('status')->eq('closed')->where('id')->eq($parent->id)->exec();
+ if($isClosed)
+ {
+ $this->dao->update(TABLE_EXECUTION)->set('status')->eq('closed')->where('id')->eq($parent->id)->exec();
+ $this->loadModel('action')->create('execution', $parent->id, 'closebychildclose');
+ }
}
}
$this->loadModel('score')->create('execution', 'close', $oldExecution);
- return common::createChanges($oldExecution, $execution);
}
}
@@ -1411,7 +1430,7 @@ class executionModel extends model
/**
* Get execution stat data.
-
+
* @param int $projectID
* @param string $browseType all|undone|wait|doing|suspended|closed|involved|bySearch|review
* @param int $productID
diff --git a/module/execution/view/bug.html.php b/module/execution/view/bug.html.php
index 0dcf920a7a..606c7aee68 100644
--- a/module/execution/view/bug.html.php
+++ b/module/execution/view/bug.html.php
@@ -162,7 +162,7 @@
diff --git a/module/search/model.php b/module/search/model.php
index 0c17675817..742cf697ea 100644
--- a/module/search/model.php
+++ b/module/search/model.php
@@ -215,10 +215,19 @@ class searchModel extends model
$condition = '`' . $this->post->$fieldName . "` >= '$value' AND `" . $this->post->$fieldName . "` <= '$value 23:59:59'";
$where .= " $andOr ($condition)";
}
+ elseif($operator == '!=' and preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/', $value))
+ {
+ $condition = '`' . $this->post->$fieldName . "` < '$value' OR `" . $this->post->$fieldName . "` > '$value 23:59:59'";
+ $where .= " $andOr ($condition)";
+ }
elseif($operator == '<=' and preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/', $value))
{
$where .= " $andOr " . '`' . $this->post->$fieldName . "` <= '$value 23:59:59'";
}
+ elseif($operator == '>' and preg_match('/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/', $value))
+ {
+ $where .= " $andOr " . '`' . $this->post->$fieldName . "` > '$value 23:59:59'";
+ }
elseif($condition)
{
$where .= " $andOr " . '`' . $this->post->$fieldName . '` ' . $condition;
diff --git a/module/testcase/model.php b/module/testcase/model.php
index fd02631f3b..b626241bc0 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -702,6 +702,24 @@ class testcaseModel extends model
->fetchAll('id');
}
+ /**
+ * Get case pairs by product id and branch.
+ *
+ * @param int $productID
+ * @param int|string $branch
+ * @access public
+ * @return void
+ */
+ public function getPairsByProduct($productID, $branch = 0)
+ {
+ return $this->dao->select('id, concat_ws(":", id, title) as title')->from(TABLE_CASE)
+ ->where('deleted')->eq(0)
+ ->andWhere('product')->eq($productID)
+ ->beginIF($branch)->andWhere('branch')->in($branch)->fi()
+ ->orderBy('id_desc')
+ ->fetchPairs();
+ }
+
/**
* Get cases of a story.
*
diff --git a/test/class/execution.class.php b/test/class/execution.class.php
index 12e317336a..9600ac750a 100644
--- a/test/class/execution.class.php
+++ b/test/class/execution.class.php
@@ -166,10 +166,11 @@ class executionTest
*
* @param string $executionID
* @param array $param
+ * @param bool $testParent
* @access public
* @return array
*/
- public function startTest($executionID,$param = array())
+ public function startTest($executionID,$param = array(), $testParent = false)
{
$data = date('Y-m-d');
@@ -196,6 +197,12 @@ class executionTest
}
else
{
+ if($testParent)
+ {
+ $execution = $this->objectModel->getByID($executionID);
+ $executionParent = $this->objectModel->getByID($execution->parent);
+ return $executionParent;
+ }
return $obj;
}
}
@@ -268,10 +275,11 @@ class executionTest
*
* @param string $executionID
* @param array $param
+ * @param bool $testParent
* @access public
* @return array
*/
- public function activateTest($executionID, $param = array())
+ public function activateTest($executionID, $param = array(), $testParent = false)
{
self::suspendTest($executionID);
@@ -294,6 +302,12 @@ class executionTest
}
else
{
+ if($testParent)
+ {
+ $execution = $this->objectModel->getByID($executionID);
+ $executionParent = $this->objectModel->getByID($execution->parent);
+ return $executionParent;
+ }
return $obj;
}
}
@@ -303,10 +317,11 @@ class executionTest
*
* @param string $executionID
* @param array $param
+ * @param bool $testParent
* @access public
* @return array
*/
- public function closeTest($executionID, $param = array())
+ public function closeTest($executionID, $param = array(), $testParent = false)
{
$todate = date('Y-m-d');
@@ -326,6 +341,12 @@ class executionTest
}
else
{
+ if($testParent)
+ {
+ $execution = $this->objectModel->getByID($executionID);
+ $executionParent = $this->objectModel->getByID($execution->parent);
+ return $executionParent;
+ }
return $obj;
}
}
diff --git a/test/class/testcase.class.php b/test/class/testcase.class.php
index 5642b59f97..077080ef01 100644
--- a/test/class/testcase.class.php
+++ b/test/class/testcase.class.php
@@ -306,6 +306,24 @@ class testcaseTest
return $objects;
}
+ /**
+ * Test get case pairs by product id and branch.
+ *
+ * @param int $productID
+ * @param int $branch
+ * @access public
+ * @return array
+ */
+ public function getPairsByProductTest($productID = 0, $branch = 0)
+ {
+ $objects = $this->objectModel->getPairsByProduct($productID, $branch);
+
+ if(dao::isError()) return dao::getError();
+
+ if(empty($objects)) return 'empty';
+ return $objects;
+ }
+
/**
* Test get counts of some stories' cases.
*
diff --git a/test/model/execution/activate.php b/test/model/execution/activate.php
index c026149452..8730b9d6c5 100755
--- a/test/model/execution/activate.php
+++ b/test/model/execution/activate.php
@@ -16,18 +16,19 @@ pid=1
看板执行激活 >> status,suspended,doing
修改激活时间 >> begin
修改顺延 >> begin
+子瀑布激活获取父瀑布状态 >> doing
*/
-$executionIDList = array('105', '136', '165', '106', '107');
+$executionIDList = array('105', '136', '165', '106', '107', '708');
$readjustTask = array('readjustTime' => '1', 'readjustTask' => '1');
$readjustTime = array('readjustTime' => '1');
$execution = new executionTest();
-//var_dump($execution->activateTest($executionIDList[4],$readjustTask ));die;
-r($execution->activateTest($executionIDList[0])) && p('0:field,old,new') && e('status,suspended,doing'); // 敏捷执行激活
-r($execution->activateTest($executionIDList[1])) && p('0:field,old,new') && e('status,suspended,doing'); // 瀑布执行激活
-r($execution->activateTest($executionIDList[2])) && p('0:field,old,new') && e('status,suspended,doing'); // 看板执行激活
-r($execution->activateTest($executionIDList[3],$readjustTime)) && p('1:field') && e('begin'); // 修改激活时间
-r($execution->activateTest($executionIDList[4],$readjustTask)) && p('1:field') && e('begin'); // 修改顺延
-$db->restoreDB();
\ No newline at end of file
+r($execution->activateTest($executionIDList[0])) && p('0:field,old,new') && e('status,suspended,doing'); // 敏捷执行激活
+r($execution->activateTest($executionIDList[1])) && p('0:field,old,new') && e('status,suspended,doing'); // 瀑布执行激活
+r($execution->activateTest($executionIDList[2])) && p('0:field,old,new') && e('status,suspended,doing'); // 看板执行激活
+r($execution->activateTest($executionIDList[3],$readjustTime)) && p('1:field') && e('begin'); // 修改激活时间
+r($execution->activateTest($executionIDList[4],$readjustTask)) && p('1:field') && e('begin'); // 修改顺延
+r($execution->activateTest($executionIDList[5], array(), true)) && p('status') && e('doing'); // 子瀑布激活获取父瀑布状态
+$db->restoreDB();
diff --git a/test/model/execution/close.php b/test/model/execution/close.php
index cd43bbabf6..6f0752d869 100755
--- a/test/model/execution/close.php
+++ b/test/model/execution/close.php
@@ -15,15 +15,17 @@ pid=1
瀑布执行关闭 >> status,doing,closed
看板执行关闭 >> status,doing,closed
不输入实际完成时间校验 >> 『realEnd』不能为空。
+子瀑布关闭获取父瀑布状态 >> closed
*/
-$executionIDList = array('109', '138', '168');
+$executionIDList = array('109', '138', '168', '708');
$noRealEnd = array('realEnd' => '');
$execution = new executionTest();
-r($execution->closeTest($executionIDList[0])) && p('0:field,old,new') && e('status,wait,closed'); // 敏捷执行关闭
-r($execution->closeTest($executionIDList[1])) && p('0:field,old,new') && e('status,doing,closed'); // 瀑布执行关闭
-r($execution->closeTest($executionIDList[2])) && p('0:field,old,new') && e('status,doing,closed'); // 看板执行关闭
-r($execution->closeTest($executionIDList[1],$noRealEnd)) && p('realEnd:0') && e('『realEnd』不能为空。'); // 不输入实际完成时间校验
-$db->restoreDB();
\ No newline at end of file
+r($execution->closeTest($executionIDList[0])) && p('0:field,old,new') && e('status,wait,closed'); // 敏捷执行关闭
+r($execution->closeTest($executionIDList[1])) && p('0:field,old,new') && e('status,doing,closed'); // 瀑布执行关闭
+r($execution->closeTest($executionIDList[2])) && p('0:field,old,new') && e('status,doing,closed'); // 看板执行关闭
+r($execution->closeTest($executionIDList[1],$noRealEnd)) && p('realEnd:0') && e('『realEnd』不能为空。'); // 不输入实际完成时间校验
+r($execution->closeTest($executionIDList[3], array(), true)) && p('status') && e('closed'); // 子瀑布关闭获取父瀑布状态
+$db->restoreDB();
diff --git a/test/model/execution/start.php b/test/model/execution/start.php
index 22f92a08d1..1f52ea7577 100755
--- a/test/model/execution/start.php
+++ b/test/model/execution/start.php
@@ -15,16 +15,18 @@ pid=1
瀑布阶段开始 >> status,wait,doing
看板执行开始 >> status,wait,doing
重复执行开始 >> 此任务已被启动,不能重复启动!
+子瀑布开启获取父瀑布状态 >> doing
*/
-$executionIDList = array('101', '131', '161', '103');
+$executionIDList = array('101', '131', '161', '103', '701');
$noRealBegan = array('realBegan' => '');
$execution = new executionTest();
-r($execution->startTest($executionIDList[0])) && p('1:field,old,new') && e('status,wait,doing'); // 敏捷执行开始
-r($execution->startTest($executionIDList[1])) && p('1:field,old,new') && e('status,wait,doing'); // 瀑布阶段开始
-r($execution->startTest($executionIDList[2])) && p('1:field,old,new') && e('status,wait,doing'); // 看板执行开始
-r($execution->startTest($executionIDList[0],$noRealBegan)) && p() && e('此任务已被启动,不能重复启动!'); // 重复执行开始
-$db->restoreDB();
\ No newline at end of file
+r($execution->startTest($executionIDList[0])) && p('1:field,old,new') && e('status,wait,doing'); // 敏捷执行开始
+r($execution->startTest($executionIDList[1])) && p('1:field,old,new') && e('status,wait,doing'); // 瀑布阶段开始
+r($execution->startTest($executionIDList[2])) && p('1:field,old,new') && e('status,wait,doing'); // 看板执行开始
+r($execution->startTest($executionIDList[0],$noRealBegan)) && p() && e('此任务已被启动,不能重复启动!'); // 重复执行开始
+r($execution->startTest($executionIDList[3], array(), true)) && p('status') && e('doing'); // 子瀑布开启获取父瀑布状态
+$db->restoreDB();
diff --git a/test/model/testcase/getpairsbyproduct.php b/test/model/testcase/getpairsbyproduct.php
new file mode 100644
index 0000000000..1eda797975
--- /dev/null
+++ b/test/model/testcase/getpairsbyproduct.php
@@ -0,0 +1,22 @@
+#!/usr/bin/env php
+getPairsByProduct();
+cid=1
+pid=1
+
+获取产品1的case >> 1:这个是测试用例1
+获取产品41分支1的case >> empty
+
+*/
+$productIDList = array(1, 41);
+$branch = 1;
+
+$testcase = new testcaseTest();
+r($testcase->getPairsByProductTest($productIDList[0])) && p('1') && e('1:这个是测试用例1'); // 获取产品1的case
+r($testcase->getPairsByProductTest($productIDList[1], $branch)) && p() && e('empty'); // 获取产品41分支1的case
diff --git a/test/ztest b/test/ztest
index 6fc88a6b7c..8454508f16 100755
--- a/test/ztest
+++ b/test/ztest
@@ -58,6 +58,9 @@ switch($argv[1])
case 'cron':
ztfRun('model/cron');
break;
+ case 'custom':
+ ztfRun('model/custom');
+ break;
case 'datatable':
ztfRun('model/datatable');
break;