Merge branch 'sprint/170' into 'sprint/170_zhengrunyu_44498'
# Conflicts: # module/project/model.php
This commit is contained in:
@@ -43,6 +43,7 @@ class branch extends control
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->product = $this->product->getById($productID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -65,6 +66,7 @@ class branch extends control
|
||||
die(js::reload('parent.parent'));
|
||||
}
|
||||
|
||||
$this->view->product = $this->loadModel('product')->getById($productID);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ class branch extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function edit($branchID)
|
||||
public function edit($branchID, $productID)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
@@ -86,7 +88,8 @@ class branch extends control
|
||||
die(js::reload('parent.parent'));
|
||||
}
|
||||
|
||||
$this->view->branch = $this->branch->getById($branchID, 0, '');
|
||||
$this->view->product = $this->loadModel('product')->getById($productID);
|
||||
$this->view->branch = $this->branch->getById($branchID, 0, '');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -123,6 +126,7 @@ class branch extends control
|
||||
if(!in_array($branch->id, $branchIDList)) unset($branchList[$branch->id]);
|
||||
}
|
||||
|
||||
$this->view->product = $this->product->getById($productID);
|
||||
$this->view->branchList = $branchList;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ $lang->branch->all = 'All ';
|
||||
$lang->branch->main = 'Main';
|
||||
|
||||
$lang->branch->edit = 'Edit';
|
||||
$lang->branch->editAction = 'Edit Branch';
|
||||
$lang->branch->editAction = 'Edit %s';
|
||||
$lang->branch->activate = 'Activate';
|
||||
$lang->branch->activateAction = 'Activate Branch';
|
||||
$lang->branch->close = 'Close';
|
||||
$lang->branch->closeAction = 'Close Branch';
|
||||
$lang->branch->create = 'Create Branch';
|
||||
$lang->branch->create = 'Create %s';
|
||||
$lang->branch->merge = 'Merge';
|
||||
$lang->branch->batchEdit = 'Batch Edit';
|
||||
$lang->branch->defaultBranch = 'Default Branch';
|
||||
@@ -43,7 +43,7 @@ $lang->branch->confirmActivate = 'Do you want to activate this @branch@?';
|
||||
$lang->branch->existName = '@branch@ name already exists.';
|
||||
|
||||
$lang->branch->noData = 'No branches.';
|
||||
$lang->branch->mainBranch = 'The default main branch of the product.';
|
||||
$lang->branch->mainBranch = 'The default main %s of the product.';
|
||||
|
||||
$lang->branch->statusList = array();
|
||||
$lang->branch->statusList['active'] = 'Active';
|
||||
|
||||
@@ -10,12 +10,12 @@ $lang->branch->all = '所有';
|
||||
$lang->branch->main = '主干';
|
||||
|
||||
$lang->branch->edit = '编辑';
|
||||
$lang->branch->editAction = '编辑分支';
|
||||
$lang->branch->editAction = '编辑%s';
|
||||
$lang->branch->activate = '激活';
|
||||
$lang->branch->activateAction = '激活分支';
|
||||
$lang->branch->close = '关闭';
|
||||
$lang->branch->closeAction = '关闭分支';
|
||||
$lang->branch->create = '新增分支';
|
||||
$lang->branch->create = '新增%s';
|
||||
$lang->branch->merge = '合并';
|
||||
$lang->branch->batchEdit = '批量编辑';
|
||||
$lang->branch->defaultBranch = '默认分支';
|
||||
@@ -24,11 +24,11 @@ $lang->branch->setDefaultAction = '设置默认分支';
|
||||
|
||||
$lang->branch->id = 'ID';
|
||||
$lang->branch->product = '所属产品';
|
||||
$lang->branch->name = '分支名称';
|
||||
$lang->branch->name = '%s名称';
|
||||
$lang->branch->status = '状态';
|
||||
$lang->branch->createdDate = '创建时间';
|
||||
$lang->branch->closedDate = '关闭时间';
|
||||
$lang->branch->desc = '分支描述';
|
||||
$lang->branch->desc = '%s描述';
|
||||
$lang->branch->order = '排序';
|
||||
$lang->branch->deleted = '已删除';
|
||||
$lang->branch->closed = '已关闭';
|
||||
@@ -43,7 +43,7 @@ $lang->branch->confirmActivate = '是否激活该@branch@?';
|
||||
$lang->branch->existName = '@branch@名称已存在';
|
||||
|
||||
$lang->branch->noData = '暂时没有分支。';
|
||||
$lang->branch->mainBranch = '产品默认主干分支。';
|
||||
$lang->branch->mainBranch = '产品默认主干%s。';
|
||||
|
||||
$lang->branch->statusList = array();
|
||||
$lang->branch->statusList['active'] = '激活';
|
||||
|
||||
@@ -57,6 +57,7 @@ class branchModel extends model
|
||||
|
||||
if($browseType == 'closed') return $branchList;
|
||||
|
||||
$product = $this->loadModel('product')->getById($productID);
|
||||
$defaultBranch = BRANCH_MAIN;
|
||||
foreach($branchList as $branch) $defaultBranch = $branch->default ? $branch->id : $defaultBranch;
|
||||
|
||||
@@ -69,7 +70,7 @@ class branchModel extends model
|
||||
$mainBranch->status = 'active';
|
||||
$mainBranch->createdDate = '';
|
||||
$mainBranch->closedDate = '';
|
||||
$mainBranch->desc = $this->lang->branch->mainBranch;
|
||||
$mainBranch->desc = sprintf($this->lang->branch->mainBranch, $this->lang->product->branchName[$product->type]);
|
||||
$mainBranch->order = 0;
|
||||
|
||||
return array($mainBranch) + $branchList;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='c-id'><?php echo $lang->branch->id;?></th>
|
||||
<th class='required c-name'><?php echo $lang->branch->name;?></th>
|
||||
<th class='c-desc'><?php echo $lang->branch->desc;?></th>
|
||||
<th class='required c-name'><?php echo sprintf($lang->branch->name, $lang->product->branchName[$product->type]);?></th>
|
||||
<th class='c-desc'><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
|
||||
<th class='c-status'><?php echo $lang->branch->status;?></th>
|
||||
<th class='c-default text-center'><?php echo $lang->branch->defaultBranch;?></th>
|
||||
</tr>
|
||||
@@ -31,7 +31,7 @@
|
||||
<?php foreach($branchList as $branch):?>
|
||||
<?php $disabled = $branch->id == BRANCH_MAIN ? 'disabled' : '';?>
|
||||
<tr>
|
||||
<td><?php echo ($branch->id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch);?></td>
|
||||
<td><?php echo ($branch->id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch->id);?></td>
|
||||
<td><?php echo html::input("name[$branch->id]", $branch->name, "class='form-control chosen' $disabled");?></td>
|
||||
<td><?php echo html::input("desc[$branch->id]", $branch->desc, "class='form-control' $disabled");?></td>
|
||||
<td><?php echo html::select("status[$branch->id]", $lang->branch->statusList, $branch->status, "class='form-control' chosen $disabled onchange='canSetDefaultBranch(this)'");?></td>
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->branch->create;?></h2>
|
||||
<h2><?php echo sprintf($lang->branch->create, $lang->product->branchName[$product->type]);?></h2>
|
||||
</div>
|
||||
<form class='main-form' method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->branch->name;?></th>
|
||||
<th><?php echo sprintf($lang->branch->name, $lang->product->branchName[$product->type]);?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->branch->desc;?></th>
|
||||
<th><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
|
||||
<td><?php echo html::input('desc', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->branch->editAction;?></h2>
|
||||
<h2><?php echo sprintf($lang->branch->editAction, $lang->product->branchName[$product->type]);?></h2>
|
||||
</div>
|
||||
<form class='main-form' method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->branch->name;?></th>
|
||||
<th><?php echo sprintf($lang->branch->name, $lang->product->branchName[$product->type]);?></th>
|
||||
<td><?php echo html::input('name', $branch->name, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -26,7 +26,7 @@
|
||||
<td><?php echo html::select('status', $lang->branch->statusList, $branch->status, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->branch->desc;?></th>
|
||||
<th><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
|
||||
<td><?php echo html::input('desc', $branch->desc, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php if($canCreate) common::printLink('branch', 'create', "productID=$productID", "<i class='icon icon-plus'></i> " . $lang->branch->create, '', "class='btn btn-primary iframe'", true, true);?>
|
||||
<?php if($canCreate) common::printLink('branch', 'create', "productID=$productID", "<i class='icon icon-plus'></i> " . sprintf($lang->branch->create, $lang->product->branchName[$product->type]), '', "class='btn btn-primary iframe'", true, true);?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainContent">
|
||||
@@ -37,7 +37,7 @@
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->branch->noData;?></span>
|
||||
<?php if($canCreate) echo html::a($this->createLink('branch', 'create', "productID=$productID", '', true), "<i class='icon icon-plus'></i> " . $lang->branch->create, '', "class='btn btn-info iframe'");?>
|
||||
<?php if($canCreate) echo html::a($this->createLink('branch', 'create', "productID=$productID", '', true), "<i class='icon icon-plus'></i> " . sprintf($lang->branch->create, $lang->product->branchName[$product->type]), '', "class='btn btn-info iframe'");?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else:?>
|
||||
@@ -54,11 +54,11 @@
|
||||
<?php if($canOrder):?>
|
||||
<th class='c-order sort-default'><?php echo $lang->branch->order;?></th>
|
||||
<?php endif;?>
|
||||
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->branch->name);?></th>
|
||||
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, sprintf($lang->branch->name, $lang->product->branchName[$product->type]));?></th>
|
||||
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->branch->status);?></th>
|
||||
<th class='c-date'><?php common::printOrderLink('createdDate', $orderBy, $vars, $lang->branch->createdDate);?></th>
|
||||
<th class='c-date'><?php common::printOrderLink('closedDate', $orderBy, $vars, $lang->branch->closedDate);?></th>
|
||||
<th class='c-desc'><?php echo $lang->branch->desc;?></th>
|
||||
<th class='c-desc'><?php echo sprintf($lang->branch->desc, $lang->product->branchName[$product->type]);?></th>
|
||||
<th class='c-actions-2'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -99,7 +99,7 @@
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$disabled = $isMain ? 'disabled' : '';
|
||||
common::printIcon('branch', 'edit', "branchID=$branch->id", $branch, 'list', '', '', "$disabled iframe", true);
|
||||
common::printIcon('branch', 'edit', "branchID=$branch->id&productID=$productID", $branch, 'list', '', '', "$disabled iframe", true);
|
||||
if($branch->status == 'active')
|
||||
{
|
||||
common::printIcon('branch', 'close', "branchID=$branch->id", $branch, 'list', 'off', 'hiddenwin', $disabled);
|
||||
|
||||
@@ -325,7 +325,7 @@ class bug extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->qa->setMenu($this->products, $productID);
|
||||
$this->qa->setMenu($this->products, $productID, $branch);
|
||||
}
|
||||
|
||||
foreach($output as $paramKey => $paramValue)
|
||||
|
||||
@@ -365,8 +365,8 @@ class executionModel extends model
|
||||
$this->dao->insert(TABLE_EXECUTION)->data($sprint)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
->batchcheck($this->config->execution->create->requiredFields, 'notempty')
|
||||
->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `parent` = $sprint->parent")
|
||||
->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage') and `parent` = $sprint->parent")
|
||||
->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `project` = $sprint->project")
|
||||
->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage')")
|
||||
->checkIF($sprint->begin != '', 'begin', 'date')
|
||||
->checkIF($sprint->end != '', 'end', 'date')
|
||||
->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin)
|
||||
@@ -519,6 +519,7 @@ class executionModel extends model
|
||||
->checkIF($execution->begin != '', 'begin', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'ge', $execution->begin)
|
||||
->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $execution->project")
|
||||
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
|
||||
->where('id')->eq($executionID)
|
||||
->limit(1)
|
||||
@@ -544,7 +545,7 @@ class executionModel extends model
|
||||
$changedAccounts[$owner] = $owner;
|
||||
$teamMembers[$ownerField] = $member;
|
||||
}
|
||||
if($execution->project) $this->addProjectMembers($execution->project, $teamMembers);
|
||||
if($execution->project) $this->addProjectMembers($execution->project, $teamMembers);
|
||||
|
||||
$whitelist = explode(',', $execution->whitelist);
|
||||
$this->loadModel('personnel')->updateWhitelist($whitelist, 'sprint', $executionID);
|
||||
@@ -624,10 +625,6 @@ class executionModel extends model
|
||||
if(isset($data->projects)) $executions[$executionID]->project = zget($data->projects, $executionID, 0);
|
||||
if(isset($data->attributes)) $executions[$executionID]->attribute = zget($data->attributes, $executionID, '');
|
||||
|
||||
/* Check unique name for edited executions. */
|
||||
if(isset($nameList[$executionName])) dao::$errors['name'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->execution->name, $executionName);
|
||||
$nameList[$executionName] = $executionName;
|
||||
|
||||
/* Check unique code for edited executions. */
|
||||
if($projectModel == 'scrum' and empty($executionCode))
|
||||
{
|
||||
@@ -646,6 +643,7 @@ class executionModel extends model
|
||||
{
|
||||
$oldExecution = $oldExecutions[$executionID];
|
||||
$team = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution');
|
||||
$projectID = isset($execution->project) ? $execution->project : $oldExecution->project;
|
||||
|
||||
$this->dao->update(TABLE_EXECUTION)->data($execution)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
@@ -653,7 +651,8 @@ class executionModel extends model
|
||||
->checkIF($execution->begin != '', 'begin', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'gt', $execution->begin)
|
||||
->checkIF(!empty($execution->code), 'code', 'unique', "id NOT " . helper::dbIN($data->executionIDList) . " and type in ('sprint','stage')")
|
||||
->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID")
|
||||
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
|
||||
->where('id')->eq($executionID)
|
||||
->limit(1)
|
||||
->exec();
|
||||
|
||||
@@ -216,7 +216,7 @@ class product extends control
|
||||
$this->app->loadLang('datatable');
|
||||
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
|
||||
}
|
||||
|
||||
|
||||
/* Get stories. */
|
||||
if($this->app->rawModule == 'projectstory')
|
||||
{
|
||||
@@ -992,16 +992,24 @@ class product extends control
|
||||
}
|
||||
|
||||
$field = $fieldID ? "plans[$fieldID]" : 'plan';
|
||||
$output = html::select($field, $plans, $planID, "class='form-control chosen'");
|
||||
$output = "<div class='table-row'>";
|
||||
$output .= "<div class='table-col'>";
|
||||
$output .= html::select($field, $plans, $planID, "class='form-control chosen'");
|
||||
$output .= "</div>";
|
||||
if(count($plans) == 1 and $needCreate)
|
||||
{
|
||||
$output .= "<div class='table-col'>";
|
||||
$output .= "<div class='input-group-btn'>";
|
||||
$output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "<i class='icon icon-plus'></i>", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'");
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= "<div class='table-col'>";
|
||||
$output .= "<div class='input-group-btn'>";
|
||||
$output .= html::a("javascript:void(0)", "<i class='icon icon-refresh'></i>", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'");
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= "</div>";
|
||||
die($output);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,3 +35,4 @@ a.removeModule:hover {color: red;}
|
||||
#batchUnlinkStoryTip .table tfoot {position: relative; bottom: -30px;}
|
||||
#batchUnlinkStoryTip .table td {border-bottom: 0px;}
|
||||
#batchUnlinkStoryTip .table th:first-child {width: 460px;}
|
||||
#mainMenu .dropdown-menu>li>a>.icon {top: 4px;}
|
||||
|
||||
@@ -477,7 +477,8 @@ class productModel extends model
|
||||
if(strpos($storyMethods, "," . $currentMethod . ",") === false) $currentModule = 'product';
|
||||
if($currentMethod == 'view' or $currentMethod == 'change' or $currentMethod == 'review') $currentMethod = 'browse';
|
||||
}
|
||||
if($currentModule == 'testcase' and $currentMethod == 'view') $currentMethod = 'browse';
|
||||
if($currentModule == 'testcase' and strpos(',view,edit,', ",$currentMethod,") !== false) $currentMethod = 'browse';
|
||||
if($currentModule == 'bug' and $currentMethod == 'edit') $currentMethod = 'browse';
|
||||
if($currentMethod == 'report') $currentMethod = 'browse';
|
||||
|
||||
$currentProductName = $this->lang->product->common;
|
||||
@@ -562,7 +563,7 @@ class productModel extends model
|
||||
$this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck()
|
||||
->batchCheck($this->config->product->create->requiredFields, 'notempty')
|
||||
->checkIF(!empty($product->name), 'name', 'unique', "`program` = $product->program")
|
||||
->checkIF(!empty($product->code), 'code', 'unique', "`program` = $product->program")
|
||||
->checkIF(!empty($product->code), 'code', 'unique')
|
||||
->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
@@ -631,8 +632,8 @@ class productModel extends model
|
||||
$product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid);
|
||||
$this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()
|
||||
->batchCheck($this->config->product->edit->requiredFields, 'notempty')
|
||||
->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $product->program")
|
||||
->checkIF(!empty($product->code), 'code', 'unique', "id != $productID")
|
||||
->check('name', 'unique', "id != $productID and deleted = '0'")
|
||||
->where('id')->eq($productID)
|
||||
->exec();
|
||||
|
||||
@@ -661,6 +662,7 @@ class productModel extends model
|
||||
$data = fixer::input('post')->get();
|
||||
$oldProducts = $this->getByIdList($this->post->productIDList);
|
||||
$nameList = array();
|
||||
|
||||
foreach($data->productIDList as $productID)
|
||||
{
|
||||
$productName = $data->names[$productID];
|
||||
@@ -677,10 +679,6 @@ class productModel extends model
|
||||
$products[$productID]->status = $data->statuses[$productID];
|
||||
$products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags);
|
||||
$products[$productID]->acl = $data->acls[$productID];
|
||||
|
||||
/* Check unique name for edited products. */
|
||||
if(isset($nameList[$productName])) dao::$errors['name'][] = 'product#' . $productID . sprintf($this->lang->error->unique, $this->lang->product->name, $productName);
|
||||
$nameList[$productName] = $productName;
|
||||
}
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
@@ -688,12 +686,13 @@ class productModel extends model
|
||||
foreach($products as $productID => $product)
|
||||
{
|
||||
$oldProduct = $oldProducts[$productID];
|
||||
$programID = !isset($product->program) ? $oldProduct->program : (empty($product->program) ? 0 : $product->program);
|
||||
|
||||
$this->dao->update(TABLE_PRODUCT)
|
||||
->data($product)
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->product->edit->requiredFields , 'notempty')
|
||||
->check('name', 'unique', "id NOT " . helper::dbIN($data->productIDList) . " and deleted='0'")
|
||||
->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $programID")
|
||||
->where('id')->eq($productID)
|
||||
->exec();
|
||||
if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true)));
|
||||
|
||||
@@ -741,7 +741,7 @@ class programModel extends model
|
||||
->checkIF($program->begin != '', 'begin', 'date')
|
||||
->checkIF($program->end != '', 'end', 'date')
|
||||
->checkIF($program->end != '', 'end', 'gt', $program->begin)
|
||||
->check('name', 'unique', "id!=$programID and deleted='0' and `type`='program'")
|
||||
->checkIF(!empty($program->name), 'name', 'unique', "id!=$programID and `type`='program' and `parent` = $program->parent")
|
||||
->where('id')->eq($programID)
|
||||
->limit(1)
|
||||
->exec();
|
||||
|
||||
@@ -511,9 +511,12 @@ class project extends control
|
||||
|
||||
/* Link the plan stories. */
|
||||
$newPlans = array();
|
||||
foreach($_POST['plans'] as $plans)
|
||||
if(isset($_POST['plans']))
|
||||
{
|
||||
foreach($plans as $planID) $newPlans[$planID] = $planID;
|
||||
foreach($_POST['plans'] as $plans)
|
||||
{
|
||||
foreach($plans as $planID) $newPlans[$planID] = $planID;
|
||||
}
|
||||
}
|
||||
|
||||
$diffResult = array_diff($oldPlans, $newPlans);
|
||||
|
||||
@@ -858,7 +858,7 @@ class projectModel extends model
|
||||
->autoCheck()
|
||||
->batchcheck($requiredFields, 'notempty')
|
||||
->checkIF(!empty($project->name), 'name', 'unique', "`type`='project' and `parent` = $project->parent")
|
||||
->checkIF(!empty($project->code), 'code', 'unique', "`type`='project' and `parent` = $project->parent")
|
||||
->checkIF(!empty($project->code), 'code', 'unique', "`type`='project'")
|
||||
->checkIF($project->end != '', 'end', 'gt', $project->begin)
|
||||
->exec();
|
||||
|
||||
@@ -1049,8 +1049,8 @@ class projectModel extends model
|
||||
->checkIF($project->begin != '', 'begin', 'date')
|
||||
->checkIF($project->end != '', 'end', 'date')
|
||||
->checkIF($project->end != '', 'end', 'gt', $project->begin)
|
||||
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and type='project'")
|
||||
->check('name', 'unique', "id != $projectID AND type='project' AND deleted='0'")
|
||||
->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = $project->parent")
|
||||
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type` = 'project'")
|
||||
->where('id')->eq($projectID)
|
||||
->exec();
|
||||
|
||||
@@ -1114,10 +1114,6 @@ class projectModel extends model
|
||||
$projects[$projectID]->lastEditedBy = $this->app->user->account;
|
||||
$projects[$projectID]->lastEditedDate = helper::now();
|
||||
|
||||
/* Check unique name for edited projects. */
|
||||
if(isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->project->name, $projectName);
|
||||
$nameList[$projectName] = $projectName;
|
||||
|
||||
if($projects[$projectID]->parent)
|
||||
{
|
||||
$parentProject = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($projects[$projectID]->parent)->fetch();
|
||||
@@ -1137,12 +1133,16 @@ class projectModel extends model
|
||||
foreach($projects as $projectID => $project)
|
||||
{
|
||||
$oldProject = $oldProjects[$projectID];
|
||||
$parentID = !isset($project->parent) ? $oldProject->parent : $project->parent;
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)->data($project)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
->batchCheck($this->config->project->edit->requiredFields , 'notempty')
|
||||
->checkIF($project->begin != '', 'begin', 'date')
|
||||
->checkIF($project->end != '', 'end', 'date')
|
||||
->checkIF($project->end != '', 'end', 'gt', $project->begin)
|
||||
->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $parentID")
|
||||
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project'")
|
||||
->where('id')->eq($projectID)
|
||||
->exec();
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
.c-id {width: 40px;}
|
||||
.c-estimate {width: 50px;}
|
||||
.c-branch, .c-module {width: 120px;}
|
||||
.c-plan, .c-title {width: 150px;}
|
||||
.c-title {width: 150px;}
|
||||
.c-plan {width: 170px;}
|
||||
.c-category {width: 90px;}
|
||||
.c-pri {width: 70px;}
|
||||
.c-source {width: 130px;}
|
||||
.c-note, .c-stage, .c-reason {width: 100px;}
|
||||
.c-keywords {width: 80px;}
|
||||
#batchEditForm > div > table > tbody > tr > td:nth-child(4) > div > div:nth-child(1) {width: 60%;}
|
||||
|
||||
@@ -2461,10 +2461,6 @@ class storyModel extends model
|
||||
$storyQuery .= " AND `status` NOT IN ('draft', 'closed')";
|
||||
}
|
||||
}
|
||||
elseif($branch)
|
||||
{
|
||||
if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` = $branch";
|
||||
}
|
||||
elseif(strpos($storyQuery, $allBranch) !== false)
|
||||
{
|
||||
$storyQuery = str_replace($allBranch, '1', $storyQuery);
|
||||
@@ -4017,7 +4013,7 @@ class storyModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
$stories = $this->getProductStories($productID, 0, 0, 'all', 'story', 'id_desc', true, $excludeStories);
|
||||
$stories = $this->getProductStories($productID, $branch, 0, 'all', 'story', 'id_desc', true, $excludeStories);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -4028,7 +4024,7 @@ class storyModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
$stories = $this->getProductStories($productID, 0, 0, 'all', 'story', 'id_desc', true, $excludeStories, $pager);
|
||||
$stories = $this->getProductStories($productID, $branch, 0, 'all', 'story', 'id_desc', true, $excludeStories, $pager);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-1
@@ -372,10 +372,11 @@ class treeModel extends model
|
||||
{
|
||||
if($type == 'line') $rootID = 0;
|
||||
|
||||
$this->loadModel('branch');
|
||||
$branches = array($branch => '');
|
||||
if($branch)
|
||||
{
|
||||
$branchName = $this->loadModel('branch')->getById($branch);
|
||||
$branchName = $this->branch->getById($branch);
|
||||
$branches = array($branch => $branchName);
|
||||
$extra = array('rootID' => $rootID, 'branch' => $branch);
|
||||
}
|
||||
@@ -386,6 +387,22 @@ class treeModel extends model
|
||||
{
|
||||
if($product->type != 'normal') $branches = array(BRANCH_MAIN => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($rootID, 'noempty');
|
||||
}
|
||||
elseif($type == 'story' and $this->app->rawModule == 'projectstory')
|
||||
{
|
||||
$projectID = zget($extra, 'projectID', 0);
|
||||
if($product->type != 'normal' and $projectID)
|
||||
{
|
||||
$projectBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT)
|
||||
->where('project')->eq($projectID)
|
||||
->andWhere('product')->eq($product->id)
|
||||
->fetchPairs();
|
||||
|
||||
if(isset($projectBranches[BRANCH_MAIN])) $branches = array(BRANCH_MAIN => $this->lang->branch->main);
|
||||
$branches += $this->dao->select('id, name')->from(TABLE_BRANCH)
|
||||
->where('id')->in($projectBranches)
|
||||
->fetchPairs();
|
||||
}
|
||||
}
|
||||
|
||||
/* Add for task #1945. check the module has case or no. */
|
||||
if($type == 'case' and !empty($extra)) $this->loadModel('testtask');
|
||||
|
||||
@@ -732,6 +732,7 @@ class upgradeModel extends model
|
||||
case '15_7_1':
|
||||
$this->saveLogs('Execute 15_7_1');
|
||||
$this->execSQL($this->getUpgradeFile('15.7.1'));
|
||||
$this->updateObjectBranch();
|
||||
$this->updateProjectStories();
|
||||
$this->appendExec('15_7_1');
|
||||
}
|
||||
@@ -5332,6 +5333,28 @@ class upgradeModel extends model
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update branch when object have module.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateObjectBranch()
|
||||
{
|
||||
$moduleBranchPairs = $this->dao->select('id,branch')->from(TABLE_MODULE)->fetchPairs();
|
||||
|
||||
$storyModulePairs = $this->dao->select('module')->from(TABLE_STORY)->where('module')->ne(0)->fetchPairs();
|
||||
foreach($storyModulePairs as $moduleID) $this->dao->update(TABLE_STORY)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec();
|
||||
|
||||
$bugModulePairs = $this->dao->select('module')->from(TABLE_BUG)->where('module')->ne(0)->fetchPairs();
|
||||
foreach($bugModulePairs as $moduleID) $this->dao->update(TABLE_BUG)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec();
|
||||
|
||||
$caseModulePairs = $this->dao->select('module')->from(TABLE_CASE)->where('module')->ne(0)->fetchPairs();
|
||||
foreach($caseModulePairs as $moduleID) $this->dao->update(TABLE_CASE)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update branch of project linked stories.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user