[Fusionforge-commits] FusionForge branch Branch_5_3 updated. 25e2722d70514bfb3f0fc2ae6fe41f39fd9104dc

Franck Villaume nerville at fusionforge.org
Sun May 11 19:17:21 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_3 has been updated
       via  25e2722d70514bfb3f0fc2ae6fe41f39fd9104dc (commit)
      from  b7b45d0e6afda9b360f162f497fec534c18f24d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 25e2722d70514bfb3f0fc2ae6fe41f39fd9104dc
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun May 11 19:15:31 2014 +0200

    fix commit b7b45d0e6afda9b360f162f497fec534c18f24d8. This commit fix the delete project feature.

diff --git a/src/common/include/Group.class.php b/src/common/include/Group.class.php
index 5ac308c..f7fa9e0 100644
--- a/src/common/include/Group.class.php
+++ b/src/common/include/Group.class.php
@@ -1902,6 +1902,16 @@ class Group extends Error {
 			return false;
 		}
 
+		// Remove users & delete roles from this project
+		$members = $this->getMembers();
+		foreach ($members as $userObject) {
+			$this->removeUser($userObject->getID());
+		}
+		$localRolesId = $this->getRolesId(false);
+		foreach ($localRolesId as $localRoleId) {
+			$roleObject = new Role($this, $localRoleId);
+			$roleObject->delete();
+		}
 		// Delete entry in groups.
 		$res = db_query_params('DELETE FROM groups WHERE group_id=$1',
 					array($this->getID()));
@@ -2737,9 +2747,10 @@ if there is anything we can do to help you.
 	/**
 	 * getRolesId - Get Ids of the roles of the group.
 	 *
+	 * @param	bool	all role ids or local role ids only. Default is all role ids
 	 * @return	array	Role ids of this group.
 	 */
-	function getRolesId() {
+	function getRolesId($global = true) {
 		$role_ids = array();
 
 		$res = db_query_params('SELECT role_id FROM pfo_role WHERE home_group_id=$1',
@@ -2747,10 +2758,12 @@ if there is anything we can do to help you.
 		while ($arr = db_fetch_array($res)) {
 			$role_ids[] = $arr['role_id'];
 		}
-		$res = db_query_params('SELECT role_id FROM role_project_refs WHERE group_id=$1',
-					array($this->getID()));
-		while ($arr = db_fetch_array($res)) {
-			$role_ids[] = $arr['role_id'];
+		if ($global) {
+			$res = db_query_params('SELECT role_id FROM role_project_refs WHERE group_id=$1',
+						array($this->getID()));
+			while ($arr = db_fetch_array($res)) {
+				$role_ids[] = $arr['role_id'];
+			}
 		}
 
 		return array_unique($role_ids);

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/Group.class.php |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list