[Fusionforge-commits] r10746 - trunk/src/www/admin

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Sep 28 11:30:18 CEST 2010


Author: lolando
Date: 2010-09-28 11:30:17 +0200 (Tue, 28 Sep 2010)
New Revision: 10746

Modified:
   trunk/src/www/admin/grouplist.php
Log:
Fix two SQL queries and add a missing one

Modified: trunk/src/www/admin/grouplist.php
===================================================================
--- trunk/src/www/admin/grouplist.php	2010-09-28 09:22:50 UTC (rev 10745)
+++ trunk/src/www/admin/grouplist.php	2010-09-28 09:30:17 UTC (rev 10746)
@@ -45,14 +45,14 @@
 if (isset($group_name_search)) {
 	echo "<p>"._('Projects that begin with'). " <strong>".$group_name_search."</strong></p>\n";
 	if (PFO_USE_RBAC) {
-		$res = db_query_params ('SELECT group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name,COUNT(DISTINCT(pfo_user_role.user_id)) AS members
+		$res = db_query_params ('SELECT group_name,register_time,unix_group_name,groups.group_id,groups.is_public,status,license_name,COUNT(DISTINCT(pfo_user_role.user_id)) AS members
 FROM groups, pfo_user_role, pfo_role, licenses
 WHERE pfo_user_role.role_id=pfo_role.role_id
 AND pfo_role.home_group_id=groups.group_id
 AND license_id=license
 AND lower(group_name) LIKE $1
 AND (status=$2 OR 1!=$3)
-GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name
+GROUP BY group_name,register_time,unix_group_name,groups.group_id,groups.is_public,status,license_name
 ORDER BY '.$sortorder,
 					array (strtolower ("$group_name_search%"),
 					       'P',
@@ -82,6 +82,19 @@
 		}
 		$qpa = db_construct_qpa ($qpa, ' GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name ORDER BY '.$sortorder) ;
 		$res = db_query_qpa ($qpa) ;
+	} else {
+		$qpa = db_construct_qpa (false, 'SELECT group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name,COUNT(user_group.group_id) AS members
+FROM groups
+LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses
+WHERE license_id=license
+AND (status=$1 OR 1!=$2)',
+				     array ('P',
+					    $form_pending ? 1 : 0)) ;
+		if ($status) {
+			$qpa = db_construct_qpa ($qpa, ' AND status=$1', array ($status)) ;
+		}
+		$qpa = db_construct_qpa ($qpa, ' GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name ORDER BY '.$sortorder) ;
+		$res = db_query_qpa ($qpa) ;
 	}
 }
 




More information about the Fusionforge-commits mailing list