* Edit branch for story when batch edit them.
This commit is contained in:
@@ -191,7 +191,7 @@ function loadProductModules(productID)
|
||||
{
|
||||
branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&needManage=true');
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
|
||||
$('#moduleIdBox').load(link, function()
|
||||
{
|
||||
$(this).find('select').chosen(defaultChosenOptions)
|
||||
|
||||
@@ -531,10 +531,11 @@ class product extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $needCreate = false)
|
||||
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false)
|
||||
{
|
||||
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
|
||||
$output = html::select('plan', $plans, $planID, "class='form-control chosen'");
|
||||
$field = $fieldID ? "plans[$fieldID]" : 'plan';
|
||||
$output = html::select($field, $plans, $planID, "class='form-control chosen'");
|
||||
if(count($plans) == 1 and $needCreate)
|
||||
{
|
||||
$output .= "<span class='input-group-addon'>";
|
||||
|
||||
@@ -241,6 +241,23 @@ class productModel extends model
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get products by story id list.
|
||||
*
|
||||
* @param array $storyIDList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProductsByStory($storyIDList)
|
||||
{
|
||||
return $this->dao->select('distinct t1.product, t1.id, t2.name, t2.type')
|
||||
->from(TABLE_STORY)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')
|
||||
->on('t1.product = t2.id')
|
||||
->where('t1.id')->in($storyIDList)
|
||||
->fetchAll('product');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grouped products.
|
||||
*
|
||||
|
||||
@@ -44,7 +44,7 @@ $config->story->list->customBatchEditFields = 'module,plan,estimate,pri,assign
|
||||
$config->story->custom = new stdclass();
|
||||
$config->story->custom->createFields = $config->story->list->customCreateFields;
|
||||
$config->story->custom->batchCreateFields = 'module,plan,spec,pri,estimate,review';
|
||||
$config->story->custom->batchEditFields = 'module,plan,estimate,pri,source,stage,closedBy,closedReason';
|
||||
$config->story->custom->batchEditFields = 'branch,module,plan,estimate,pri,source,stage,closedBy,closedReason';
|
||||
|
||||
$config->story->datatable = new stdclass();
|
||||
$config->story->datatable->defaultField = array('id', 'pri', 'title', 'plan', 'source', 'openedBy', 'assignedTo', 'estimate', 'status', 'stage', 'taskCount', 'bugCount', 'caseCount', 'actions');
|
||||
|
||||
@@ -405,6 +405,7 @@ class story extends control
|
||||
{
|
||||
$this->product->setMenu($this->product->getPairs('nodeleted'), $productID, $branch);
|
||||
$product = $this->product->getByID($productID);
|
||||
$branchProduct = $product->type == 'normal' ? false : true;
|
||||
|
||||
/* Set modules and productPlans. */
|
||||
$modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
|
||||
@@ -412,7 +413,9 @@ class story extends control
|
||||
$productPlans = $this->productplan->getPairs($productID, $branch);
|
||||
$productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;
|
||||
|
||||
|
||||
$this->view->modules = $modules;
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
|
||||
$this->view->productPlans = $productPlans;
|
||||
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name);
|
||||
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit;
|
||||
@@ -425,7 +428,20 @@ class story extends control
|
||||
$this->project->setMenu($this->project->getPairs('nodeleted'), $projectID);
|
||||
$this->lang->set('menugroup.story', 'project');
|
||||
$this->lang->story->menuOrder = $this->lang->project->menuOrder;
|
||||
|
||||
$project = $this->project->getByID($projectID);
|
||||
|
||||
$branchProduct = false;
|
||||
$linkedProducts = $this->project->getProducts($projectID);
|
||||
foreach($linkedProducts as $linkedProduct)
|
||||
{
|
||||
if($linkedProduct->type != 'normal')
|
||||
{
|
||||
$branchProduct = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->position[] = html::a($this->createLink('project', 'story', "project=$project->id"), $project->name);
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->story->batchEdit;
|
||||
}
|
||||
@@ -436,6 +452,18 @@ class story extends control
|
||||
$this->lang->set('menugroup.story', 'my');
|
||||
$this->lang->story->menuOrder = $this->lang->my->menuOrder;
|
||||
$this->loadModel('my')->setMenu();
|
||||
|
||||
$branchProduct = false;
|
||||
$linkedProducts = $this->product->getProductsByStory(array_keys($stories));
|
||||
foreach($linkedProducts as $linkedProduct)
|
||||
{
|
||||
if($linkedProduct->type != 'normal')
|
||||
{
|
||||
$branchProduct = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->position[] = html::a($this->createLink('my', 'story'), $this->lang->my->story);
|
||||
$this->view->title = $this->lang->story->batchEdit;
|
||||
}
|
||||
@@ -462,6 +490,7 @@ class story extends control
|
||||
$this->view->reasonList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->reasonList;
|
||||
$this->view->stageList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->stageList;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->branchProduct = $branchProduct;
|
||||
$this->view->storyIDList = $storyIDList;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->stories = $stories;
|
||||
|
||||
@@ -25,6 +25,19 @@ function setDuplicateAndChild(resolution, storyID)
|
||||
}
|
||||
}
|
||||
|
||||
function loadBranches(product, branch, storyID)
|
||||
{
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(!branch) branch = 0;
|
||||
|
||||
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID + '&needManage=true');
|
||||
$('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen(defaultChosenOptions);})
|
||||
|
||||
planID = $('#plans' + storyID).val();
|
||||
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + product + '&branch=' + branch + '&planID=' + planID + '&fieldID=' + storyID + '&needCreate=true');
|
||||
$('#plans' + storyID).parent('td').load(planLink, function(){$('#plans' + storyID).chosen(defaultChosenOptions);});
|
||||
}
|
||||
|
||||
$(document).ready(removeDitto());//Remove 'ditto' in first row.
|
||||
|
||||
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value.
|
||||
|
||||
@@ -503,6 +503,7 @@ class storyModel extends model
|
||||
$allChanges = array();
|
||||
$now = helper::now();
|
||||
$data = fixer::input('post')->get();
|
||||
a($data);exit;
|
||||
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : array();
|
||||
|
||||
/* Init $stories. */
|
||||
@@ -513,15 +514,17 @@ class storyModel extends model
|
||||
/* Process the data if the value is 'ditto'. */
|
||||
foreach($storyIDList as $storyID)
|
||||
{
|
||||
if($data->pris[$storyID] == 'ditto') $data->pris[$storyID] = isset($prev['pri']) ? $prev['pri'] : 0;
|
||||
if($data->modules[$storyID] == 'ditto') $data->modules[$storyID] = isset($prev['module']) ? $prev['module'] : 0;
|
||||
if($data->plans[$storyID] == 'ditto') $data->plans[$storyID] = isset($prev['plan']) ? $prev['plan'] : 0;
|
||||
if($data->sources[$storyID] == 'ditto') $data->sources[$storyID] = isset($prev['source']) ? $prev['source'] : '';
|
||||
if($data->pris[$storyID] == 'ditto') $data->pris[$storyID] = isset($prev['pri']) ? $prev['pri'] : 0;
|
||||
if($data->branches[$storyID] == 'ditto') $data->branches[$storyID] = isset($prev['branch']) ? $prev['branch'] : 0;
|
||||
if($data->modules[$storyID] == 'ditto') $data->modules[$storyID] = isset($prev['module']) ? $prev['module'] : 0;
|
||||
if($data->plans[$storyID] == 'ditto') $data->plans[$storyID] = isset($prev['plan']) ? $prev['plan'] : 0;
|
||||
if($data->sources[$storyID] == 'ditto') $data->sources[$storyID] = isset($prev['source']) ? $prev['source'] : '';
|
||||
if(isset($data->stages[$storyID]) and ($data->stages[$storyID] == 'ditto')) $data->stages[$storyID] = isset($prev['stage']) ? $prev['stage'] : '';
|
||||
if(isset($data->closedBys[$storyID]) and ($data->closedBys[$storyID] == 'ditto')) $data->closedBys[$storyID] = isset($prev['closedBy']) ? $prev['closedBy'] : '';
|
||||
if(isset($data->closedReasons[$storyID]) and ($data->closedReasons[$storyID] == 'ditto')) $data->closedReasons[$storyID] = isset($prev['closedReason']) ? $prev['closedReason'] : '';
|
||||
|
||||
$prev['pri'] = $data->pris[$storyID];
|
||||
$prev['branch'] = isset($data->branches[$storyID]) ? $data->branches[$storyID] : 0;
|
||||
$prev['module'] = $data->modules[$storyID];
|
||||
$prev['plan'] = $data->plans[$storyID];
|
||||
$prev['source'] = $data->sources[$storyID];
|
||||
@@ -544,6 +547,7 @@ class storyModel extends model
|
||||
$story->pri = $data->pris[$storyID];
|
||||
$story->assignedTo = $data->assignedTo[$storyID];
|
||||
$story->assignedDate = $oldStory == $data->assignedTo[$storyID] ? $oldStory->assignedDate : $now;
|
||||
$story->branch = isset($data->branches[$storyID]) ? $data->branches[$storyID] : 0;
|
||||
$story->module = $data->modules[$storyID];
|
||||
$story->plan = $data->plans[$storyID];
|
||||
$story->source = $data->sources[$storyID];
|
||||
|
||||
@@ -39,6 +39,9 @@ foreach(explode(',', $showFields) as $field)
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
<th class='w-40px'> <?php echo $lang->idAB;?></th>
|
||||
<?php if($branchProduct):?>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'branch', ' hidden')?>'><?php echo $lang->story->branch;?></th>
|
||||
<?php endif;?>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'module', ' hidden')?>'><?php echo $lang->story->module;?></th>
|
||||
<th class='w-150px<?php echo zget($visibleFields, 'plan', ' hidden')?>'><?php echo $lang->story->planAB;?></th>
|
||||
<th> <?php echo $lang->story->title;?> <span class='required'></span></th>
|
||||
@@ -60,7 +63,15 @@ foreach(explode(',', $showFields) as $field)
|
||||
if(!$productID)
|
||||
{
|
||||
$product = $this->product->getByID($stories[$storyID]->product);
|
||||
$modules = $this->tree->getOptionMenu($stories[$storyID]->product, $viewType = 'story', 0, $branch);
|
||||
|
||||
$branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id);
|
||||
if($product->type != 'normal')
|
||||
{
|
||||
foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName;
|
||||
$branches = array('ditto' => $this->lang->story->ditto) + $branches;
|
||||
}
|
||||
|
||||
$modules = $this->tree->getOptionMenu($stories[$storyID]->product, $viewType = 'story', 0, $stories[$storyID]->branch);
|
||||
foreach($modules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $product->name . $moduleName;
|
||||
$modules = array('ditto' => $this->lang->story->ditto) + $modules;
|
||||
|
||||
@@ -70,6 +81,13 @@ foreach(explode(',', $showFields) as $field)
|
||||
?>
|
||||
<tr class='text-center'>
|
||||
<td><?php echo $storyID . html::hidden("storyIDList[$storyID]", $storyID);?></td>
|
||||
<?php if($branchProduct):?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'branch', ' hidden')?>' style='overflow:visible'>
|
||||
<?php $branchProductID = $productID ? $productID : $product->id;?>
|
||||
<?php $disabled = (isset($product) and $product->type == 'normal') ? "disabled='disabled'" : '';?>
|
||||
<?php echo html::select("branches[$storyID]", $branches, $stories[$storyID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $storyID);' $disabled");?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'module', ' hidden')?>' style='overflow:visible'> <?php echo html::select("modules[$storyID]", $modules, $stories[$storyID]->module, "class='form-control chosen'");?></td>
|
||||
<td class='text-left<?php echo zget($visibleFields, 'plan', ' hidden')?>' style='overflow:visible'> <?php echo html::select("plans[$storyID]", $productPlans, $stories[$storyID]->plan, "class='form-control chosen'");?></td>
|
||||
<td style='overflow:visible' title='<?php echo $stories[$storyID]->title?>'>
|
||||
|
||||
@@ -33,7 +33,7 @@ function loadProductModules(productID, branch)
|
||||
{
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(!branch) branch = 0;
|
||||
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&needManage=true');
|
||||
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
|
||||
$('#moduleIdBox').load(moduleLink, function()
|
||||
{
|
||||
$('#moduleIdBox #module').chosen(defaultChosenOptions);
|
||||
@@ -45,7 +45,7 @@ function loadProductPlans(productID, branch)
|
||||
{
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(!branch) branch = 0;
|
||||
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&needCreate=true');
|
||||
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=&needCreate=true');
|
||||
$('#planIdBox').load(planLink, function(){$('#planIdBox #plan').chosen(defaultChosenOptions);});
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ function loadProductModules(productID, branch)
|
||||
{
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(!branch) branch = 0;
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&needManage=true');
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
|
||||
$('#moduleIdBox').load(link, function()
|
||||
{
|
||||
$(this).find('select').chosen(defaultChosenOptions)
|
||||
|
||||
@@ -60,7 +60,7 @@ function loadLinkCases(caseID)
|
||||
*/
|
||||
function loadLibModules(libID)
|
||||
{
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&needManage=true');
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&fieldID=&needManage=true');
|
||||
$('#moduleIdBox').load(link, function()
|
||||
{
|
||||
$(this).find('select').chosen(defaultChosenOptions)
|
||||
|
||||
@@ -2,7 +2,7 @@ var newRowID = 0;
|
||||
|
||||
function loadLibModules(libID)
|
||||
{
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&needManage=true');
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&fieldID=&needManage=true');
|
||||
$('#moduleIdBox').load(link, function()
|
||||
{
|
||||
$(this).find('select').chosen(defaultChosenOptions)
|
||||
|
||||
@@ -312,7 +312,7 @@ class tree extends control
|
||||
* @access public
|
||||
* @return string the html select string.
|
||||
*/
|
||||
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $needManage = false)
|
||||
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $fieldID = '', $needManage = false)
|
||||
{
|
||||
if($viewType == 'task')
|
||||
{
|
||||
@@ -326,7 +326,8 @@ class tree extends control
|
||||
{
|
||||
$changeFunc = '';
|
||||
if($viewType == 'task' or $viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'";
|
||||
$output = html::select("module", $optionMenu, '', "class='form-control' $changeFunc");
|
||||
$field = $fieldID ? "modules[$fieldID]" : 'module';
|
||||
$output = html::select("$field", $optionMenu, '', "class='form-control' $changeFunc");
|
||||
if(count($optionMenu) == 1 and $needManage)
|
||||
{
|
||||
$output .= "<span class='input-group-addon'>";
|
||||
@@ -341,7 +342,8 @@ class tree extends control
|
||||
{
|
||||
$changeFunc = '';
|
||||
if($viewType == 'task' or $viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'";
|
||||
$output = html::select("module", $optionMenu, '', "class='input' $changeFunc");
|
||||
$field = $fieldID ? "modules[$fieldID]" : 'module';
|
||||
$output = html::select("$field", $optionMenu, '', "class='input' $changeFunc");
|
||||
die($output);
|
||||
}
|
||||
if($returnType == 'json') die(json_encode($optionMenu));
|
||||
|
||||
Reference in New Issue
Block a user