* finish task #2568.
This commit is contained in:
@@ -168,6 +168,7 @@ class product extends control
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noletter|pofirst');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
|
||||
$this->view->moduleID = $moduleID;
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
$this->view->branch = $branch;
|
||||
|
||||
@@ -167,6 +167,25 @@
|
||||
echo '</ul></li>';
|
||||
}
|
||||
|
||||
if(common::hasPriv('story', 'batchChangeModule'))
|
||||
{
|
||||
$withSearch = count($modules) > 8;
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript:;', $lang->story->moduleAB, '', "id='moduleItem'");
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach($modules as $moduleId => $module)
|
||||
{
|
||||
$actionLink = $this->createLink('story', 'batchChangeModule', "moduleID=$moduleId");
|
||||
echo "<li class='option' data-key='$moduleID'>" . html::a('#', $module, '', "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>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $lang->story->moduleAB, '', $class) . '</li>';
|
||||
}
|
||||
|
||||
if(common::hasPriv('story', 'batchChangePlan'))
|
||||
{
|
||||
unset($plans['']);
|
||||
|
||||
@@ -770,6 +770,27 @@ class story extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change the module of story.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangeModule($moduleID)
|
||||
{
|
||||
$storyIDList = !empty($_POST['storyIDList']) ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent'));
|
||||
$allChanges = $this->story->batchChangeModule($storyIDList, $moduleID);
|
||||
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 plan of story.
|
||||
*
|
||||
|
||||
@@ -38,6 +38,7 @@ $lang->story->common = 'Story';
|
||||
$lang->story->id = 'ID';
|
||||
$lang->story->product = $lang->productCommon;
|
||||
$lang->story->module = 'Module';
|
||||
$lang->story->moduleAB = 'Module';
|
||||
$lang->story->source = 'Source';
|
||||
$lang->story->fromBug = 'From bug';
|
||||
$lang->story->title = 'Title';
|
||||
|
||||
@@ -38,6 +38,7 @@ $lang->story->common = '需求';
|
||||
$lang->story->id = '编号';
|
||||
$lang->story->product = "所属{$lang->productCommon}";
|
||||
$lang->story->module = '所属模块';
|
||||
$lang->story->moduleAB = '模块';
|
||||
$lang->story->source = '需求来源';
|
||||
$lang->story->fromBug = '来源Bug';
|
||||
$lang->story->title = '需求名称';
|
||||
|
||||
@@ -739,6 +739,35 @@ class storyModel extends model
|
||||
return $allChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change the module of story.
|
||||
*
|
||||
* @param array $storyIDList
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeModule($storyIDList, $moduleID)
|
||||
{
|
||||
$now = helper::now();
|
||||
$allChanges = array();
|
||||
$oldStories = $this->getByList($storyIDList);
|
||||
foreach($storyIDList as $storyID)
|
||||
{
|
||||
$oldStory = $oldStories[$storyID];
|
||||
if($moduleID == $oldStory->module) continue;
|
||||
|
||||
$story = new stdclass();
|
||||
$story->lastEditedBy = $this->app->user->account;
|
||||
$story->lastEditedDate = $now;
|
||||
$story->module = $moduleID;
|
||||
|
||||
$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 plan of story.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user