diff --git a/module/bug/control.php b/module/bug/control.php index 49b58b80a7..f4045ed16a 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -410,11 +410,12 @@ class bug extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $bugID)); /* If link from no head then reload. */ - if(isset($output['executionID']) and isonlybody()) + if(isonlybody()) { - $executionID = $this->post->execution ? $this->post->execution : $output['executionID']; + $executionID = isset($output['executionID']) ? $output['executionID'] : $this->session->execution; + $executionID = $this->post->execution ? $this->post->execution : $executionID; $execution = $this->loadModel('execution')->getByID($executionID); - if($executionID == $output['executionID'] and $this->app->tab == 'execution' and $execution->type == 'kanban') + if($this->app->tab == 'execution' and $execution->type == 'kanban') { $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; diff --git a/module/execution/control.php b/module/execution/control.php index e81ff05f8b..15d6a14c4a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2271,7 +2271,6 @@ class execution extends control public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = 'default') { $this->app->loadLang('bug'); - $this->loadModel('story'); if(empty($groupBy)) $groupBy = 'default'; @@ -2345,7 +2344,6 @@ class execution extends control $this->view->kanbanData = $kanbanData; $this->view->executionActions = $executionActions; $this->view->kanban = $this->lang->execution->kanban; - $this->view->reviewStoryParis = $this->story->getExecutionStoryPairs($execution->id, 0, 'all', 0, 'full', 'review'); $this->display(); } @@ -2374,7 +2372,6 @@ class execution extends control /* Load language. */ $this->app->loadLang('task'); $this->app->loadLang('bug'); - $this->loadModel('story'); $this->loadModel('kanban'); /* Compatibility IE8. */ @@ -2435,7 +2432,6 @@ class execution extends control $this->view->groupBy = $groupBy; $this->view->canBeChanged = $canBeChanged; $this->view->userList = $userList; - $this->view->reviewStoryParis = $this->story->getExecutionStoryPairs($execution->id, 0, 'all', 0, 'full', 'review'); $this->display(); } diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 079b48cd71..3c48a056e5 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -1092,28 +1092,29 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car } else { - if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined') + if(toColType == 'ready') { - bootbox.alert(executionLang.storyDragError); - return false; + $.get(createLink('story', 'ajaxGetInfo', "storyID=" + cardID), function(data) + { + if(data) + { + data = $.parseJSON(data); + if(data.status == 'draft' || data.status == 'changed') + { + bootbox.alert(executionLang.storyDragError); + } + else + { + ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID, regionID); + } + } + }); + } + else + { + ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID, regionID); } - var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID+ '&orderBy=' + orderBy ); - $.ajax( - { - method: 'post', - dataType: 'json', - url: link, - success: function(data) - { - data = groupBy == 'default' ? data[regionID] : data[groupBy]; - updateRegion(regionID, data); - }, - error: function(xhr, status, error) - { - showErrorMessager(error || lang.timeout); - } - }); } } @@ -1124,6 +1125,38 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car } } +/** + * AJAX: move card. + * + * @param int $objectID + * @param int $fromColID + * @param int $toColID + * @param int $fromLaneID + * @param int $toLaneID + * @param int $regionID + * @access public + * @return void + */ +function ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID, regionID) +{ + var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID+ '&orderBy=' + orderBy ); + $.ajax( + { + method: 'post', + dataType: 'json', + url: link, + success: function(data) + { + data = groupBy == 'default' ? data[regionID] : data[groupBy]; + updateRegion(regionID, data); + }, + error: function(xhr, status, error) + { + showErrorMessager(error || lang.timeout); + } + }); +} + /** * Delete a card. * diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 4b402c6b02..2e5b48c0c7 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -774,28 +774,28 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car } else { - if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined') + if(toColType == 'ready') { - bootbox.alert(executionLang.storyDragError); - return false; - } - - var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy); - $.get(link, function(data) - { - if(data) + $.get(createLink('story', 'ajaxGetInfo', "storyID=" + cardID), function(data) { - kanbanGroup = $.parseJSON(data); - if(groupBy == 'default') + if(data) { - updateKanban('story', kanbanGroup.story); + data = $.parseJSON(data); + if(data.status == 'draft' || data.status == 'changed') + { + bootbox.alert(executionLang.storyDragError); + } + else + { + ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID); + } } - else - { - updateKanban(browseType, kanbanGroup[groupBy]); - } - } - }); + }); + } + else + { + ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID); + } } } @@ -806,6 +806,37 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car } } +/** + * AJAX: move card. + * + * @param int $objectID + * @param int $fromColID + * @param int $toColID + * @param int $fromLaneID + * @param int $toLaneID + * @access public + * @return void + */ +function ajaxMoveCard(objectID, fromColID, toColID, fromLaneID, toLaneID) +{ + var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy); + $.get(link, function(data) + { + if(data) + { + kanbanGroup = $.parseJSON(data); + if(groupBy == 'default') + { + updateKanban('story', kanbanGroup.story); + } + else + { + updateKanban(browseType, kanbanGroup[groupBy]); + } + } + }); +} + /** * Handle drop task. * diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index df3d0fa098..f7855a1d88 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -53,7 +53,6 @@ js::set('projectID', $projectID); js::set('vision', $this->config->vision); js::set('productCount', count($productNames)); js::set('executionID', $execution->id); -js::set('reviewStoryParis', $reviewStoryParis); js::set('needLinkProducts', $lang->execution->needLinkProducts); js::set('lastUpdateData', ''); js::set('rdSearchValue', ''); diff --git a/module/execution/view/taskkanban.html.php b/module/execution/view/taskkanban.html.php index eb3eb87cf8..cee060ec2b 100644 --- a/module/execution/view/taskkanban.html.php +++ b/module/execution/view/taskkanban.html.php @@ -218,7 +218,6 @@ js::set('priv', fluidBoard);?> displayCards);?> - execution->needLinkProducts);?> hourUnit);?> diff --git a/module/story/control.php b/module/story/control.php index df602d5d68..8c192953c8 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -190,7 +190,24 @@ class story extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $storyID)); /* If link from no head then reload. */ - if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + if(isonlybody()) + { + $execution = $this->execution->getByID($this->session->execution); + if($this->app->tab == 'execution' and $execution->type == 'kanban') + { + $execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all'; + $execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default'; + $rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : ''; + $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $execLaneType, 'id_desc', 0, $execGroupBy, $rdSearchValue); + $kanbanData = json_encode($kanbanData); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.updateKanban($kanbanData, 0)")); + } + else + { + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + } if($this->post->newStory) { @@ -2193,6 +2210,7 @@ class story extends control $storyInfo['estimate'] = $story->estimate; $storyInfo['pri'] = $story->pri; $storyInfo['spec'] = html_entity_decode($story->spec, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8'); + $storyInfo['status'] = $story->status; echo json_encode($storyInfo); }