Sprint/228 zg tasks and units

This commit is contained in:
曾刚
2022-08-18 07:15:14 +00:00
committed by 王怡栋
parent c586a24d50
commit 3172961404
27 changed files with 315 additions and 73 deletions
+6
View File
@@ -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. */
+3
View File
@@ -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);
+23
View File
@@ -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);
}
+5 -2
View File
@@ -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);
+1 -1
View File
@@ -132,7 +132,7 @@
unset($assignedToList['closed']);
}
?>
<td class='<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo html::select("assignedTos[$bugID]", $assignedToList, $bug->assignedTo, "class='form-control picker-select' data-drop-width='135px'");?></td>
<td class='<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo $bug->status == 'closed' ? ucfirst($bug->assignedTo) : html::select("assignedTos[$bugID]", $assignedToList, $bug->assignedTo, "class='form-control picker-select' data-drop-width='135px'");?></td>
<td class='<?php echo zget($visibleFields, 'deadline', ' hidden')?>' style='overflow:visible'><?php echo html::input("deadlines[$bugID]", helper::isZeroDate($bug->deadline) ? '' : $bug->deadline, "class='form-control form-date'");?></td>
<td <?php echo zget($visibleFields, 'os', "class='hidden'")?>><?php echo html::select("os[$bugID][]", $lang->bug->osList, $bug->os, 'class="form-control chosen" multiple');?></td>
<td <?php echo zget($visibleFields, 'browser', "class='hidden'")?>><?php echo html::select("browsers[$bugID][]", $lang->bug->browserList, $bug->browser, 'class="form-control chosen" multiple');?></td>
+1 -1
View File
@@ -403,7 +403,7 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
<?php endif;?>
<?php if($canBatchAssignTo):?>
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->bug->assignedTo;?> <span class="caret"></span></button>
<button data-toggle="dropdown" type="button" class="btn" id="mulAssigned"><?php echo $lang->bug->assignedTo;?> <span class="caret"></span></button>
<?php $withSearch = count($memberPairs) > 6;?>
<?php if($withSearch):?>
<div class="dropdown-menu search-list search-box-sink" data-ride="searchList">
+6 -4
View File
@@ -153,10 +153,14 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
<tr>
<th><?php echo $lang->bug->assignedTo;?></th>
<td>
<?php if($bug->status == 'closed'):?>
<?php echo ucfirst($bug->assignedTo);?>
<?php else:?>
<div class='input-group'>
<?php echo html::select('assignedTo', $assignedToList, $bug->assignedTo, "class='form-control chosen'");?>
<span class='input-group-btn'><?php echo html::commonButton($lang->bug->allUsers, "class='btn btn-default' onclick='loadAllUsers()' data-toggle='tooltip'");?></span>
</div>
<?php endif;?>
</td>
</tr>
<tr>
@@ -282,7 +286,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
<th class='thWidth'><?php echo $lang->bug->linkBug;?></th>
<td><?php if(common::hasPriv('bug', 'linkBugs')) echo html::a($this->createLink('bug', 'linkBugs', "bugID=$bug->id", '', true), $lang->bug->linkBugs, '', "class='text-primary' data-toggle='modal' data-type='iframe' data-width='95%'");?></td>
</tr>
<tr>
<tr <?php if(!isset($bug->linkBugTitles)) echo 'class="hidden"';?>>
<th></th>
<td>
<ul class='list-unstyled'>
@@ -306,12 +310,10 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
<th><?php echo $lang->bug->testtask;?></th>
<td id='testtaskBox'><?php echo html::select('testtask', $testtasks, $bug->testtask, 'class="form-control chosen"');?></td>
</tr>
<?php if($bug->case):?>
<tr>
<th><?php echo $lang->bug->fromCase;?></th>
<td><?php echo html::input('case', $bug->case, 'class="form-control"');?></td>
<td><?php echo html::select('case', $cases, $bug->case, 'class="form-control picker-select"');?></td>
</tr>
<?php endif;?>
</tbody>
</table>
</div>
+1 -1
View File
@@ -90,7 +90,7 @@ $(function()
output += checkbox;
});
$.closeModal();
parent.$('#linkBugsBox').html(output);
parent.$('#linkBugsBox').html(output).closest('tr').removeClass('hidden');
return false;
});
});
+33 -2
View File
@@ -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;
}
+15 -16
View File
@@ -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);
+23
View File
@@ -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);
}
+13 -4
View File
@@ -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 <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->extra = 'Linked products is %s.';
$lang->execution->action->opened = '$date, created by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong>. $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';
+13 -4
View File
@@ -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 <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->extra = 'Linked products is %s.';
$lang->execution->action->opened = '$date, created by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong>. $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';
+13 -4
View File
@@ -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 <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->extra = 'Linked products is %s.';
$lang->execution->action->opened = '$date, created by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong>. $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong>. $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';
+13 -4
View File
@@ -536,10 +536,19 @@ $lang->execution->treeLevel['task'] = '全部显示';
$lang->execution->treeLevel['story'] = "只看{$lang->SRCommon}";
$lang->execution->action = new stdclass();
$lang->execution->action->opened = '$date, 由 <strong>$actor</strong> 创建。$extra' . "\n";
$lang->execution->action->managed = '$date, 由 <strong>$actor</strong> 维护。$extra' . "\n";
$lang->execution->action->edited = '$date, 由 <strong>$actor</strong> 编辑。$extra' . "\n";
$lang->execution->action->extra = '相关产品为 %s。';
$lang->execution->action->opened = '$date, 由 <strong>$actor</strong> 创建。$extra' . "\n";
$lang->execution->action->managed = '$date, 由 <strong>$actor</strong> 维护。$extra' . "\n";
$lang->execution->action->edited = '$date, 由 <strong>$actor</strong> 编辑。$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';
+25 -6
View File
@@ -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
+1 -1
View File
@@ -162,7 +162,7 @@
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->bug->assignedTo?> <span class="caret"></span></button>
<button data-toggle="dropdown" type="button" class="btn" id="mulAssigned"><?php echo $lang->bug->assignedTo?> <span class="caret"></span></button>
<?php
$withSearch = count($memberPairs) > 10;
$actionLink = $this->createLink('bug', 'batchAssignTo', "executionID={$execution->id}&type=execution");
@@ -95,6 +95,7 @@
<?php echo html::backButton('','','btn');?>
<?php endif;?>
</div>
<?php $pager->show('right', 'pagerjs');?>
</div>
<?php endif;?>
</form>
+9
View File
@@ -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;
+18
View File
@@ -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.
*
+24 -3
View File
@@ -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;
}
}
+18
View File
@@ -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.
*
+9 -8
View File
@@ -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();
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();
+8 -6
View File
@@ -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();
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();
+8 -6
View File
@@ -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();
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();
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/testcase.class.php';
su('admin');
/**
title=测试 testcaseModel->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
+3
View File
@@ -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;