Do not show inactive projects info on the dashboard and update picodb (merge #546)
This commit is contained in:
@@ -31,7 +31,7 @@ class App extends Base
|
||||
{
|
||||
$status = array(SubTaskModel::STATUS_TODO, SubTaskModel::STATUS_INPROGRESS);
|
||||
$user_id = $this->userSession->getId();
|
||||
$projects = $this->projectPermission->getMemberProjects($user_id);
|
||||
$projects = $this->projectPermission->getActiveMemberProjects($user_id);
|
||||
$project_ids = array_keys($projects);
|
||||
|
||||
$task_paginator = $this->paginator
|
||||
|
||||
@@ -418,7 +418,7 @@ class Task extends Base
|
||||
$task = $this->getTask();
|
||||
$values = $task;
|
||||
$errors = array();
|
||||
$projects_list = $this->projectPermission->getMemberProjects($this->userSession->getId());
|
||||
$projects_list = $this->projectPermission->getActiveMemberProjects($this->userSession->getId());
|
||||
|
||||
unset($projects_list[$task['project_id']]);
|
||||
|
||||
@@ -457,7 +457,7 @@ class Task extends Base
|
||||
$task = $this->getTask();
|
||||
$values = $task;
|
||||
$errors = array();
|
||||
$projects_list = $this->projectPermission->getMemberProjects($this->userSession->getId());
|
||||
$projects_list = $this->projectPermission->getActiveMemberProjects($this->userSession->getId());
|
||||
|
||||
unset($projects_list[$task['project_id']]);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class Board extends Base
|
||||
*/
|
||||
public function moveDown($project_id, $column_id)
|
||||
{
|
||||
$columns = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'position');
|
||||
$columns = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'position');
|
||||
$positions = array_flip($columns);
|
||||
|
||||
if (isset($columns[$column_id]) && $columns[$column_id] < count($columns)) {
|
||||
@@ -207,7 +207,7 @@ class Board extends Base
|
||||
*/
|
||||
public function moveUp($project_id, $column_id)
|
||||
{
|
||||
$columns = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'position');
|
||||
$columns = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'position');
|
||||
$positions = array_flip($columns);
|
||||
|
||||
if (isset($columns[$column_id]) && $columns[$column_id] > 1) {
|
||||
@@ -264,11 +264,11 @@ class Board extends Base
|
||||
public function getColumnStats($project_id, $prepend = false)
|
||||
{
|
||||
$listing = $this->db
|
||||
->table(Task::TABLE)
|
||||
->hashtable(Task::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', 1)
|
||||
->groupBy('column_id')
|
||||
->listing('column_id', 'COUNT(*) AS total');
|
||||
->getAll('column_id', 'COUNT(*) AS total');
|
||||
|
||||
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class Board extends Base
|
||||
*/
|
||||
public function getColumnsList($project_id, $prepend = false)
|
||||
{
|
||||
$listing = $this->db->table(self::TABLE)->eq('project_id', $project_id)->asc('position')->listing('id', 'title');
|
||||
$listing = $this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->asc('position')->getAll('id', 'title');
|
||||
return $prepend ? array(-1 => t('All columns')) + $listing : $listing;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ class Category extends Base
|
||||
*/
|
||||
public function getList($project_id, $prepend_none = true, $prepend_all = false)
|
||||
{
|
||||
$listing = $this->db->table(self::TABLE)
|
||||
$listing = $this->db->hashtable(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->asc('name')
|
||||
->listing('id', 'name');
|
||||
->getAll('id', 'name');
|
||||
|
||||
$prepend = array();
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class Config extends Base
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
return $this->db->table(self::TABLE)->listing('option', 'value');
|
||||
return $this->db->hashtable(self::TABLE)->getAll('option', 'value');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,10 +128,10 @@ class Project extends Base
|
||||
public function getList($prepend = true)
|
||||
{
|
||||
if ($prepend) {
|
||||
return array(t('None')) + $this->db->table(self::TABLE)->asc('name')->listing('id', 'name');
|
||||
return array(t('None')) + $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name');
|
||||
}
|
||||
|
||||
return $this->db->table(self::TABLE)->asc('name')->listing('id', 'name');
|
||||
return $this->db->hashtable(self::TABLE)->asc('name')->getAll('id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,10 +160,10 @@ class Project extends Base
|
||||
public function getListByStatus($status)
|
||||
{
|
||||
return $this->db
|
||||
->table(self::TABLE)
|
||||
->hashtable(self::TABLE)
|
||||
->asc('name')
|
||||
->eq('is_active', $status)
|
||||
->listing('id', 'name');
|
||||
->getAll('id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -315,10 +315,27 @@ class ProjectPermission extends Base
|
||||
public function getMemberProjects($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->table(Project::TABLE)
|
||||
->hashtable(Project::TABLE)
|
||||
->eq('user_id', $user_id)
|
||||
->join(self::TABLE, 'project_id', 'id')
|
||||
->listing('projects.id', 'name');
|
||||
->getAll('projects.id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of active projects where the user is member
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id User id
|
||||
* @return array
|
||||
*/
|
||||
public function getActiveMemberProjects($user_id)
|
||||
{
|
||||
return $this->db
|
||||
->hashtable(Project::TABLE)
|
||||
->eq('user_id', $user_id)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE)
|
||||
->join(self::TABLE, 'project_id', 'id')
|
||||
->getAll('projects.id', 'name');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,6 +101,7 @@ class SubTask extends Base
|
||||
Project::TABLE.'.name AS project_name'
|
||||
)
|
||||
->eq('user_id', $user_id)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE)
|
||||
->in(SubTask::TABLE.'.status', $status)
|
||||
->join(Task::TABLE, 'id', 'task_id')
|
||||
->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
|
||||
|
||||
@@ -171,7 +171,7 @@ class Swimlane extends Base
|
||||
|
||||
$swimlanes = array_merge(
|
||||
$swimlanes,
|
||||
$this->db->table(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->listing('id', 'name')
|
||||
$this->db->hashtable(self::TABLE)->eq('project_id', $project_id)->orderBy('name', 'asc')->getAll('id', 'name')
|
||||
);
|
||||
|
||||
return $prepend ? array(-1 => t('All swimlanes')) + $swimlanes : $swimlanes;
|
||||
@@ -354,11 +354,11 @@ class Swimlane extends Base
|
||||
*/
|
||||
public function moveDown($project_id, $swimlane_id)
|
||||
{
|
||||
$swimlanes = $this->db->table(self::TABLE)
|
||||
$swimlanes = $this->db->hashtable(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', self::ACTIVE)
|
||||
->asc('position')
|
||||
->listing('id', 'position');
|
||||
->getAll('id', 'position');
|
||||
|
||||
$positions = array_flip($swimlanes);
|
||||
|
||||
@@ -388,11 +388,11 @@ class Swimlane extends Base
|
||||
*/
|
||||
public function moveUp($project_id, $swimlane_id)
|
||||
{
|
||||
$swimlanes = $this->db->table(self::TABLE)
|
||||
$swimlanes = $this->db->hashtable(self::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', self::ACTIVE)
|
||||
->asc('position')
|
||||
->listing('id', 'position');
|
||||
->getAll('id', 'position');
|
||||
|
||||
$positions = array_flip($swimlanes);
|
||||
|
||||
|
||||
@@ -62,8 +62,9 @@ class TaskFinder extends Base
|
||||
'projects.name AS project_name'
|
||||
)
|
||||
->join(Project::TABLE, 'id', 'project_id')
|
||||
->eq('tasks.owner_id', $user_id)
|
||||
->eq('tasks.is_active', Task::STATUS_OPEN);
|
||||
->eq(Task::TABLE.'.owner_id', $user_id)
|
||||
->eq(Task::TABLE.'.is_active', Task::STATUS_OPEN)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user