[Fusionforge-commits] r13601 - branches/Branch_5_1/src/common/include

Alain Peyrat aljeux at fusionforge.org
Mon Jun 27 18:44:31 CEST 2011


Author: aljeux
Date: 2011-06-27 18:44:30 +0200 (Mon, 27 Jun 2011)
New Revision: 13601

Modified:
   branches/Branch_5_1/src/common/include/Group.class.php
Log:
Group: Improve code against possible errors.

Modified: branches/Branch_5_1/src/common/include/Group.class.php
===================================================================
--- branches/Branch_5_1/src/common/include/Group.class.php	2011-06-27 16:44:20 UTC (rev 13600)
+++ branches/Branch_5_1/src/common/include/Group.class.php	2011-06-27 16:44:30 UTC (rev 13601)
@@ -5,7 +5,7 @@
  * Copyright 1999-2001, VA Linux Systems, Inc.
  * Copyright 2009-2010, Roland Mas
  * Copyright 2010, Franck Villaume - Capgemini
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -1798,7 +1798,11 @@
 			if (!is_object($i)) {
 				continue;
 			}
-			$i->delete();
+			if (!$i->delete()) {
+				$this->setError(_('Could not properly delete the survey'));
+				db_rollback();
+				return false;
+			}
 		}
 		//
 		//	Delete SurveyQuestions
@@ -1809,7 +1813,11 @@
 			if (!is_object($i)) {
 				continue;
 			}
-			$i->delete();
+			if (!$i->delete()) {
+				$this->setError(_('Could not properly delete the survey questions'));
+				db_rollback();
+				return false;
+			}
 		}
 		//
 		//	Delete Mailing List Factory
@@ -1822,6 +1830,8 @@
 			}
 			if (!$i->delete(1,1)) {
 				$this->setError(_('Could not properly delete the mailing list'));
+				db_rollback();
+				return false;
 			}
 		}
 		//
@@ -2052,7 +2062,7 @@
 				//  user was already a member
 				//  make sure they are set up 
 				//
-				$user=&user_get_object($user_id,$res_newuser);
+				$user= user_get_object($user_id,$res_newuser);
 				$user->fetchData($user->getID());
 				$role = new Role($this,$role_id);
 				if (!$role || !is_object($role)) {
@@ -2217,7 +2227,7 @@
 
 			$hook_params['group'] = $this;
 			$hook_params['group_id'] = $this->getID();
-			$hook_params['user'] = &user_get_object($user_id);
+			$hook_params['user'] = user_get_object($user_id);
 			$hook_params['user_id'] = $user_id;
 			plugin_hook ("group_removeuser", $hook_params);
 




More information about the Fusionforge-commits mailing list