[Fusionforge-commits] r10699 - trunk/src/common/widget

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Sat Sep 25 19:25:38 CEST 2010


Author: aljeux
Date: 2010-09-25 19:25:37 +0200 (Sat, 25 Sep 2010)
New Revision: 10699

Modified:
   trunk/src/common/widget/WidgetLayoutManager.class.php
Log:
Fix unsupported multi INSERT on Postgresql 8.1 (user widgets)

Modified: trunk/src/common/widget/WidgetLayoutManager.class.php
===================================================================
--- trunk/src/common/widget/WidgetLayoutManager.class.php	2010-09-25 17:03:32 UTC (rev 10698)
+++ trunk/src/common/widget/WidgetLayoutManager.class.php	2010-09-25 17:25:37 UTC (rev 10699)
@@ -146,20 +146,24 @@
 		if (db_query_params($sql,array($owner_id,$owner_type))) {
 
 			$sql = "INSERT INTO layouts_contents(owner_id, owner_type, layout_id, column_id, name, rank) VALUES ";
-			$sql .= "($1, $2, 1, 1, 'myprojects', 0)";
-			$sql .= ",($1, $2, 1, 1, 'mybookmarks', 1)";
-			$sql .= ",($1, $2, 1, 1, 'mymonitoredforums', 2)";
-			$sql .= ",($1, $2, 1, 1, 'mysurveys', 4)";
-			$sql .= ",($1, $2, 1, 2, 'myartifacts', 0)";
-			$sql .= ",($1, $2, 1, 2, 'mymonitoredfp', 1)";
 
+			$args[] = "($1, $2, 1, 1, 'myprojects', 0)";
+			$args[] = "($1, $2, 1, 1, 'mybookmarks', 1)";
+			$args[] = "($1, $2, 1, 1, 'mymonitoredforums', 2)";
+			$args[] = "($1, $2, 1, 1, 'mysurveys', 4)";
+			$args[] = "($1, $2, 1, 2, 'myartifacts', 0)";
+			$args[] = "($1, $2, 1, 2, 'mymonitoredfp', 1)";
+
+			foreach($args as $a) {
+				db_query_params($sql.$a,array($owner_id,$owner_type));
+			}
+
 			/*  $em =& EventManager::instance();
 			    $widgets = array();
 			    $em->processEvent('default_widgets_for_new_owner', array('widgets' => &$widgets, 'owner_type' => $owner_type));
 			    foreach($widgets as $widget) {
 			    $sql .= ",($13, $14, 1, $15, $16, $17)";
 			    }*/
-			db_query_params($sql,array($owner_id,$owner_type));
 		}
 		echo db_error();
 	}




More information about the Fusionforge-commits mailing list