* finish task #2415.

This commit is contained in:
wangyidong
2015-11-25 14:22:24 +08:00
parent 849ec91753
commit aa8c0363f3
6 changed files with 79 additions and 9 deletions

View File

@@ -172,9 +172,10 @@ $lang->resource->story->activate = 'lblActivate';
$lang->resource->story->tasks = 'tasks';
$lang->resource->story->zeroCase = 'zeroCase';
$lang->resource->story->report = 'reportChart';
$lang->resource->story->batchChangePlan = 'batchChangePlan';
$lang->resource->story->batchChangeStage = 'batchChangeStage';
$lang->resource->story->batchAssignTo = 'batchAssignTo';
$lang->resource->story->batchChangePlan = 'batchChangePlan';
$lang->resource->story->batchChangeBranch = 'batchChangeBranch';
$lang->resource->story->batchChangeStage = 'batchChangeStage';
$lang->resource->story->batchAssignTo = 'batchAssignTo';
$lang->story->methodOrder[5] = 'create';
$lang->story->methodOrder[10] = 'batchCreate';
@@ -194,6 +195,7 @@ $lang->story->methodOrder[75] = 'activate';
$lang->story->methodOrder[80] = 'tasks';
$lang->story->methodOrder[85] = 'zeroCase';
$lang->story->methodOrder[90] = 'report';
$lang->story->methodOrder[95] = 'batchChangeBranch';
/* Product plan. */
$lang->resource->productplan = new stdclass();
@@ -1110,3 +1112,5 @@ $lang->changelog['7.4.beta'][] = 'user-unbind';
$lang->changelog['7.4.beta'][] = 'branch-manage';
$lang->changelog['7.4.beta'][] = 'branch-delete';
$lang->changelog['7.4.beta'][] = 'my-unbind';
$lang->changelog['8.0'][] = 'story-batchChangeBranch';

View File

@@ -200,6 +200,21 @@
echo '<li>' . html::a('javascript:;', $lang->story->review, '', $class) . '</li>';
}
if(common::hasPriv('story', 'batchChangeBranch') and $this->session->currentProductType != 'normal')
{
$withSearch = count($branches) > 8;
echo "<li class='dropdown-submenu'>";
echo html::a('javascript:;', $lang->product->branchName[$this->session->currentProductType], '', "id='branchItem'");
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
foreach($branches as $branchID => $branchName)
{
$actionLink = $this->createLink('story', 'batchChangeBranch', "branchID=$branchID");
echo "<li class='option' data-key='$branchID'>" . html::a('#', $branchName, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"") . "</li>";
}
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
echo '</ul></li>';
}
if(common::hasPriv('story', 'batchChangePlan'))
{
unset($plans['']);

View File

@@ -794,6 +794,27 @@ class story extends control
die(js::reload('parent'));
}
/**
* Batch change branch.
*
* @param int $branchID
* @access public
* @return void
*/
public function batchChangeBranch($branchID)
{
$storyIDList = !empty($_POST['storyIDList']) ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent'));
$allChanges = $this->story->batchChangeBranch($storyIDList, $branchID);
if(dao::isError()) die(js::error(dao::getError()));
foreach($allChanges as $storyID => $changes)
{
$actionID = $this->action->create('story', $storyID, 'Edited');
$this->action->logHistory($actionID, $changes);
$this->sendmail($storyID, $actionID);
}
die(js::reload('parent'));
}
/**
* Batch change the stage of story.
*

View File

@@ -32,9 +32,10 @@ $lang->story->linkStory = 'Related story';
$lang->story->export = "Export data";
$lang->story->zeroCase = "Story of zero case";
$lang->story->reportChart = "Report";
$lang->story->batchChangePlan = "Batch change plan";
$lang->story->batchChangeStage = "Batch change stage";
$lang->story->batchAssignTo = "Batch assignto";
$lang->story->batchChangePlan = "Batch change plan";
$lang->story->batchChangeBranch = "Batch change branch";
$lang->story->batchChangeStage = "Batch change stage";
$lang->story->batchAssignTo = "Batch assignto";
$lang->story->common = 'Story';
$lang->story->id = 'ID';

View File

@@ -32,9 +32,10 @@ $lang->story->linkStory = '关联需求';
$lang->story->export = "导出数据";
$lang->story->zeroCase = "零用例需求";
$lang->story->reportChart = "统计报表";
$lang->story->batchChangePlan = "批量修改计划";
$lang->story->batchChangeStage = "批量修改阶段";
$lang->story->batchAssignTo = "批量指派";
$lang->story->batchChangePlan = "批量修改计划";
$lang->story->batchChangeBranch = "批量修改分支";
$lang->story->batchChangeStage = "批量修改阶段";
$lang->story->batchAssignTo = "批量指派";
$lang->story->common = '需求';
$lang->story->id = '编号';

View File

@@ -761,6 +761,34 @@ class storyModel extends model
return $allChanges;
}
/**
* Batch change branch.
*
* @param array $storyIDList
* @param int $branchID
* @access public
* @return void
*/
public function batchChangeBranch($storyIDList, $branchID)
{
$now = helper::now();
$allChanges = array();
$oldStories = $this->getByList($storyIDList);
foreach($storyIDList as $storyID)
{
$oldStory = $oldStories[$storyID];
$story = new stdclass();
$story->lastEditedBy = $this->app->user->account;
$story->lastEditedDate = $now;
$story->branch = $branchID;
$this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec();
if(!dao::isError()) $allChanges[$storyID] = common::createChanges($oldStory, $story);
}
return $allChanges;
}
/**
* Batch change the stage of story.
*