0011266: increase size of event fields summary and location
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 25 Aug 2015 14:39:50 +0000 (16:39 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 2 Sep 2015 12:03:26 +0000 (14:03 +0200)
* increases field size to varchar 1024 (= TEXT)

https://forge.tine20.org/view.php?id=11266

Change-Id: I2092049936ee7f2cce8a50d519f6b5b891120aa5
Reviewed-on: http://gerrit.tine20.com/customers/2151
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Convert/Event/VCalendar/GenericTest.php
tine20/Calendar/Convert/Event/VCalendar/Abstract.php
tine20/Calendar/Setup/Update/Release8.php
tine20/Calendar/Setup/setup.xml

index 78dd6c3..f8bd0fc 100644 (file)
@@ -695,8 +695,9 @@ class Calendar_Convert_Event_VCalendar_GenericTest extends PHPUnit_Framework_Tes
     {
         $savedEvent = $this->_saveIcsEvent('iphone_longsummary.ics');
         
-        $this->assertEquals('Finanz-IT anrufen, xxxxxxxxxxxh', $savedEvent->summary, print_r($savedEvent->toArray(), true));
-        $this->assertContains("Finanz-IT anrufen, xxxxxxxxxxxh\nFestgelegt für 25. Juli 2012", $savedEvent->description, print_r($savedEvent->toArray(), true));
+        $this->assertContains("immer im Voraus vereinbart.\nBezahlt haben sie letztes mal",
+            $savedEvent->summary, print_r($savedEvent->toArray(), true));
+        $this->assertTrue(empty($savedEvent->description), print_r($savedEvent->toArray(), true));
     }
     
     /**
@@ -725,8 +726,10 @@ class Calendar_Convert_Event_VCalendar_GenericTest extends PHPUnit_Framework_Tes
     {
         $savedEvent = $this->_saveIcsEvent('iphone_longlocation.ics');
         
-        $this->assertContains('1. Rufen Sie folgende Seite auf: https://xxxxxxxxxxxxxx.webex.', $savedEvent->location, print_r($savedEvent->toArray(), true));
-        $this->assertContains("und Ihre E-Mail-Adresse ein.; geben Sie das Meeting-Passwort ein: xxxx", $savedEvent->description, print_r($savedEvent->toArray(), true));
+        $this->assertContains('1. Rufen Sie folgende Seite auf: https://xxxxxxxxxxxxxx.webex.',
+            $savedEvent->location, print_r($savedEvent->toArray(), true));
+        $this->assertContains("und Ihre E-Mail-Adresse ein.; geben Sie das Meeting-Passwort ein: xxxx",
+            $savedEvent->location, print_r($savedEvent->toArray(), true));
     }
 
     /**
index 0c0d8a4..56311f7 100644 (file)
@@ -685,7 +685,6 @@ class Calendar_Convert_Event_VCalendar_Abstract extends Tinebase_Convert_VCalend
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' vevent ' . $vevent->serialize());
         
         $newAttendees = array();
-        $shortenedFields = array();
         $attachments = new Tinebase_Record_RecordSet('Tinebase_Model_Tree_Node');
         $event->alarms = new Tinebase_Record_RecordSet('Tinebase_Model_Alarm');
         $skipFieldsIfOnlyBasicData = array('ATTENDEE', 'UID', 'ORGANIZER', 'VALARM', 'ATTACH', 'CATEGORIES');
@@ -783,22 +782,6 @@ class Calendar_Convert_Event_VCalendar_Abstract extends Tinebase_Convert_VCalend
                 case 'SUMMARY':
                     $key = strtolower($property->name);
                     $value = $property->getValue();
-                    switch ($key) {
-                        case 'summary':
-                        case 'location':
-                            if (strlen($value) > 255) {
-                                $shortenedFields[$key] = $value;
-                                $endPos = strpos($value, "\n") !== false && strpos($value, "\n") < 255 
-                                    ? strpos($value, "\n") 
-                                    : 255;
-                                if (extension_loaded('mbstring')) {
-                                    $value = mb_substr($value, 0, $endPos, 'UTF-8');
-                                } else {
-                                    $value = Tinebase_Core::filterInputForDatabase(substr($value, 0, $endPos));
-                                }
-                            }
-                            break;
-                    }
                     $event->$key = $value;
                     
                     break;
@@ -1034,10 +1017,6 @@ class Calendar_Convert_Event_VCalendar_Abstract extends Tinebase_Convert_VCalend
                 Calendar_Model_Event::CLASS_PRIVATE;
         }
 
-        foreach ($shortenedFields as $key => $value) {
-            $event->description = "--------\n$key: $value";
-        }
-        
         if (isset($lastAck)) {
             Calendar_Controller_Alarm::setAcknowledgeTime($event->alarms, $lastAck);
         }
index 3cd3a66..d1cbe60 100644 (file)
@@ -428,4 +428,26 @@ class Calendar_Setup_Update_Release8 extends Setup_Update_Abstract
         $this->setTableVersion('cal_events', '10');
         $this->setApplicationVersion('Calendar', '8.9');
     }
+
+    /**
+     * @see 0011266: increase size of event fields summary and location
+     */
+    public function update_6()
+    {
+        $fieldsToChange = array('location', 'summary');
+
+        foreach ($fieldsToChange as $name) {
+            $seqCol = '<field>
+                <name>' . $name . '</name>
+                <type>text</type>
+                <length>1024</length>
+            </field>';
+
+            $declaration = new Setup_Backend_Schema_Field_Xml($seqCol);
+            $this->_backend->alterCol('cal_events', $declaration);
+        }
+
+        $this->setTableVersion('cal_events', 9);
+        $this->setApplicationVersion('Calendar', '8.7');
+    }
 }
index 0fa8eed..c130c56 100644 (file)
@@ -2,14 +2,14 @@
 <application>
     <name>Calendar</name>
     <!-- gettext('Calendar') -->   
-    <version>8.9</version>
+    <version>8.10</version>
     <order>15</order>
     <status>enabled</status>
     <tables>
         <!-- events -->
         <table>
             <name>cal_events</name>
-            <version>10</version>
+            <version>11</version>
             <declaration>
                 <field>
                     <name>id</name>
@@ -94,7 +94,7 @@
                 <field>
                     <name>location</name>
                     <type>text</type>
-                    <length>255</length>
+                    <length>1024</length>
                 </field>
                     <field>
                     <name>organizer</name>
                 <field>
                     <name>summary</name>
                     <type>text</type>
-                    <length>255</length>
+                    <length>1024</length>
                     <notnull>false</notnull>
                 </field>
                 <field>