[Fusionforge-commits] r9318 - branches/Branch_5_0/gforge/common/pm

Julien HEYMAN jheyman at libremir.placard.fr.eu.org
Thu Apr 1 10:34:48 CEST 2010


Author: jheyman
Date: 2010-04-01 10:34:48 +0200 (Thu, 01 Apr 2010)
New Revision: 9318

Modified:
   branches/Branch_5_0/gforge/common/pm/ProjectGroup.class.php
   branches/Branch_5_0/gforge/common/pm/ProjectGroupFactory.class.php
Log:
Fixed bug when add a new pm


Modified: branches/Branch_5_0/gforge/common/pm/ProjectGroup.class.php
===================================================================
--- branches/Branch_5_0/gforge/common/pm/ProjectGroup.class.php	2010-04-01 08:29:34 UTC (rev 9317)
+++ branches/Branch_5_0/gforge/common/pm/ProjectGroup.class.php	2010-04-01 08:34:48 UTC (rev 9318)
@@ -166,6 +166,24 @@
 		$this->group_project_id=db_insertid($result,'project_group_list','group_project_id');
 		$this->fetchData($this->group_project_id);
 
+		$roles_group = $this->Group->getRolesId();
+		for ($i=0; $i<sizeof($roles_group); $i++) {
+			// set the permission for the role's group 
+			$role = new Role($this);
+			$role_name = db_query_params ('SELECT role_name from role where role_id = $1', array($roles_group[$i]));
+			$role_name = db_fetch_array($role_name);
+			$role_setting_res = db_query_params ('INSERT INTO role_setting (role_id,section_name,ref_id,value) VALUES ($1,$2,$3,$4)',
+						array ($roles_group[$i],
+						       'pm',
+						       $this->group_project_id,
+						       $role->defaults[$role_name['role_name']]['pm'])) ;
+			if (!$role_setting_res) {
+				db_rollback();
+				$this->setError('Error: Role setting for tasks id ' . $this->group_forum_id . ' for groud id ' . $this->Group->getID() . ' ' .db_error());
+				return false;
+			}
+		}
+
 		db_commit();
 		return true;
 	}
@@ -509,7 +527,16 @@
                         return false;
                 }
 
+		$res = db_query_params ('DELETE FROM role_setting WHERE section_name=$1 AND ref_id=$2',
+				 array ('pm',
+				 $this->getID())) ;
 
+                if (!$res)
+                {
+                        $this->setError('DATABASE '.db_error());
+                        return false;
+                }
+
 		db_commit();
 		return true;
 	}

Modified: branches/Branch_5_0/gforge/common/pm/ProjectGroupFactory.class.php
===================================================================
--- branches/Branch_5_0/gforge/common/pm/ProjectGroupFactory.class.php	2010-04-01 08:29:34 UTC (rev 9317)
+++ branches/Branch_5_0/gforge/common/pm/ProjectGroupFactory.class.php	2010-04-01 08:34:48 UTC (rev 9318)
@@ -96,8 +96,8 @@
 	WHERE group_id=$1 AND is_public<3
 	  AND group_project_id IN (SELECT role_setting.ref_id
 			           FROM role_setting, user_group
-				   WHERE role_setting.value::integer >= 0
-                                     AND role_setting.section_name = $2
+                                   WHERE role_setting.section_name = $2
+				     AND role_setting.value::integer >= 0
                                      AND role_setting.ref_id=project_group_list_vw.group_project_id
 				     AND user_group.role_id = role_setting.role_id
 				     AND user_group.user_id=$3)




More information about the Fusionforge-commits mailing list