[Fusionforge-commits] r10558 - trunk/src/plugins/extratabs/www

Roland Mas lolando at libremir.placard.fr.eu.org
Mon Sep 20 18:23:50 CEST 2010


Author: lolando
Date: 2010-09-20 18:23:49 +0200 (Mon, 20 Sep 2010)
New Revision: 10558

Modified:
   trunk/src/plugins/extratabs/www/index.php
Log:
Improve extratabs robustness

Modified: trunk/src/plugins/extratabs/www/index.php
===================================================================
--- trunk/src/plugins/extratabs/www/index.php	2010-09-20 15:33:47 UTC (rev 10557)
+++ trunk/src/plugins/extratabs/www/index.php	2010-09-20 16:23:49 UTC (rev 10558)
@@ -89,9 +89,20 @@
 	if (!$res || db_affected_rows($res) < 1) {
 		$error_msg = sprintf (_('Cannot delete tab entry: %s'), db_error());
 	} else {
-		$res = db_query_params ('UPDATE plugin_extratabs_main SET index=index-1 WHERE group_id=$1 AND index > $2',
+		$res = db_query_params ('SELECT index FROM plugin_extratabs_main WHERE group_id=$1 AND index > $2 ORDER BY index ASC',
 					array ($group_id,
 					       $index)) ;
+		if (db_numrows($res) > 0) {
+			$todo = array () ;
+			while ($row = db_fetch_array($res)) {
+				$todo[] = $row['index'] ;
+			}
+			foreach ($todo as $i) {
+				$res = db_query_params ('UPDATE plugin_extratabs_main SET index = index - 1 WHERE group_id = $1 AND index = $2',
+							array ($group_id,
+							       $i)) ;
+			}
+		}
 		if ($res) {
 			$feedback = _('Tab successfully deleted');
 		} else {




More information about the Fusionforge-commits mailing list