diff --git a/module/common/lang/common.php b/module/common/lang/common.php index 137b14fb8e..57a3c16b1c 100644 --- a/module/common/lang/common.php +++ b/module/common/lang/common.php @@ -75,7 +75,6 @@ $lang->file = new stdclass(); $lang->misc = new stdclass(); $lang->acl = new stdclass(); $lang->curd = new stdclass(); -$lang->kanban = new stdclass(); $lang->projectbuild = new stdclass(); $lang->projectrelease = new stdclass(); diff --git a/module/execution/control.php b/module/execution/control.php index 11c7079776..1d33689ac7 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1841,7 +1841,11 @@ class execution extends control if(strpos($this->server->http_user_agent, 'MSIE 8.0') !== false) header("X-UA-Compatible: IE=EmulateIE7"); $kanban = $this->loadModel('kanban')->getExecutionKanban($executionID); - if(empty($kanban)) $this->kanban->createLanes($executionID); + if(empty($kanban)) + { + $this->kanban->createLanes($executionID); + $kanban = $this->kanban->getExecutionKanban($executionID); + } $this->execution->setMenu($executionID); $execution = $this->loadModel('execution')->getById($executionID); diff --git a/module/kanban/lang/en.php b/module/kanban/lang/en.php new file mode 100644 index 0000000000..091db93088 --- /dev/null +++ b/module/kanban/lang/en.php @@ -0,0 +1,35 @@ +kanban = new stdClass(); + +$lang->kanban->storyColumn = array(); +$lang->kanban->storyColumn['backlog'] = 'Backlog'; +$lang->kanban->storyColumn['ready'] = 'Ready'; +$lang->kanban->storyColumn['develop'] = 'Development'; +$lang->kanban->storyColumn['developing'] = 'Doing'; +$lang->kanban->storyColumn['developed'] = 'Done'; +$lang->kanban->storyColumn['test'] = 'Testing'; +$lang->kanban->storyColumn['testing'] = 'Doing'; +$lang->kanban->storyColumn['tested'] = 'Done'; +$lang->kanban->storyColumn['verified'] = 'Verified'; +$lang->kanban->storyColumn['released'] = 'Released'; +$lang->kanban->storyColumn['closed'] = 'Closed'; + +$lang->kanban->bugColumn = array(); +$lang->kanban->bugColumn['unconfirmed'] = 'Unconfirmed'; +$lang->kanban->bugColumn['confirmed'] = 'Confirmed'; +$lang->kanban->bugColumn['resolving'] = 'Resolving'; +$lang->kanban->bugColumn['fixing'] = 'Doing'; +$lang->kanban->bugColumn['fixed'] = 'Done'; +$lang->kanban->bugColumn['test'] = 'Test'; +$lang->kanban->bugColumn['testing'] = 'Doing'; +$lang->kanban->bugColumn['tested'] = 'Done'; +$lang->kanban->bugColumn['closed'] = 'Closed'; + +$lang->kanban->taskColumn = array(); +$lang->kanban->taskColumn['wait'] = 'Wait'; +$lang->kanban->taskColumn['develop'] = 'Develop'; +$lang->kanban->taskColumn['developing'] = 'Developing'; +$lang->kanban->taskColumn['developed'] = 'Developed'; +$lang->kanban->taskColumn['pause'] = 'Pause'; +$lang->kanban->taskColumn['canceled'] = 'Canceled'; +$lang->kanban->taskColumn['closed'] = 'Closed'; diff --git a/module/kanban/model.php b/module/kanban/model.php index 5b021797fa..97844906f5 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -35,10 +35,22 @@ class kanbanModel extends model ->andWhere('lane')->in(array_keys($lanes)) ->fetchGroup('lane', 'id'); + if($objectType == 'story' or $objectType == 'all') $stories = $this->loadModel('story')->getExecutionStories($executionID); + if($objectType == 'bug' or $objectType == 'all') $bugs = $this->loadModel('bug')->getExecutionBugs($executionID); + if($objectType == 'task' or $objectType == 'all') $tasks = $this->loadModel('execution')->getKanbanTasks($executionID, "id"); foreach($columns as $laneID => $cols) { + $laneType = $lanes[$laneID]->type; foreach($cols as $colID => $col) { + $cardIdList = array_filter(explode(',', $col->cards)); + $col->cards = array(); + foreach($cardIdList as $objectID) + { + if($laneType == 'story') $col->cards[$objectID] = zget($stories, $objectID, ''); + if($laneType == 'bug') $col->cards[$objectID] = zget($bugs, $objectID, ''); + if($laneType == 'task') $col->cards[$objectID] = zget($tasks, $objectID, ''); + } if($col->parent > 0) { $cols[$col->parent]->childs[$colID] = $col; @@ -97,17 +109,16 @@ class kanbanModel extends model $data->name = $name; $data->type = $colType; $data->cards = ''; + if(strpos(',developing,developed,', $colType) !== false) $data->parent = $devColumnID; if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID; if(strpos(',ready,develop,test,', $colType) === false) { + $storyStatus = $this->config->kanban->storyColumnStatusList[$colType]; + $storyStage = $this->config->kanban->storyColumnStageList[$colType]; foreach($objects as $storyID => $story) { - if($colType == 'backlog' and $story->status == 'active' and $story->stage == 'projected') $data->cards .= $storyID . ','; - - if($colType == 'closed' and $story->status == 'closed' and $story->stage == 'closed') $data->cards .= $storyID . ','; - - if($story->stage == $colType and strpos(',backlog,closed,', $colType) === false and $story->status == 'active') $data->cards .= $storyID . ','; + if($story->status == $storyStatus and $story->stage == $storyStage) $data->cards .= $storyID . ','; } if(!empty($data->cards)) $data->cards = ',' . $data->cards; } @@ -130,20 +141,27 @@ class kanbanModel extends model if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID; if(strpos(',resolving,fixing,test,testing,tested,', $colType) === false) { + $bugStatus = $this->config->kanban->bugColumnStatusList[$colType]; foreach($objects as $bugID => $bug) { - if($colType == 'unconfirmed' and $bug->status == 'active' and $bug->confirmed == 0) $data->cards .= $bugID . ','; - - if($colType == 'confirmed' and $bug->status == 'active' and $bug->confirmed == 1) $data->cards .= $bugID . ','; - - if($colType == 'fixed' and $bug->status == 'resolved') $data->cards .= $bugID . ','; - - if($colType == 'closed' and $bug->status == 'closed') $data->cards .= $bugID . ','; + if($colType == 'unconfirmed' and $bug->status == $bugStatus and $bug->confirmed == 0) + { + $data->cards .= $bugID . ','; + } + elseif($colType == 'confirmed' and $bug->status == $bugStatus and $bug->confirmed == 1) + { + $data->cards .= $bugID . ','; + } + elseif($bug->status == $bugStatus) + { + $data->cards .= $bugID . ','; + } } - $this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec(); - if($colType == 'resolving') $resolvingColumnID = $this->dao->lastInsertId(); - if($colType == 'test') $testColumnID = $this->dao->lastInsertId(); + if(!empty($data->cards)) $data->cards = ',' . $data->cards; } + $this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec(); + if($colType == 'resolving') $resolvingColumnID = $this->dao->lastInsertId(); + if($colType == 'test') $testColumnID = $this->dao->lastInsertId(); } } elseif($type == 'task') @@ -158,18 +176,16 @@ class kanbanModel extends model if(strpos(',developing,developed,', $colType) !== false) $data->parent = $devColumnID; if(strpos(',develop,', $colType) === false) { + $taskStatus = $this->config->kanban->taskColumnStatusList[$colType]; foreach($objects as $taskID => $task) { - if($colType == 'developing' and $task->status == 'doing') $data->cards .= $taskID . ','; + if($task->status == $taskStatus) $data->cards .= $taskID . ','; - if($colType == 'developed' and $task->status == 'done') $data->cards .= $taskID . ','; - - if(strpos(',wait,pause,canceled,closed,', $colType) !== false and $task->status == $colType) $data->cards .= $taskID . ','; } - - $this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec(); - if($colType == 'develop') $devColumnID = $this->dao->lastInsertId(); + if(!empty($data->cards)) $data->cards = ',' . $data->cards; } + $this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec(); + if($colType == 'develop') $devColumnID = $this->dao->lastInsertId(); } } }