phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [21190] Improvement: leave out inactive members 4746:


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [21190] Improvement: leave out inactive members 4746:5203
Date: Wed, 14 Apr 2010 19:13:14 +0000

Revision: 21190
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21190
Author:   sigurdne
Date:     2010-04-14 19:13:14 +0000 (Wed, 14 Apr 2010)
Log Message:
-----------
Improvement: leave out inactive members 4746:5203

Modified Paths:
--------------
    
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php
    people/sigurdne/modules/phpgwapi/trunk/inc/class.acl.inc.php

Modified: 
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php
===================================================================
--- 
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php  
    2010-04-14 19:11:02 UTC (rev 21189)
+++ 
people/sigurdne/modules/phpgwapi/trunk/inc/accounts/class.accounts_sql.inc.php  
    2010-04-14 19:13:14 UTC (rev 21190)
@@ -6,7 +6,7 @@
        * @author Joseph Engo <address@hidden>
        * @author Dan Kuykendall <address@hidden>
        * @author Bettina Gille <address@hidden>
-       * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @copyright Copyright (C) 2000-2010 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License v2 or later
        * @package phpgroupware
        * @subpackage phpgwapi
@@ -609,10 +609,11 @@
                * Get a list of members of the group
                *
                * @param integer $group_id the group to check
+               * @param bool $active only return active members
                *
                * @return array list of members
                */
-               public function member($group_id = 0)
+               public function member($group_id = 0, $active = false)
                {
                        $group_id = get_account_id($group_id);
 
@@ -623,10 +624,19 @@
 
                        $this->members[$group_id] = array();
 
-                       $sql = 'SELECT account_id'
-                               . ' FROM phpgw_group_map'
-                               . " WHERE group_id = {$group_id}";
+                       $Where = 'WHERE';
+                       $sql = 'SELECT phpgw_group_map.account_id'
+                               . ' FROM phpgw_group_map';
 
+                       if($active)
+                       {
+                               $sql .= " {$this->join} phpgw_accounts ON 
phpgw_group_map.account_id = phpgw_accounts.account_id"
+                               . " WHERE account_status = 'A'";
+                               $Where = 'AND';
+                       }
+
+                       $sql .= " {$Where} group_id = {$group_id}";
+
                        $this->db->query($sql, __LINE__, __FILE__);
 
                        while ( $this->db->next_record() )
@@ -640,7 +650,7 @@
 
                        foreach ( $this->members[$group_id] as $id => &$acct )
                        {
-                               $acct['account_name'] = (string) 
$this->get($id);
+                               $acct['account_name'] = 
$this->get($id)->__toString();
                        }
                        return $this->members[$group_id];
                }

Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.acl.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.acl.inc.php        
2010-04-14 19:11:02 UTC (rev 21189)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.acl.inc.php        
2010-04-14 19:13:14 UTC (rev 21190)
@@ -1798,8 +1798,7 @@
                                {
                                        if($entry['account_type']=='g')
                                        {
-                                               // Would be nice if inactive 
members could be filtered out from the result
-                                               $members = 
$myaccounts->member($entry['account_id']);
+                                               $members = 
$myaccounts->member($entry['account_id'], true);
 
                                                if (isset($members) AND 
is_array($members))
                                                {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]