From cfae0a2eff9740b2e3bfda10e4d115342aeb6630 Mon Sep 17 00:00:00 2001 From: daitingting Date: Thu, 27 Apr 2017 13:25:29 +0800 Subject: [PATCH] * Batch edit branch of bug. --- module/bug/config.php | 2 +- module/bug/control.php | 20 ++++++++++++++++++-- module/bug/model.php | 3 +++ module/bug/view/batchedit.html.php | 25 ++++++++++++++++++++++--- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/module/bug/config.php b/module/bug/config.php index 7b21db695a..c450bb1715 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -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'); diff --git a/module/bug/control.php b/module/bug/control.php index 01cde93b24..69cf045934 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -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; diff --git a/module/bug/model.php b/module/bug/model.php index 42b9bda6f6..4a4fd2e217 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -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]; diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 132308131d..fc839a39ab 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -42,6 +42,9 @@ $columns = count($visibleFields) + 2; '>bug->severityAB;?> '>bug->pri;?> = 10) echo "class='w-150px'"?>>bug->title;?> + + '>bug->branch;?> + '>bug->productplan;?> '>bug->assignedTo;?> '>bug->deadline;?> @@ -49,8 +52,8 @@ $columns = count($visibleFields) + 2; '>bug->os;?> '>bug->browser;?> '>bug->keywords;?> - '>bug->resolvedByAB;?> - '>bug->resolutionAB;?> + '>bug->resolvedByAB;?> + '>bug->resolutionAB;?> @@ -58,8 +61,17 @@ $columns = count($visibleFields) + 2; 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; title, 'class=form-control');?>
+ + ' style='overflow:visible'> + id;?> + type == 'normal') ? "disabled='disabled'" : '';?> + branch, "class='form-control chosen' $disabled");?> + + ' style='overflow:visible'>plan, "class='form-control chosen'");?> ' style='overflow:visible'>assignedTo, "class='form-control chosen'");?> ' style='overflow:visible'>deadline, "class='form-control form-date'");?> @@ -104,7 +123,7 @@ $columns = count($visibleFields) + 2; - +