* Batch edit branch of bug.

This commit is contained in:
daitingting
2017-04-27 13:25:29 +08:00
parent ae7dee40d6
commit cfae0a2eff
4 changed files with 44 additions and 6 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ $config->bug->list->customBatchEditFields = 'type,severity,pri,productplan,ass
$config->bug->custom = new stdclass();
$config->bug->custom->createFields = $config->bug->list->customCreateFields;
$config->bug->custom->batchCreateFields = 'module,project,steps,type,severity,os,browser';
$config->bug->custom->batchEditFields = 'type,severity,pri,assignedTo,deadline,status,resolvedBy,resolution';
$config->bug->custom->batchEditFields = 'type,severity,pri,branch,assignedTo,deadline,status,resolvedBy,resolution';
$config->bug->editor = new stdclass();
$config->bug->editor->create = array('id' => 'steps', 'tools' => 'bugTools');
+18 -2
View File
@@ -615,11 +615,14 @@ class bug extends control
}
$bugIDList = $this->post->bugIDList ? $this->post->bugIDList : die(js::locate($this->session->bugList, 'parent'));
/* Initialize vars.*/
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($bugIDList)->fetchAll('id');
/* The bugs of a product. */
if($productID)
{
$product = $this->product->getByID($productID);
$branchProduct = $product->type == 'normal' ? false : true;
/* Set plans. */
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
@@ -630,10 +633,24 @@ class bug extends control
$this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit;
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]);
$this->view->plans = $plans;
$this->view->branches = $product->type == 'normal' ? array() : array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->loadModel('branch')->getPairs($product->id);
}
/* The bugs of my. */
else
{
$branchProduct = false;
$productIdList = array();
foreach($bugs as $bug) $productIdList[$bug->product] = $bug->product;
$products = $this->product->getByIdList($productIdList);
foreach($products as $product)
{
if($product->type != 'normal')
{
$branchProduct = true;
break;
}
}
$this->lang->bug->menu = $this->lang->my->menu;
$this->lang->set('menugroup.bug', 'my');
$this->lang->bug->menuOrder = $this->lang->my->menuOrder;
@@ -641,8 +658,6 @@ class bug extends control
$this->view->position[] = html::a($this->createLink('my', 'bug'), $this->lang->my->bug);
$this->view->title = "BUG" . $this->lang->bug->batchEdit;
}
/* Initialize vars.*/
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($bugIDList)->fetchAll('id');
/* Judge whether the editedTasks is too large and set session. */
$countInputVars = count($bugs) * (count(explode(',', $this->config->bug->custom->batchEditFields)) + 2);
@@ -663,6 +678,7 @@ class bug extends control
$this->view->position[] = $this->lang->bug->batchEdit;
$this->view->bugIDList = $bugIDList;
$this->view->productID = $productID;
$this->view->branchProduct = $branchProduct;
$this->view->severityList = array('ditto' => $this->lang->bug->ditto) + $this->lang->bug->severityList;
$this->view->typeList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->typeList;
$this->view->priList = array('0' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->priList;
+3
View File
@@ -548,6 +548,7 @@ class bugModel extends model
if($data->types[$bugID] == 'ditto') $data->types[$bugID] = isset($prev['type']) ? $prev['type'] : '';
if($data->severities[$bugID] == 'ditto') $data->severities[$bugID] = isset($prev['severity']) ? $prev['severity'] : 3;
if($data->pris[$bugID] == 'ditto') $data->pris[$bugID] = isset($prev['pri']) ? $prev['pri'] : 0;
if($data->branches[$bugID] == 'ditto') $data->branches[$bugID] = isset($prev['branch']) ? $prev['branch'] : 0;
if($data->plans[$bugID] == 'ditto') $data->plans[$bugID] = isset($prev['plan']) ? $prev['plan'] : '';
if($data->assignedTos[$bugID] == 'ditto') $data->assignedTos[$bugID] = isset($prev['assignedTo']) ? $prev['assignedTo'] : '';
if($data->resolvedBys[$bugID] == 'ditto') $data->resolvedBys[$bugID] = isset($prev['resolvedBy']) ? $prev['resolvedBy'] : '';
@@ -558,6 +559,7 @@ class bugModel extends model
$prev['type'] = $data->types[$bugID];
$prev['severity'] = $data->severities[$bugID];
$prev['pri'] = $data->pris[$bugID];
$prev['branch'] = $data->branches[$bugID];
$prev['plan'] = $data->plans[$bugID];
$prev['assignedTo'] = $data->assignedTos[$bugID];
$prev['resolvedBy'] = $data->resolvedBys[$bugID];
@@ -581,6 +583,7 @@ class bugModel extends model
$bug->color = $data->colors[$bugID];
$bug->title = $data->titles[$bugID];
$bug->plan = empty($data->plans[$bugID]) ? 0 : $data->plans[$bugID];
$bug->branch = empty($data->branches[$bugID]) ? 0 : $data->branches[$bugID];
$bug->assignedTo = $data->assignedTos[$bugID];
$bug->deadline = $data->deadlines[$bugID];
$bug->resolvedBy = $data->resolvedBys[$bugID];
+22 -3
View File
@@ -42,6 +42,9 @@ $columns = count($visibleFields) + 2;
<th class='w-70px<?php echo zget($visibleFields, 'severity', ' hidden')?>'><?php echo $lang->bug->severityAB;?></th>
<th class='w-70px<?php echo zget($visibleFields, 'pri', ' hidden')?>'><?php echo $lang->bug->pri;?></th>
<th <?php if(count($visibleFields) >= 10) echo "class='w-150px'"?>><?php echo $lang->bug->title;?> <span class='required'></span></th>
<?php if($branchProduct):?>
<th class='w-150px<?php echo zget($visibleFields, 'branch', ' hidden')?>'><?php echo $lang->bug->branch;?></th>
<?php endif;?>
<th class='w-150px<?php echo zget($visibleFields, 'productplan', ' hidden')?>'><?php echo $lang->bug->productplan;?></th>
<th class='w-150px<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>'><?php echo $lang->bug->assignedTo;?></th>
<th class='w-100px<?php echo zget($visibleFields, 'deadline', ' hidden')?>'><?php echo $lang->bug->deadline;?></th>
@@ -49,8 +52,8 @@ $columns = count($visibleFields) + 2;
<th class='w-100px<?php echo zget($visibleFields, 'os', ' hidden')?>'><?php echo $lang->bug->os;?></th>
<th class='w-100px<?php echo zget($visibleFields, 'browser', ' hidden')?>'><?php echo $lang->bug->browser;?></th>
<th class='w-100px<?php echo zget($visibleFields, 'keywords', ' hidden')?>'><?php echo $lang->bug->keywords;?></th>
<th class='w-150px<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>'><?php echo $lang->bug->resolvedByAB;?></th>
<th class='w-180px<?php echo zget($visibleFields, 'resolution', ' hidden')?>'><?php echo $lang->bug->resolutionAB;?></th>
<th class='w-120px<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>'><?php echo $lang->bug->resolvedByAB;?></th>
<th class='w-120px<?php echo zget($visibleFields, 'resolution', ' hidden')?>'><?php echo $lang->bug->resolutionAB;?></th>
</tr>
</thead>
<tbody>
@@ -58,8 +61,17 @@ $columns = count($visibleFields) + 2;
<?php
if(!$productID)
{
$product = $this->product->getByID($bugs[$bugID]->product);
$plans = $this->loadModel('productplan')->getPairs($bugs[$bugID]->product, $branch);
$plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans;
$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;
}
}
/**
* Remove designchange, newfeature, trackings from the typeList, because should be tracked in story or task.
@@ -80,6 +92,13 @@ $columns = count($visibleFields) + 2;
<?php echo html::input("titles[$bugID]", $bugs[$bugID]->title, 'class=form-control');?>
<div>
</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[$bugID]", $branches, $bugs[$bugID]->branch, "class='form-control chosen' $disabled");?>
</td>
<?php endif;?>
<td class='text-left<?php echo zget($visibleFields, 'productplan', ' hidden')?>' style='overflow:visible'><?php echo html::select("plans[$bugID]", $plans, $bugs[$bugID]->plan, "class='form-control chosen'");?></td>
<td class='text-left<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo html::select("assignedTos[$bugID]", $users, $bugs[$bugID]->assignedTo, "class='form-control chosen'");?></td>
<td class='<?php echo zget($visibleFields, 'deadline', ' hidden')?>' style='overflow:visible'><?php echo html::input("deadlines[$bugID]", $bugs[$bugID]->deadline, "class='form-control form-date'");?></td>
@@ -104,7 +123,7 @@ $columns = count($visibleFields) + 2;
<?php endforeach;?>
</tbody>
<tfoot>
<tr><td colspan='<?php echo $columns;?>' class='text-center'><?php echo html::submitButton();?></td></tr>
<tr><td colspan='<?php echo $branchProduct ? $columns : ($columns - 1);?>' class='text-center'><?php echo html::submitButton();?></td></tr>
</tfoot>
</table>
</form>