Merge branch '2015.11-develop' into 2016.11
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 4 Jan 2017 17:25:18 +0000 (18:25 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 4 Jan 2017 17:25:18 +0000 (18:25 +0100)
Change-Id: I5004cd555e7f11a6807acd0b986586868b981f2a

1  2 
tine20/Calendar/Setup/Update/Release9.php
tine20/Calendar/Setup/setup.xml
tine20/composer.json
tine20/composer.lock

@@@ -120,17 -121,81 +120,93 @@@ class Calendar_Setup_Update_Release9 ex
  
          $this->setApplicationVersion('Calendar', '9.7');
      }
-     
      /**
 -     * fix displaycontainer in organizers attendee records
 +     * update to 9.8
 +     *
 +     * Update Calendar Import Export definitions
       */
      public function update_7()
      {
-         
 +        $app = Tinebase_Application::getInstance()->getApplicationByName('Calendar');
 +        Setup_Controller::getInstance()->createImportExportDefinitions($app);
 -        $this->setApplicationVersion('Calendar', '9.8');
 +        $this->setApplicationVersion('Calendar', '9.8');
 +    }
++
++    /**
++     * fix displaycontainer in organizers attendee records
++     */
++    public function update_8()
++    {
+         $allBroken = $this->_db->query(
+             "SELECT " . $this->_db->quoteIdentifier('events.id') . " AS " . $this->_db->quoteIdentifier('event_id') . "," .
+             $this->_db->quoteIdentifier('events.is_deleted') . " AS " . $this->_db->quoteIdentifier('event_is_deleted') . "," .
+             $this->_db->quoteIdentifier('events.container_id') . "," .
+             $this->_db->quoteIdentifier('events.seq') . "," .
+             $this->_db->quoteIdentifier('attendee.id') . " AS " . $this->_db->quoteIdentifier('attendee_id') .
+             " FROM " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "cal_events") . " AS " . $this->_db->quoteIdentifier('events') .
+             " INNER JOIN " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "container") . " AS " . $this->_db->quoteIdentifier('container') . " ON " .
+             $this->_db->quoteIdentifier('events.container_id') . " = " . $this->_db->quoteIdentifier('container.id') . " AND " .
+             $this->_db->quoteIdentifier('container.type') . " = " . $this->_db->quote('personal') .
+             " INNER JOIN " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "accounts") . " AS " . $this->_db->quoteIdentifier('owner') . " ON " .
+             $this->_db->quoteIdentifier('container.owner_id') . " = " . $this->_db->quoteIdentifier('owner.id') .
+             " INNER JOIN " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "cal_attendee") . " AS " . $this->_db->quoteIdentifier('attendee') . " ON " .
+             $this->_db->quoteIdentifier('attendee.cal_event_id') . " = " . $this->_db->quoteIdentifier('events.id') . " AND " .
+             $this->_db->quoteIdentifier('attendee.user_id') . " = " . $this->_db->quoteIdentifier('owner.contact_id') . " AND " .
+             $this->_db->quoteIdentifier('attendee.user_type') . " IN (" . $this->_db->quote(array('user', 'groupmember')) . ") AND " .
+             $this->_db->quoteIdentifier('attendee.displaycontainer_id') . " != " . $this->_db->quoteIdentifier('events.container_id')
+         )->fetchAll(Zend_Db::FETCH_ASSOC);
+         foreach ($allBroken as $broken) {
+             $time = Tinebase_DateTime::now()->toString();
+             $this->_db->query("START TRANSACTION");
+             $this->_db->query(
+                 "UPDATE " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "cal_attendee") .
+                 " SET " . $this->_db->quoteIdentifier("displaycontainer_id") . " = " . $this->_db->quote($broken['container_id']) .
+                 " WHERE " . $this->_db->quoteIdentifier("id") . " = " . $this->_db->quote($broken['attendee_id'])
+             );
+             // care for consistent history for client updates
+             if (!$broken['event_is_deleted']) {
+                 $this->_db->query(
+                     "UPDATE " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "cal_events") .
+                     " SET " . $this->_db->quoteIdentifier("seq") . " = (" . $this->_db->quoteIdentifier('seq') . " +1)," .
+                     $this->_db->quoteIdentifier("last_modified_time") . " = " . $this->_db->quote($time) .
+                     " WHERE " . $this->_db->quoteIdentifier("id") . " = " . $this->_db->quote($broken['event_id'])
+                 );
+                 $this->_db->query(
+                     "UPDATE " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "container") .
+                     " SET " . $this->_db->quoteIdentifier("content_seq") . " = (" . $this->_db->quoteIdentifier('content_seq') . " +1)" .
+                     " WHERE " . $this->_db->quoteIdentifier("id") . " = " . $this->_db->quote($broken['container_id'])
+                 );
+                 $content_seq = Tinebase_Helper::array_value('content_seq', Tinebase_Helper::array_value(0, $this->_db->query(
+                     "SELECT " . $this->_db->quoteIdentifier('content_seq') .
+                     " FROM " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "container") .
+                     " WHERE " . $this->_db->quoteIdentifier('id') . " = " . $this->_db->quote($broken['container_id'])
+                 )->fetchAll(Zend_Db::FETCH_ASSOC)));
+                 $this->_db->query(
+                     "INSERT INTO" . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "container_content") .
+                     " (" .
+                     $this->_db->quoteIdentifier("id") . "," .
+                     $this->_db->quoteIdentifier("container_id") . "," .
+                     $this->_db->quoteIdentifier("record_id") . "," .
+                     $this->_db->quoteIdentifier("action") . "," .
+                     $this->_db->quoteIdentifier("content_seq") . "," .
+                     $this->_db->quoteIdentifier("time") .
+                     ") VALUES (" .
+                     $this->_db->quote(Tinebase_Record_Abstract::generateUID()) . "," .
+                     $this->_db->quote($broken['container_id']) . "," .
+                     $this->_db->quote($broken['event_id']) . "," .
+                     $this->_db->quote('update') . "," .
+                     $this->_db->quote($content_seq) . "," .
+                     $this->_db->quote($time) .
+                     ")"
+                 );
+             }
+             $this->_db->query("COMMIT");
+         }
++        $this->setApplicationVersion('Calendar', '9.9');
+     }
  }
