Skip to content

Commit

Permalink
Return leave projects when fetching users projects
Browse files Browse the repository at this point in the history
People should be able to log time to projects they are assigned to
and also to any project with the type leave.
  • Loading branch information
anarute committed Jan 19, 2024
1 parent 3dfd471 commit 73c090d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion model/dao/ProjectDAO/PostgreSQLProjectDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ public function getAll($userLogin = NULL, $active = False, $orderField = 'id', $
$conditions = "TRUE";

if ($userLogin) {
$userCondition = "project.id IN (SELECT projectid FROM project_usr LEFT JOIN usr ON project_usr.usrid=usr.id " . "WHERE login=" . DBPostgres::checkStringNull( $userLogin ) . ") ";
// if filtering by user return the projects the user is assigned to but also the leave projects
// since everyone should be able to use them even if not assigned to
$userCondition = "(project.id IN (SELECT projectid FROM project_usr LEFT JOIN usr ON project_usr.usrid=usr.id " . "WHERE login=" . DBPostgres::checkStringNull( $userLogin ) . ") ";
$userCondition .= " OR project.type = 'leave') ";
}
if ($active) {
$activeCondition = "activation='True'";
Expand Down

0 comments on commit 73c090d

Please sign in to comment.