Merge branch 'sprint/168_tianshujie_43426' into 'sprint/168'

* Correct Kanban data.

See merge request easycorp/zentaopms!147
This commit is contained in:
李玉春
2021-10-26 06:49:35 +00:00
4 changed files with 78 additions and 24 deletions
-1
View File
@@ -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();
+5 -1
View File
@@ -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);
+35
View File
@@ -0,0 +1,35 @@
<?php
$lang->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';
+38 -22
View File
@@ -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();
}
}
}