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 @@