From 4a87aed43ccbe85ea52e2f0ec310bd7e1ab990fb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 9 Mar 2006 13:31:02 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20permission=20"consulter=20tou?= =?UTF-8?q?s=20les=20clients"=20dans=20le=20module=20commercial,=20afin=20?= =?UTF-8?q?=20qu'un=20commercial=20puisse=20voir=20que=20les=20clients=20q?= =?UTF-8?q?ui=20lui=20sont=20affect=E9s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/projet/activity/index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index ea244d33a47..c4e99df7c7c 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005-2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,9 +62,12 @@ print ''.$langs->trans("NbOpenTasks").''; print "\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " GROUP BY p.rowid"; @@ -104,10 +108,13 @@ print 'Temps'; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; $sql .= " AND week(task_date) = ".strftime("%W",time()); $sql .= " GROUP BY p.rowid"; @@ -146,10 +153,13 @@ print 'Nb heures'; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; $sql .= " AND month(task_date) = ".strftime("%m",$now); $sql .= " GROUP BY p.rowid"; @@ -188,10 +198,13 @@ print 'Nb heures'; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; +if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; $sql .= " AND YEAR(task_date) = ".strftime("%Y",$now); $sql .= " GROUP BY p.rowid";