@@@ -2,7 -2,7 +2,7 @@@
  <application>
      <name>Calendar</name>
      <!-- gettext('Calendar') -->   
--    <version>9.8</version>
++    <version>9.9</version>
      <order>15</order>
      <status>enabled</status>
      <tables>
@@@ -31,8 -33,8 +31,8 @@@
          "sabre/dav": "1.8.*",
          "sabre/vobject": "3.1.3 as 2.1.313",
          "metaways/opendocument": "1.1",
-         "metaways/timezoneconvert": "0.2",
+         "metaways/timezoneconvert": "1.*",
 -        "zendframework/zend-http": "2.2.8-p3 as 2.2.8",
 +        "zendframework/zend-http": "2.4.*",
          "doctrine/orm": "2.5.*",
          "twig/twig": "~1.0"
      },
                  "Timezones",
                  "UTC"
              ],
-             "time": "2014-06-02 12:00:27"
+             "time": "2016-04-25 08:20:13"
          },
          {
 +            "name": "pclzip/pclzip",
 +            "version": "2.8.2",
 +            "source": {
 +                "type": "git",
 +                "url": "https://github.com/ivanlanin/pclzip.git",
 +                "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd"
 +            },
 +            "dist": {
 +                "type": "zip",
 +                "url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd",
 +                "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd",
 +                "shasum": ""
 +            },
 +            "type": "library",
 +            "autoload": {
 +                "classmap": [
 +                    "pclzip.lib.php"
 +                ]
 +            },
 +            "notification-url": "https://packagist.org/downloads/",
 +            "license": [
 +                "LGPL-2.1"
 +            ],
 +            "authors": [
 +                {
 +                    "name": "Vincent Blavet"
 +                }
 +            ],
 +            "description": "A PHP library that offers compression and extraction functions for Zip formatted archives",
 +            "homepage": "http://www.phpconcept.net/pclzip",
 +            "keywords": [
 +                "php",
 +                "zip"
 +            ],
 +            "time": "2014-06-05 11:42:24"
 +        },
 +        {
 +            "name": "phpoffice/common",
 +            "version": "v0.2.6",
 +            "source": {
 +                "type": "git",
 +                "url": "https://github.com/PHPOffice/Common.git",
 +                "reference": "c9be70c80637c28c728be78e66aad4878a34f8dd"
 +            },
 +            "dist": {
 +                "type": "zip",
 +                "url": "https://api.github.com/repos/PHPOffice/Common/zipball/c9be70c80637c28c728be78e66aad4878a34f8dd",
 +                "reference": "c9be70c80637c28c728be78e66aad4878a34f8dd",
 +                "shasum": ""
 +            },
 +            "require": {
 +                "pclzip/pclzip": "^2.8",
 +                "php": ">=5.3.0"
 +            },
 +            "require-dev": {
 +                "phpdocumentor/phpdocumentor": "2.*",
 +                "phploc/phploc": "2.*",
 +                "phpmd/phpmd": "2.*",
 +                "phpunit/phpunit": "3.7.*",
 +                "sebastian/phpcpd": "2.*",
 +                "squizlabs/php_codesniffer": "2.*"
 +            },
 +            "type": "library",
 +            "autoload": {
 +                "psr-4": {
 +                    "PhpOffice\\Common\\": "src/Common/"
 +                }
 +            },
 +            "notification-url": "https://packagist.org/downloads/",
 +            "license": [
 +                "LGPL"
 +            ],
 +            "authors": [
 +                {
 +                    "name": "Mark Baker"
 +                },
 +                {
 +                    "name": "Franck Lefevre",
 +                    "homepage": "http://rootslabs.net"
 +                }
 +            ],
 +            "description": "PHPOffice Common",
 +            "homepage": "http://phpoffice.github.io",
 +            "keywords": [
 +                "common",
 +                "component",
 +                "office",
 +                "php"
 +            ],
 +            "time": "2016-07-07 17:26:55"
 +        },
 +        {
 +            "name": "phpoffice/phpexcel",
 +            "version": "1.8.1",
 +            "source": {
 +                "type": "git",
 +                "url": "https://github.com/PHPOffice/PHPExcel.git",
 +                "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32"
 +            },
 +            "dist": {
 +                "type": "zip",
 +                "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
 +                "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
 +                "shasum": ""
 +            },
 +            "require": {
 +                "ext-xml": "*",
 +                "ext-xmlwriter": "*",
 +                "php": ">=5.2.0"
 +            },
 +            "type": "library",
 +            "autoload": {
 +                "psr-0": {
 +                    "PHPExcel": "Classes/"
 +                }
 +            },
 +            "notification-url": "https://packagist.org/downloads/",
 +            "license": [
 +                "LGPL"
 +            ],
 +            "authors": [
 +                {
 +                    "name": "Maarten Balliauw",
 +                    "homepage": "http://blog.maartenballiauw.be"
 +                },
 +                {
 +                    "name": "Mark Baker"
 +                },
 +                {
 +                    "name": "Franck Lefevre",
 +                    "homepage": "http://blog.rootslabs.net"
 +                },
 +                {
 +                    "name": "Erik Tilt"
 +                }
 +            ],
 +            "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
 +            "homepage": "http://phpexcel.codeplex.com",
 +            "keywords": [
 +                "OpenXML",
 +                "excel",
 +                "php",
 +                "spreadsheet",
 +                "xls",
 +                "xlsx"
 +            ],
 +            "time": "2015-05-01 07:00:55"
 +        },
 +        {
              "name": "phpoffice/phpword",
 -            "version": "v0.12.1",
 +            "version": "v0.13.0",
              "source": {
                  "type": "git",
                  "url": "https://github.com/PHPOffice/PHPWord.git",