[Fusionforge-commits] r10755 - trunk/src/common/tracker

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Sep 28 15:37:25 CEST 2010


Author: lolando
Date: 2010-09-28 15:37:24 +0200 (Tue, 28 Sep 2010)
New Revision: 10755

Modified:
   trunk/src/common/tracker/ArtifactWorkflow.class.php
Log:
Less SQL, more code reuse

Modified: trunk/src/common/tracker/ArtifactWorkflow.class.php
===================================================================
--- trunk/src/common/tracker/ArtifactWorkflow.class.php	2010-09-28 13:30:44 UTC (rev 10754)
+++ trunk/src/common/tracker/ArtifactWorkflow.class.php	2010-09-28 13:37:24 UTC (rev 10755)
@@ -157,11 +157,10 @@
 				
 		// If no values, then no roles defined, all roles are allowed.
 		if (empty($values)) {
-			$res=db_query_params ('SELECT role_id 
-			FROM role WHERE group_id=$1 ORDER BY role_name',
-			array($this->ath->Group->getID()));
-			while($arr = db_fetch_array($res)) {
-				$values[] = $arr['role_id'];
+			$roles = $this->ath->Group->getRoles() ;
+			sortRoleList($roles, $this->ath->Group) ;
+			foreach ($roles as $r) {
+				$values[] = $r->getID() ;
 			}			
 		}
 		return $values;
@@ -228,11 +227,8 @@
 		$event_id = $this->_getEventId($from, $to);
 		if ($event_id) {
 			// By default, all roles are allowed on a new event.
-			$res=db_query_params ('SELECT role_id 
-				FROM role WHERE group_id=$1 ORDER BY role_name',
-			array($this->ath->Group->getID()));
-			while($arr = db_fetch_array($res)) {
-				$this->_addRole($event_id, $arr['role_id']);
+			foreach ($this->ath->Group->getRoles() as $r) {
+				$this->_addRole($event_id, $r->getID());
 			}
 		}
 




More information about the Fusionforge-commits mailing list