Skip to content

Commit

Permalink
fix(central): do not show projects and tasks templates in central view
Browse files Browse the repository at this point in the history
Rom1-B authored Jan 30, 2025
1 parent ce8096d commit 53421d2
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions phpunit/functional/ProjectTaskTest.php
Original file line number Diff line number Diff line change
@@ -894,6 +894,14 @@ public function testGetActiveProjectTaskIDsForUser()

// Check if a user with a project with tasks, where the user is a member of the group and the group is a member of the team, returns an empty array if $search_in_groups is false
$this->assertEmpty(\ProjectTask::getActiveProjectTaskIDsForUser([$user->getID()], false));

// Templates should be excluded
$project = $this->updateItem(
\Project::getType(),
$project->getID(),
['is_template' => true]
);
$this->assertEmpty(\ProjectTask::getActiveProjectTaskIDsForUser([$user->getID()]));
}

public function testGetActiveProjectTaskIDsForGroup(): void
@@ -938,5 +946,13 @@ public function testGetActiveProjectTaskIDsForGroup(): void
[['id' => $project_task->getID()]],
\ProjectTask::getActiveProjectTaskIDsForGroup([$group->getID()])
);

// Templates should be excluded
$project = $this->updateItem(
\Project::getType(),
$project->getID(),
['is_template' => true]
);
$this->assertEmpty(\ProjectTask::getActiveProjectTaskIDsForGroup([$group->getID()]));
}
}
16 changes: 16 additions & 0 deletions src/ProjectTask.php
Original file line number Diff line number Diff line change
@@ -1642,9 +1642,17 @@ public static function getActiveProjectTaskIDsForGroup(array $groups_id): array
ProjectState::getTable() => 'id',
self::getTable() => 'projectstates_id'
]
],
Project::getTable() => [
'FKEY' => [
Project::getTable() => 'id',
ProjectTask::getTable() => 'projects_id'
]
]
],
'WHERE' => [
ProjectTask::getTable() . '.is_template' => false,
Project::getTable() . '.is_template' => false,
self::getTable() . '.id' => new QuerySubQuery([
'SELECT' => [
'projecttasks_id'
@@ -1707,9 +1715,17 @@ public static function getActiveProjectTaskIDsForUser(array $users_id, bool $sea
ProjectState::getTable() => 'id',
self::getTable() => 'projectstates_id'
]
],
Project::getTable() => [
'FKEY' => [
Project::getTable() => 'id',
ProjectTask::getTable() => 'projects_id'
]
]
],
'WHERE' => [
ProjectTask::getTable() . '.is_template' => false,
Project::getTable() . '.is_template' => false,
self::getTable() . '.id' => new QuerySubQuery([
'SELECT' => [
'projecttasks_id'

0 comments on commit 53421d2

Please sign in to comment.