[Fusionforge-commits] r10757 - trunk/src/www/tracker

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Tue Sep 28 18:22:12 CEST 2010


Author: aljeux
Date: 2010-09-28 18:22:12 +0200 (Tue, 28 Sep 2010)
New Revision: 10757

Modified:
   trunk/src/www/tracker/taskmgr.php
Log:
No need of load env.inc.php, this page is included by another one.
Hide tasks already linked to avoid SQL errors.

Modified: trunk/src/www/tracker/taskmgr.php
===================================================================
--- trunk/src/www/tracker/taskmgr.php	2010-09-28 13:44:36 UTC (rev 10756)
+++ trunk/src/www/tracker/taskmgr.php	2010-09-28 16:22:12 UTC (rev 10757)
@@ -22,8 +22,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US
  */
 
-require_once('../env.inc.php');
-require_once $gfcommon.'include/pre.php';
 require_once $gfcommon.'pm/ProjectGroupFactory.class.php';
 require_once $gfcommon.'pm/ProjectTaskFactory.class.php';
 
@@ -57,7 +55,6 @@
 		exit_error($pg->getErrorMessage(),'tracker');
 	}
 
-
 	$ptf = new ProjectTaskFactory($pg);
 	if (!$ptf || !is_object($ptf)) {
 		exit_error(_('Could Not Get ProjectTaskFactory'),'tracker');
@@ -79,6 +76,22 @@
 		}
 	}
 
+	$related_tasks = $a->getRelatedTasks();
+	$skip = array();
+	while ($row = db_fetch_array($related_tasks)) {
+		$skip[$row['project_task_id']] = true;
+	}
+	$tasks = array();
+	foreach($pt_arr as $p) {
+		$id = $p->getID();
+		if (!isset($skip[$id])) {
+			$tasks[] = $p;
+		}
+	}
+	if (empty($tasks)) {
+		exit_error(_('No Available Tasks Found'));
+	}
+
 	$ath->header(array('atid'=>$ath->getID()));
 
 	echo '
@@ -92,8 +105,8 @@
 		<p>
 		<strong>'._('Task').':</strong></p>
 		<select name="project_task_id">';
-	for ($i=0; $i<count($pt_arr); $i++) {
-		echo '<option value="'.$pt_arr[$i]->getID().'">'.$pt_arr[$i]->getSummary().'</option>';
+	foreach($tasks as $task) {
+		echo '<option value="'.$task->getID().'">'.$task->getSummary().'</option>';
 	}
 	echo '</select><br />
 		<input type="submit" name="done_adding" value="'._('Add Relationship to Selected Task') . '" />
@@ -125,7 +138,7 @@
 		exit_error($pgf->getErrorMessage(),'tracker');
 	}
 
-	$pg_arr =& $pgf->getProjectGroups();
+	$pg_arr = $pgf->getProjectGroups();
 	if (!$pg_arr) {
 		if ($pgf->isError()) {
 			exit_error($pgf->getErrorMessage(),'tracker');




More information about the Fusionforge-commits mailing list