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/kanban/config.php b/module/kanban/config.php index 7928dd1b39..e5b8241338 100644 --- a/module/kanban/config.php +++ b/module/kanban/config.php @@ -17,3 +17,34 @@ $config->kanban->default->task = new stdclass(); $config->kanban->default->task->name = $lang->task->common; $config->kanban->default->task->color = '#4169e1'; $config->kanban->default->task->order = '15'; + +$config->kanban->column = new stdclass(); +$config->kanban->column->status['story']['backlog'] = 'active'; +$config->kanban->column->status['story']['developing'] = 'active'; +$config->kanban->column->status['story']['developed'] = 'active'; +$config->kanban->column->status['story']['testing'] = 'active'; +$config->kanban->column->status['story']['tested'] = 'active'; +$config->kanban->column->status['story']['verified'] = 'active'; +$config->kanban->column->status['story']['released'] = 'active'; +$config->kanban->column->status['story']['closed'] = 'closed'; + +$config->kanban->column->status['bug']['unconfirmed'] = 'active'; +$config->kanban->column->status['bug']['confirmed'] = 'active'; +$config->kanban->column->status['bug']['fixed'] = 'resolved'; +$config->kanban->column->status['bug']['closed'] = 'closed'; + +$config->kanban->column->status['task']['developing'] = 'doing'; +$config->kanban->column->status['task']['developed'] = 'done'; +$config->kanban->column->status['task']['wait'] = 'wait'; +$config->kanban->column->status['task']['pause'] = 'pause'; +$config->kanban->column->status['task']['canceled'] = 'canceled'; +$config->kanban->column->status['task']['closed'] = 'closed'; + +$config->kanban->column->stage['story']['backlog'] = 'active'; +$config->kanban->column->stage['story']['developing'] = 'developing'; +$config->kanban->column->stage['story']['developed'] = 'developed'; +$config->kanban->column->stage['story']['testing'] = 'testing'; +$config->kanban->column->stage['story']['tested'] = 'tested'; +$config->kanban->column->stage['story']['verified'] = 'verified'; +$config->kanban->column->stage['story']['released'] = 'released'; +$config->kanban->column->stage['story']['closed'] = 'closed'; diff --git a/module/kanban/model.php b/module/kanban/model.php index 5b021797fa..0d5907c673 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -97,17 +97,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->column->status['story'][$colType]; + $storyStage = $this->config->kanban->column->stage['story'][$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 +129,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->column->status['bug'][$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 +164,16 @@ class kanbanModel extends model if(strpos(',developing,developed,', $colType) !== false) $data->parent = $devColumnID; if(strpos(',develop,', $colType) === false) { + $taskStatus = $this->config->kanban->column->status['task'][$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(); } } }