Allow task limits to be applied per-swimlane

This commit is contained in:
Andre Nathan
2020-01-31 19:42:06 -03:00
committed by Frédéric Guillot
parent 0a6f614571
commit e59ab08af3
15 changed files with 110 additions and 16 deletions

View File

@@ -138,6 +138,24 @@ class ColumnModel extends Base
->findAll();
}
/**
* Get all columns with task count
*
* @access public
* @param integer $project_id Project id
* @return array
*/
public function getAllWithPerSwimlaneTaskCount($project_id, $swimlane_id)
{
return $this->db->table(self::TABLE)
->columns('id', 'title', 'position', 'task_limit', 'description', 'hide_in_dashboard', 'project_id', $swimlane_id.' AS swimlane_id')
->subquery("SELECT COUNT(*) FROM ".TaskModel::TABLE." WHERE column_id=".self::TABLE.".id AND swimlane_id=".$swimlane_id." AND is_active='1'", 'nb_open_tasks')
->subquery("SELECT COUNT(*) FROM ".TaskModel::TABLE." WHERE column_id=".self::TABLE.".id AND swimlane_id=".$swimlane_id." AND is_active='0'", 'nb_closed_tasks')
->eq('project_id', $project_id)
->asc('position')
->findAll();
}
/**
* Get the list of columns sorted by position [ column_id => title ]
*

View File

@@ -159,6 +159,7 @@ class ProjectDuplicationModel extends Base
'priority_default' => $project['priority_default'],
'priority_start' => $project['priority_start'],
'priority_end' => $project['priority_end'],
'per_swimlane_task_limits' => empty($project['per_swimlane_task_limits']) ? 0 : 1,
'identifier' => $identifier,
);

View File

@@ -457,6 +457,8 @@ class ProjectModel extends Base
return false;
}
$values['per_swimlane_task_limits'] = empty($values['per_swimlane_task_limits']) ? 0 : 1;
$this->helper->model->convertIntegerFields($values, array('priority_default', 'priority_start', 'priority_end'));
return $this->exists($values['id']) &&