Merge branch 'tine20.com/2012.10' into 2013.03
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 15 Apr 2013 11:31:06 +0000 (13:31 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 15 Apr 2013 11:31:06 +0000 (13:31 +0200)
Conflicts:
tine20/Calendar/Setup/Update/Release6.php
tine20/Calendar/Setup/setup.xml

1  2 
tine20/Calendar/Setup/Update/Release6.php
tine20/Calendar/Setup/Update/Release7.php
tine20/Calendar/Setup/setup.xml

@@@ -24,13 -24,32 +24,41 @@@ class Calendar_Setup_Update_Release6 ex
          $this->setApplicationVersion('Calendar', '6.1');
      }
      
 -
      /**
-     public function update_1()
+      * update to 6.2
+      * 
+      * @see 0008196: Preferences values contains translated value
+      */
+     public function update_1()
+     {
+         $prefBackend = new Tinebase_Backend_Sql(array(
+             'modelName' => 'Tinebase_Model_Preference', 
+             'tableName' => 'preferences',
+         ));
+         $alarmPrefs = $prefBackend->search(new Tinebase_Model_PreferenceFilter(array(array(
+             'field'    => 'name',
+             'operator' => 'equals',
+             'value'    => Calendar_Preference::DEFAULTALARM_MINUTESBEFORE
+         ))));
+         foreach ($alarmPrefs as $pref) {
+             if (preg_match("/\((\d+)\)/", $pref->value, $matches)) {
+                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
+                     . ' Updating DEFAULTALARM_MINUTESBEFORE from ' . $pref->value . ' to ' . $matches[1]);
+                 $pref->value = $matches[1];
+                 $prefBackend->update($pref);
+             }
+         }
+         
+         $this->setApplicationVersion('Calendar', '6.2');
+     }
++
++    /**
 +     * update to 7.0
 +     * 
 +     * @return void
 +     */
++    public function update_2()
 +    {
 +        $this->setApplicationVersion('Calendar', '7.0');
 +    }
  }
index b13e029,0000000..2413291
mode 100644,000000..100644
--- /dev/null
@@@ -1,38 -1,0 +1,50 @@@
 +<?php
 +/**
 + * Tine 2.0
 + *
 + * @package     Calendar
 + * @subpackage  Setup
 + * @license     http://www.gnu.org/licenses/agpl.html AGPL3
 + * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
 + * @author      Philipp Schüle <p.schuele@metaways.de>
 + */
 +class Calendar_Setup_Update_Release7 extends Setup_Update_Abstract
 +{
 +    /**
 +     * update to 7.1
 +     * - add default grant for anyone to resources
 +     */
 +    public function update_0()
 +    {
 +        Calendar_Controller_Resource::getInstance()->doContainerACLChecks(FALSE);
 +        $resources = Calendar_Controller_Resource::getInstance()->getAll();
 +        foreach ($resources as $resource) {
 +            $grants = Tinebase_Container::getInstance()->getGrantsOfContainer($resource->container_id, TRUE);
 +            if (count($grants) === 0) {
 +                $grants = new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
 +                    'account_type' => 'anyone',
 +                    'account_id' => 0,
 +                    'readGrant' => TRUE
 +                )));
 +                $result = Tinebase_Container::getInstance()->setGrants($resource->container_id, $grants, TRUE, FALSE);
 +                
 +                if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
 +                    . ' Added anyone grant (READ) for resource ' . $resource->name);
 +            }
 +        }
 +        
 +        $this->setApplicationVersion('Calendar', '7.1');
 +    }
++    
++    /**
++     * update to 6.2
++     * 
++     * @see 0008196: Preferences values contains translated value
++     */
++    public function update_1()
++    {
++        $release6 = new Calendar_Setup_Update_Release6($this->_backend);
++        $release6->update_1();
++        $this->setApplicationVersion('Calendar', '7.2');
++    }
 +}
@@@ -2,7 -2,7 +2,7 @@@
  <application>
      <name>Calendar</name>
      <!-- gettext('Calendar') -->   
-     <version>7.1</version>
 -    <version>6.2</version>
++    <version>7.2</version>
      <order>15</order>
      <status>enabled</status>
      <tables>