diff --git a/module/bug/control.php b/module/bug/control.php index 099c5d7da1..788af51d62 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1013,12 +1013,38 @@ class bug extends control $plans = $this->loadModel('productplan')->getPairs($productID, $branch); $plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans; + /* Set branches and modules. */ + $branches = array(); + $modules = array(); + if($product->type != 'normal') + { + $branches = $this->loadModel('branch')->getPairs($productID); + if($branch === 'all') + { + $modules[0] = $this->tree->getOptionMenu($productID, 'bug', 0, 0); + foreach($branches as $branchID => $branchName) + { + $modules[$branchID] = $this->tree->getOptionMenu($productID, 'bug', 0, $branchID); + } + } + else + { + $modules[$branch] = $this->tree->getOptionMenu($productID, 'bug', 0, $branch); + } + } + else + { + $modules[0] = $this->tree->getOptionMenu($productID, 'bug', 0, 0); + } + /* Set product menu. */ $this->qa->setMenu($this->products, $productID, $branch); + $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); + $this->view->branches = $branches; + $this->view->modules = $modules; } /* The bugs of my. */ else diff --git a/module/bug/js/batchcreate.js b/module/bug/js/batchcreate.js index a7ae9e9e8a..107911a375 100644 --- a/module/bug/js/batchcreate.js +++ b/module/bug/js/batchcreate.js @@ -6,53 +6,6 @@ $(function() if($titleCol.width() < 150) $titleCol.width(150); }) -/** - * Set branch related. - * - * @param int $branchID - * @param int $productID - * @param int $num - * @access public - * @return void - */ -function setBranchRelated(branchID, productID, num) -{ - moduleLink = createLink('tree', 'ajaxGetModules', 'productID=' + productID + '&viewType=bug&branch=' + branchID + '&num=' + num); - $.get(moduleLink, function(modules) - { - if(!modules) modules = ''; - $('#modules' + num).replaceWith(modules); - $("#modules" + num + "_chosen").remove(); - $("#modules" + num).next('.picker').remove(); - $("#modules" + num).chosen(); - }); - - executionLink = createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&projectID=0&branch=' + branchID + '&num=' + num); - $.get(executionLink, function(executions) - { - if(!executions) executions = ''; - $('#executions' + num).replaceWith(executions); - $("#executions" + num + "_chosen").remove(); - $("#executions" + num).next('.picker').remove(); - $("#executions" + num).chosen(); - }); - - buildLink = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branchID + "&index=" + num); - - /* If the branch of the current row is inconsistent with the one below, clear the module and execution of the nex row. */ - var nextBranchID = $('#branch' + (num + 1)).val(); - if(nextBranchID != branchID) - { - $('#modules' + (num + 1)).find("option[value='ditto']").remove(); - $('#modules' + (num + 1)).trigger("chosen:updated"); - - $('#executions' + (num + 1)).find("option[value='ditto']").remove(); - $('#executions' + (num + 1)).trigger("chosen:updated"); - } - - setOpenedBuilds(buildLink, num); -} - /** * Set opened builds. * diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 232bdc991e..6d798c1c4c 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -612,3 +612,52 @@ function notice() } } } + +/** + * Set branch related. + * + * @param int $branchID + * @param int $productID + * @param int $num + * @access public + * @return void + */ +function setBranchRelated(branchID, productID, num) +{ + moduleLink = createLink('tree', 'ajaxGetModules', 'productID=' + productID + '&viewType=bug&branch=' + branchID + '&num=' + num); + $.get(moduleLink, function(modules) + { + if(!modules) modules = ''; + $('#modules' + num).replaceWith(modules); + $("#modules" + num + "_chosen").remove(); + $("#modules" + num).next('.picker').remove(); + $("#modules" + num).chosen(); + }); + + executionLink = createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&projectID=0&branch=' + branchID + '&num=' + num); + $.get(executionLink, function(executions) + { + if(!executions) executions = ''; + $('#executions' + num).replaceWith(executions); + $("#executions" + num + "_chosen").remove(); + $("#executions" + num).next('.picker').remove(); + $("#executions" + num).chosen(); + }); + + buildLink = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + "&varName=openedBuilds&build=&branch=" + branchID + "&index=" + num); + + /* If the branch of the current row is inconsistent with the one below, clear the module and execution of the nex row. */ + if(config.currentMethod == 'batchCreate') + { + var nextBranchID = $('#branch' + (num + 1)).val(); + if(nextBranchID != branchID) + { + $('#modules' + (num + 1)).find("option[value='ditto']").remove(); + $('#modules' + (num + 1)).trigger("chosen:updated"); + + $('#executions' + (num + 1)).find("option[value='ditto']").remove(); + $('#executions' + (num + 1)).trigger("chosen:updated"); + } + setOpenedBuilds(buildLink, num); + } +} diff --git a/module/bug/model.php b/module/bug/model.php index 5489eeaf3b..a35bc19d65 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -742,6 +742,7 @@ class bugModel extends model $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->module = $data->modules[$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 86a92f7867..48b9906c41 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -51,10 +51,11 @@ '>bug->type;?> '>bug->severity;?> '>bug->pri;?> - bug->title;?> + bug->title;?> - '>bug->branch;?> + bug->branch;?> + '> bug->module;?> '>bug->productplan;?> '>bug->assignedTo;?> '>bug->deadline;?> @@ -78,14 +79,14 @@ { $product = $this->product->getByID($bug->product); - $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); - $plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans; + $bugBranch = isset($bug->branch) ? $bug->branch : 0; + $plans = $this->loadModel('productplan')->getPairs($bug->product, $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[$bugBranch] = $this->tree->getOptionMenu($bug->product, $viewType = 'case', 0, $bugBranch); } } ?> @@ -109,12 +110,13 @@
- ' style='overflow:visible'> + id;?> type == 'normal') ? "disabled='disabled'" : '';?> - branch, "class='form-control chosen' $disabled");?> + branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> + branch], $bug->module, "class='form-control chosen'");?> ' 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'");?>