From b77489a41449f6ed4595a76e864e9729328e1a77 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 8 May 2009 16:31:11 +0000 Subject: [PATCH] New: early development of multi-company module --- htdocs/comm/action/index.php | 11 ++++++++--- htdocs/comm/action/listactions.php | 6 +++--- htdocs/comm/action/rapport/index.php | 6 +++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index b635200237b..109c9cd897b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2008 Regis Houssin + * Copyright (C) 2005-2009 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 @@ -216,8 +216,12 @@ $sql.= ' '.$db->pdate('a.datea2').' as datea2,'; $sql.= ' a.percent,'; $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' ca.code'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'c_actioncomm as ca'; +$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; +$sql.= ', '.MAIN_DB_PREFIX.'c_actioncomm as ca'; +$sql.= ', '.MAIN_DB_PREFIX.'user as u'; $sql.= ' WHERE a.fk_action = ca.id'; +$sql.= ' AND a.fk_user_author = u.rowid'; +$sql.= ' AND u.entity = '.$conf->entity; if ($_GET["action"] == 'show_day') { $sql.= ' AND datep BETWEEN '.$db->idate(dol_mktime(0,0,0,$month,$_GET["day"],$year)); @@ -312,6 +316,7 @@ if ($showbirthday) $sql = 'SELECT sp.rowid, sp.name, sp.firstname, sp.birthday'; $sql.= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp'; $sql.= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.$user->id.'))'; + $sql.= ' AND sp.entity = '.$conf->entity; if ($_GET["action"] == 'show_day') { $sql.= ' AND MONTH(birthday) = '.$month; @@ -322,7 +327,7 @@ if ($showbirthday) $sql.= ' AND MONTH(birthday) = '.$month; } // Sort on date - $sql .= ' ORDER BY birthday'; + $sql.= ' ORDER BY birthday'; //print $sql; $resql=$db->query($sql); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index f42da946959..6b886b2f597 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2009 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 @@ -133,8 +133,8 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0) if ($filterd > 0) $sql.= ($filtera>0||$filtert>0?" OR ":"")." a.fk_user_done = ".$filterd; $sql.= ")"; } -$sql .= " ORDER BY ".$sortfield." ".$sortorder; -$sql .= $db->plimit( $limit + 1, $offset); +$sql.= " ORDER BY ".$sortfield." ".$sortorder; +$sql.= $db->plimit( $limit + 1, $offset); //print $sql; dol_syslog("comm/action/listactions.php sql=".$sql); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 55dab8162ba..8d86ef0365b 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2005-2009 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 @@ -66,7 +67,10 @@ $sql = "SELECT count(*) as cc, date_format(a.datep, '%m/%Y') as df"; $sql.= ", date_format(a.datep, '%m') as month"; $sql.= ", date_format(a.datep, '%Y') as year"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; -$sql.= " WHERE percent = 100"; +$sql.= ", ".MAIN_DB_PREFIX."user as u"; +$sql.= " WHERE a.fk_user_author = u.rowid"; +$sql.= " AND u.entity = ".$conf->entity; +$sql.= " AND percent = 100"; $sql.= " GROUP BY date_format(a.datep, '%m/%Y') "; $sql.= " ORDER BY a.datep DESC"; $sql.= $db->plimit($limit+1,$offset);