diff --git a/module/bug/control.php b/module/bug/control.php index 9a7d1629a3..6fa23af097 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -684,6 +684,9 @@ class bug extends control */ public function batchCreate($productID, $branch = '', $executionID = 0, $moduleID = 0, $extra = '') { + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(!empty($_POST)) { $actions = $this->bug->batchCreate($productID, $branch, $extra); @@ -697,9 +700,6 @@ class bug extends control setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); - $extra = str_replace(array(',', ' '), array('&', ''), $extra); - parse_str($extra, $output); - /* If link from no head then reload. */ if(isonlybody() and $executionID) { @@ -731,6 +731,20 @@ class bug extends control $builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty', $executionID, 'execution'); $stories = $this->story->getExecutionStoryPairs($executionID); $execution = $this->loadModel('execution')->getById($executionID); + if($execution->type == 'kanban') + { + $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'bug'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); + + $this->view->executionType = $execution->type; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; + } } else { diff --git a/module/bug/js/batchcreate.js b/module/bug/js/batchcreate.js index 107911a375..e2b1645d6b 100644 --- a/module/bug/js/batchcreate.js +++ b/module/bug/js/batchcreate.js @@ -38,6 +38,27 @@ function setOpenedBuilds(link, index) }); } +/** + * Set lane. + * + * @param int $regionID + * @param int $num + * @access public + * @return void + */ +function setLane(regionID, num) +{ + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=bug&field=lanes&i=' + num); + $.get(laneLink, function(lanes) + { + if(!lanes) lanes = ''; + $('#lanes' + num).replaceWith(lanes); + $("#lanes" + num + "_chosen").remove(); + $("#lanes" + num).next('.picker').remove(); + $("#lanes" + num).chosen(); + }); +} + /** * Load execution builds * diff --git a/module/bug/model.php b/module/bug/model.php index b0348f5d14..00985c85ff 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -200,6 +200,7 @@ class bugModel extends model $bug->os = $data->oses[$i]; $bug->browser = $data->browsers[$i]; $bug->keywords = $data->keywords[$i]; + $bug->laneID = $data->lanes[$i]; if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent'); @@ -236,6 +237,9 @@ class bugModel extends model /* When the bug is created by uploading an image, add the image to the step of the bug. */ foreach($bugs as $i => $bug) { + $laneID = isset($bug->laneID) ? $bug->laneID : $output['laneID']; + unset($bug->laneID); + if(!empty($data->uploadImage[$i])) { $fileName = $data->uploadImage[$i]; @@ -274,8 +278,10 @@ class bugModel extends model if($bug->execution) { - if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($bug->execution, $output['laneID'], $output['columnID'], 'bug', $bugID); - if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($bug->execution, 'bug'); + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); + $columnID = empty($columnIDByLaneID) ? $output['columnID'] : $columnIDByLaneID; + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID); + if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug'); } /* When the bug is created by uploading the image, add the image to the file of the bug. */ @@ -290,7 +296,7 @@ class bugModel extends model unset($file); } - if(dao::isError()) return print(js::error('bug#' . ($i+1) . dao::getError(true))); + if(dao::isError()) return print(js::error('bug#' . ($i) . dao::getError(true))); $actions[$bugID] = $this->action->create('bug', $bugID, 'Opened'); } diff --git a/module/bug/view/batchcreate.html.php b/module/bug/view/batchcreate.html.php index 4d1154905b..5e412be2fa 100644 --- a/module/bug/view/batchcreate.html.php +++ b/module/bug/view/batchcreate.html.php @@ -51,6 +51,10 @@ '>model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->execution;?> bug->openedBuild;?> bug->title;?> + + kanbancard->region;?> + kanbancard->lane;?> + '>bug->deadline;?> '>bug->steps;?> '>typeAB;?> @@ -74,19 +78,19 @@ $lang->bug->osList += array('ditto' => $lang->bug->ditto); $lang->bug->browserList += array('ditto' => $lang->bug->ditto); ?> - + $fileName):?> - + ' style='overflow:visible'> ' style='overflow:visible'> @@ -105,6 +109,10 @@ + + + + '> '> ' style='overflow:visible'> bug->typeList, $type, "class='form-control chosen'");?> @@ -119,7 +127,7 @@ - bug->batchCreate; $i++):?> + bug->batchCreate; $i++):?> - + ' style='overflow:visible'> ' style='overflow:visible'> @@ -148,6 +156,10 @@ + + + + '> '> ' style='overflow:visible'> bug->typeList, $type, "class='form-control chosen'");?> diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 9e59198ef2..846760f0fd 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -265,10 +265,11 @@ function createColumnMenu(options) */ function createColumnCreateMenu(options) { - var $col = options.$trigger.closest('.kanban-col'); - var col = $col.data('col'); - var items = []; - var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0; + var $col = options.$trigger.closest('.kanban-col'); + var col = $col.data('col'); + var items = []; + var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0; + var regionID = col.$kanbanData.region; if(col.type == 'backlog') { @@ -283,7 +284,7 @@ function createColumnCreateMenu(options) 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 items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); } } else if(col.type == 'wait')