[ghelda-devel] [65] Correct plugin Groups for a weird bug.

[ Thread Index | Date Index | More lists.tuxfamily.org/ghelda-devel Archives ]


Revision: 65
Author:   odyx
Date:     2009-07-24 23:18:37 +0200 (Fri, 24 Jul 2009)

Log Message:
-----------
Correct plugin Groups for a weird bug.

Modified Paths:
--------------
    trunk/plugins/Groups.php


Modified: trunk/plugins/Groups.php
===================================================================
--- trunk/plugins/Groups.php	2009-07-24 21:18:34 UTC (rev 64)
+++ trunk/plugins/Groups.php	2009-07-24 21:18:37 UTC (rev 65)
@@ -172,10 +172,10 @@
                     continue;
                 }
                 $fieldsContents[$fieldName_] = $fieldContent;
-                $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
+                $formattedFields_array[] = "`$fieldName_` = '".$fieldContent."'";
             }
             // Strip the two last characters (border issue)
-            $formattedFields = substr($formattedFields,0,-2);
+            $formattedFields = implode($formattedFields_array,', ');
             // If we are updating (thus not making a new entry)
             if($id <> G_GROUPS_ID_NEW) {
                 $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
@@ -194,11 +194,12 @@
                     $id);
                 $queryR =& $this->db->query($query);
                 if(PEAR::isError($queryR))
+                    // TODO: Handle query error.
                     return false;
                 // Get the just produced ID (per client => thread-safe)
                 $query = "SELECT LAST_INSERT_ID()";
                 $queryR =& $this->db->query($query);
-                $id =& current($queryR->fetchRow());
+                $id =& end($queryR->fetchRow());
                 // Success => mode = 'edit'
                 $this->mode = 'edit';
             }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/