From 97f15ddec4818c127adb0cec1cb3d0119ad51b6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Apr 2011 23:34:29 +0000 Subject: [PATCH] Fix: Bad filter --- htdocs/projet/index.php | 2 +- htdocs/projet/liste.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 8cb41a7c850..5284b87c094 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -85,7 +85,7 @@ $sql.= ", s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " WHERE p.entity = ".$conf->entity; -if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; +if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " GROUP BY s.nom, s.rowid"; diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index 65fbd0df786..1b79cbbe445 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -67,7 +67,7 @@ llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES: $projectstatic = new Project($db); $socstatic = new Societe($db); -$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid); +$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1,$socid); $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat"; $sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end"; @@ -75,7 +75,7 @@ $sql.= ", s.nom, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " WHERE p.entity = ".$conf->entity; -if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; +if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";