Merge branch 'sgm_kanban' into 'kanban'

Sgm kanban

See merge request easycorp/zentaopms!1378
This commit is contained in:
李玉春
2022-01-13 05:04:17 +00:00
2 changed files with 42 additions and 33 deletions
+1
View File
@@ -13,5 +13,6 @@ ALTER TABLE `zt_kanban` ADD `displayCards` smallint(6) NOT NULL default '0' AFTE
ALTER TABLE `zt_project` ADD `displayCards` smallint(6) NOT NULL default '0' AFTER `order`;
ALTER TABLE `zt_kanbancard` DROP COLUMN `lane`;
ALTER TABLE `zt_kanbancard` DROP COLUMN `column`;
ALTER TABLE `zt_kanbancolumn` DROP `lane`;
UPDATE `zt_grouppriv` SET `method` = 'taskKanban' WHERE `module` = 'execution' AND `method` = 'kanban';
+41 -33
View File
@@ -1582,46 +1582,31 @@ class kanbanModel extends model
}
/**
* createColumn
* Create execution columns.
*
* @param int $laneID
* @param string $type story|bug|task
* @param int $executionID
* @param string $groupBy
* @param string $groupValue
* @param int|array $laneID
* @param string $type story|bug|task
* @param int $executionID
* @param string $groupBy
* @param string $groupValue
* @access public
* @return void
*/
public function createExecutionColumns($laneID, $type, $executionID, $groupBy = '', $groupValue = '')
public function createExecutionColumns($laneID, $type, $executionID)
{
$objects = array();
if($type == 'story') $objects = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't2.id_desc');
if($type == 'bug') $objects = $this->loadModel('bug')->getExecutionBugs($executionID);
if($type == 'task') $objects = $this->loadModel('execution')->getKanbanTasks($executionID);
if(!empty($groupBy))
{
foreach($objects as $objectID => $object)
{
if($object->$groupBy != $groupValue) unset($objects[$objectID]);
}
}
$devColumnID = $testColumnID = $resolvingColumnID = 0;
if($type == 'story')
{
foreach($this->lang->kanban->storyColumn as $colType => $name)
{
$data = new stdClass();
$data->lane = $laneID;
$data->name = $name;
$data->color = '#333';
$data->type = $colType;
if(strpos(',developing,developed,', $colType) !== false) $data->parent = $devColumnID;
if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID;
if(strpos(',develop,test,', $colType) !== false) $data->parent = -1;
if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID;
if(strpos(',develop,test,', $colType) !== false) $data->parent = -1;
$this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec();
@@ -1629,7 +1614,14 @@ class kanbanModel extends model
if($colType == 'develop') $devColumnID = $colID;
if($colType == 'test') $testColumnID = $colID;
$this->addKanbanCell($executionID, $laneID, $colID, 'story');
if(is_array($laneID))
{
foreach($laneID as $id) $this->addKanbanCell($executionID, $id, $colID, 'story');
}
else
{
$this->addKanbanCell($executionID, $laneID, $colID, 'story');
}
}
}
elseif($type == 'bug')
@@ -1637,11 +1629,10 @@ class kanbanModel extends model
foreach($this->lang->kanban->bugColumn as $colType => $name)
{
$data = new stdClass();
$data->lane = $laneID;
$data->name = $name;
$data->color = '#333';
$data->type = $colType;
if(strpos(',fixing,fixed,', $colType) !== false) $data->parent = $resolvingColumnID;
if(strpos(',fixing,fixed,', $colType) !== false) $data->parent = $resolvingColumnID;
if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID;
if(strpos(',resolving,test,', $colType) !== false) $data->parent = -1;
@@ -1651,7 +1642,14 @@ class kanbanModel extends model
if($colType == 'resolving') $resolvingColumnID = $colID;
if($colType == 'test') $testColumnID = $colID;
$this->addKanbanCell($executionID, $laneID, $colID, 'bug');
if(is_array($laneID))
{
foreach($laneID as $id) $this->addKanbanCell($executionID, $id, $colID, 'bug');
}
else
{
$this->addKanbanCell($executionID, $laneID, $colID, 'bug');
}
}
}
elseif($type == 'task')
@@ -1659,7 +1657,6 @@ class kanbanModel extends model
foreach($this->lang->kanban->taskColumn as $colType => $name)
{
$data = new stdClass();
$data->lane = $laneID;
$data->name = $name;
$data->color = '#333';
$data->type = $colType;
@@ -1670,7 +1667,15 @@ class kanbanModel extends model
$colID = $this->dao->lastInsertId();
if($colType == 'develop') $devColumnID = $colID;
$this->addKanbanCell($executionID, $laneID, $colID, 'task');
if(is_array($laneID))
{
foreach($laneID as $id) $this->addKanbanCell($executionID, $id, $colID, 'task');
}
else
{
$this->addKanbanCell($executionID, $laneID, $colID, 'task');
}
}
}
}
@@ -1711,7 +1716,6 @@ class kanbanModel extends model
}
}
/**
* Create a default RD kanban.
*
@@ -2059,7 +2063,9 @@ class kanbanModel extends model
{
/* Remove lane and cloumns by laneID. */
$this->dao->delete()->from(TABLE_KANBANLANE)->where('id')->eq($laneID)->exec();
$this->dao->delete()->from(TABLE_KANBANCOLUMN)->where('lane')->eq($laneID)->exec();
$colPairs = $this->dao->select('`column`')->from(TABLE_KANBANCELL)->where('lane')->eq($laneID)->fetchPairs();
if(!empty($colPairs)) $this->dao->delete()->from(TABLE_KANBANCOLUMN)->where('id')->in($colPairs)->exec();
}
else
{
@@ -2080,6 +2086,7 @@ class kanbanModel extends model
}
/* Add new lanes by group. */
$lanePairs = array();
foreach($addGroupList as $groupKey)
{
$laneName = $this->lang->kanban->noGroup;
@@ -2102,9 +2109,10 @@ class kanbanModel extends model
$this->dao->insert(TABLE_KANBANLANE)->data($lane)->exec();
$laneID = $this->dao->lastInsertId();
$this->createExecutionColumns($laneID, $type, $executionID, $groupBy, $groupKey);
$lanePairs[$laneID] = $laneID;
}
if($lanePairs) $this->createExecutionColumns($lanePairs, $type, $executionID);
$this->resetLaneOrder($executionID, $type, $groupBy);
}