Fix length of date fields in database.
authorChristian Weiske <cweiske@cweiske.de>
Fri, 26 Sep 2014 10:30:55 +0000 (12:30 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Fri, 26 Sep 2014 10:30:55 +0000 (12:30 +0200)
The last digit of the time zone was missing because the database
date fields were only 32 instead of 33 characters.
Tomdroid sync failed because of this.

Tomdroid sync works now!

appinfo/database.xml
appinfo/info.xml
appinfo/version
lib/notestorage.php

index 5bf6172..176f89f 100755 (executable)
                                <name>note_create_date</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>32</length>
+                               <length>33</length>
                        </field>
                        <field>
                                <name>note_last_change_date</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>32</length>
+                               <length>33</length>
                        </field>
                        <field>
                                <name>note_last_metadata_change_date</name>
                                <type>text</type>
                                <notnull>true</notnull>
-                               <length>32</length>
+                               <length>33</length>
                        </field>
 
                        <field>
index 1008496..2074d61 100755 (executable)
@@ -3,7 +3,7 @@
        <id>grauphel</id>
        <name>Grauphel: Tomboy note server</name>
        <description>Tomboy REST API server to sync notes between devices</description>
-       <version>0.1.1</version>
+       <version>0.2.0</version>
        <licence>AGPL3 or later</licence>
        <author>Christian Weiske</author>
        <requiremin>7</requiremin>
index 17e51c3..0ea3a94 100755 (executable)
@@ -1 +1 @@
-0.1.1
+0.2.0
index bca7dfd..d802669 100644 (file)
@@ -363,14 +363,24 @@ class NoteStorage
         return $notes;
     }
 
+    protected function fixDate($date)
+    {
+        if (strlen($date) == 32) {
+            //Bug in grauphel 0.1.1; date fields in DB had only 32 instead of 33
+            // characters. The last digit of the time zone was missing
+            $date .= '0';
+        }
+        return $date;
+    }
+
     protected function noteFromRow($row)
     {
         return (object) array(
             'guid'  => $row['note_guid'],
 
-            'create-date'               => $row['note_create_date'],
-            'last-change-date'          => $row['note_last_change_date'],
-            'last-metadata-change-date' => $row['note_last_metadata_change_date'],
+            'create-date'               => $this->fixDate($row['note_create_date']),
+            'last-change-date'          => $this->fixDate($row['note_last_change_date']),
+            'last-metadata-change-date' => $this->fixDate($row['note_last_metadata_change_date']),
 
             'title'                => $row['note_title'],
             'note-content'         => $row['note_content'],