diff --git a/module/bug/control.php b/module/bug/control.php index 5b4f303c6b..3844061cd9 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -753,6 +753,18 @@ class bug extends control $projectID = $this->lang->navGroup->bug == 'project' ? $this->session->project : (isset($execution) ? $execution->project : 0); + /* Get branches. */ + if($executionID) + { + $productBranches = $product->type != 'normal' ? $this->execution->getBranchByProduct($productID, $executionID) : array(); + $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array(); + $branch = key($branches); + } + else + { + $branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array(); + } + $this->view->customFields = $customFields; $this->view->showFields = $showFields; @@ -771,7 +783,7 @@ class bug extends control $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch === 'all' ? 0 : $branch); $this->view->moduleID = $moduleID; $this->view->branch = $branch; - $this->view->branches = $this->loadModel('branch')->getPairs($productID, 'active'); + $this->view->branches = $branches; $this->display(); } diff --git a/module/execution/control.php b/module/execution/control.php index f54cc6c875..ec7ffd8eab 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2055,12 +2055,15 @@ class execution extends control $productID = 0; $branchID = 0; $products = $this->loadModel('product')->getProducts($executionID); + $productNames = array(); if($products) { $productID = key($products); $branches = $this->loadModel('branch')->getPairs($productID, '', $executionID); if($branches) $branchID = key($branches); } + foreach($products as $product) $productNames[$product->id] = $product->name; + $plans = $this->execution->getPlans($products, 'skipParent', $executionID); $allPlans = array('' => ''); @@ -2073,11 +2076,14 @@ class execution extends control $this->view->users = $users; $this->view->regions = $kanbanData; $this->view->execution = $execution; + $this->view->executionID = $executionID; $this->view->userList = $userList; $this->view->browseType = $browseType; $this->view->orderBy = $orderBy; $this->view->groupBy = $groupBy; $this->view->productID = $productID; + $this->view->productNames = $productNames; + $this->view->productNum = count($products); $this->view->branchID = $branchID; $this->view->projectID = $this->loadModel('task')->getProjectID($execution->id); $this->view->allPlans = $allPlans; @@ -2130,10 +2136,11 @@ class execution extends control $canBeChanged = common::canModify('execution', $execution); /* Get execution's product. */ - $productID = 0; - $products = $this->loadModel('product')->getProducts($executionID); - foreach($products as $product) $productNames[$product->id] = $product->name; + $productID = 0; + $productNames = array(); + $products = $this->loadModel('product')->getProducts($executionID); if($products) $productID = key($products); + foreach($products as $product) $productNames[$product->id] = $product->name; $plans = $this->execution->getPlans($products); $allPlans = array('' => ''); diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 64a60d76b1..f9ebc24b0c 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -270,7 +270,11 @@ function createColumnCreateMenu(options) else if(col.type == 'unconfirmed') { if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=laneID=' + laneID + ',columnID=' + col.id + ',executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canBatchCreateBug) items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); + if(priv.canBatchCreateBug) + { + if(productNum > 1) items.push({label: bugLang.batchCreate, url: '#batchCreateBug', 'attrs' : {'data-toggle': 'modal'}}); + else items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=&laneID=' + laneID + '&columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); + } } else if(col.type == 'wait') { @@ -1236,6 +1240,16 @@ $(function() } }); + $('#product').change(function() + { + var product = $('#product').val(); + if(product) + { + var link = createLink('bug', 'batchCreate', 'productID=' + product + '&branch=&executionID=' + executionID, '', true); + $('#batchCreateBugButton').attr('href', link); + } + }); + $(document).on('click', '#splitTable .btn-plus', function() { var tr = $(this).closest('tr'); diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index a506c790ea..d10800f92b 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -805,8 +805,8 @@ function createColumnCreateMenu(options) if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '80%'}}); if(priv.canBatchCreateBug) { - if(productNum == 1) items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&moduleID=0&executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '90%'}}); if(productNum > 1) items.push({label: bugLang.batchCreate, url: '#batchCreateBug', 'attrs' : {'data-toggle': 'modal'}}); + else items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&moduleID=0&executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '90%'}}); } } else diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index 03c044b153..639849fd79 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -43,11 +43,13 @@ js::set('noAssigned', $lang->kanbancard->noAssigned); js::set('users', $users); js::set('entertime', time()); js::set('displayCards', $execution->displayCards); +js::set('productNum', $productNum); js::set('fluidBoard', $execution->fluidBoard); js::set('colorListLang', $lang->kanbancard->colorList); js::set('colorList', $this->config->kanban->cardColorList); js::set('projectID', $projectID); js::set('vision', $this->config->vision); +js::set('branchID', $branchID); $canSortRegion = commonModel::hasPriv('kanban', 'sortRegion') && count($regions) > 1; $canEditRegion = commonModel::hasPriv('kanban', 'editRegion'); @@ -168,7 +170,13 @@ js::set('hasTaskButton', $hasTaskButton); ' . html::a('#linkStoryByPlan', $lang->execution->linkStoryByPlan, '', 'data-toggle="modal"') . '';?> ';?> ' . html::a(helper::createLink('bug', 'create', "productID=$productID&branch=0&extra=executionID=$execution->id", '', true), $lang->bug->create, '', "class='iframe'") . '';?> - ' . html::a(helper::createLink('bug', 'batchCreate', "productID=$productID&branch=$branchID&executionID=$execution->id", '', true), $lang->bug->batchCreate, '', "class='iframe'") . '';?> + ' . html::a(helper::createLink('bug', 'batchCreate', "productID=$productID&branch=$branchID&executionID=$execution->id", '', true), $lang->bug->batchCreate, '', "class='iframe'") . ''; + if($productNum > 1) $batchCreateBugLink = '
  • ' . html::a('#batchCreateBug', $lang->bug->batchCreate, '', "data-toggle='modal'") . '
  • '; + echo $batchCreateBugLink; + }?> ';?> ' . html::a(helper::createLink('task', 'create', "execution=$execution->id", '', true), $lang->task->create, '', "class='iframe'") . '';?> ' . html::a(helper::createLink('execution', 'importBug', "executionID=$execution->id", '', true), $lang->execution->importBug, '', "class='iframe'") . '';?> @@ -227,4 +235,20 @@ js::set('hasTaskButton', $hasTaskButton); + diff --git a/module/execution/view/taskkanban.html.php b/module/execution/view/taskkanban.html.php index c3384d74c5..da27ef926f 100644 --- a/module/execution/view/taskkanban.html.php +++ b/module/execution/view/taskkanban.html.php @@ -148,7 +148,7 @@