Merge branch '2014.11-develop' into 2015.07
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 18 Nov 2015 12:47:38 +0000 (13:47 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 18 Nov 2015 12:47:38 +0000 (13:47 +0100)
Conflicts:
tine20/Sales/translations/de.po
tine20/Tinebase/Setup/Update/Release8.php
tine20/Tinebase/Setup/setup.xml
tine20/Tinebase/User.php
tine20/Tinebase/js/LoginPanel.js

Change-Id: I85c9c16281c11702c4ef2bce6c9da60c48d2e9f6

20 files changed:
1  2 
tests/tine20/Admin/JsonTest.php
tests/tine20/Tinebase/Frontend/CliTest.php
tine20/ActiveSync/Config.php
tine20/Addressbook/Config.php
tine20/Admin/Frontend/Json.php
tine20/Calendar/Config.php
tine20/Calendar/Controller/Event.php
tine20/Calendar/Model/Attender.php
tine20/Sales/js/SupplierEditDialog.js
tine20/Sales/translations/de.po
tine20/Setup/Backend/Mysql.php
tine20/Tinebase/Config.php
tine20/Tinebase/Config/Abstract.php
tine20/Tinebase/Core.php
tine20/Tinebase/Frontend/Json.php
tine20/Tinebase/Setup/Update/Release8.php
tine20/Tinebase/Setup/Update/Release9.php
tine20/Tinebase/Setup/setup.xml
tine20/Tinebase/Tinebase.jsb2
tine20/composer.json

@@@ -1137,7 -1140,91 +1137,91 @@@ class Admin_JsonTest extends TestCas
          $afj = new Admin_Frontend_Json();
          $registryData = $afj->getRegistryData();
  
 -        $this->assertEquals($registryData['primarydomain'], 'localhost');
 -        $this->assertEquals($registryData['secondarydomains'], 'example.com');
 +        $this->assertEquals($registryData['primarydomain'],  $primaryDomainConfig);
 +        $this->assertEquals($registryData['secondarydomains'], $secondaryDomainConfig);
      }
+ //    public function testGetConfig()
+ //    {
+ //        $afj = new Admin_Frontend_Json();
+ //        $config = $afj->getConfig('Calendar');
+ //
+ //        $this->assertGreaterThanOrEqual(2, count($config));
+ //        $this->assertArrayHasKey('attendeeRoles', $config);
+ //        $this->assertArrayHasKey('records', $config['attendeeRoles']);
+ //        $this->assertGreaterThanOrEqual(1, $config['attendeeRoles']['records']);
+ //    }
+ //
+ //    public function testSetConfig()
+ //    {
+ //        $afj = new Admin_Frontend_Json();
+ //        $config = $afj->getConfig('Calendar');
+ //
+ //        $attendeeRoles = $config['attendeeRoles'];
+ //        $attendeeRoles['records'][] = array(
+ //            'id'    => 'CHAIR',
+ //            'value' => 'Chair'
+ //        );
+ //
+ //        $afj->setConfig('Calendar', 'attendeeRoles', $attendeeRoles);
+ //
+ //        $updatedConfig = $afj->getConfig('Calendar');
+ //        $this->assertEquals(count($attendeeRoles['records']), count($updatedConfig['attendeeRoles']['records']));
+ //    }
+     public function testSearchConfigs()
+     {
+         $afj = new Admin_Frontend_Json();
+         $result = $afj->searchConfigs(array(
+             'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId()
+         ), array());
+         $this->assertGreaterThanOrEqual(2, $result['totalcount']);
+         $attendeeRoles = NULL;
+         foreach($result['results'] as $configData) {
+             if ($configData['name'] == 'attendeeRoles') {
+                 $attendeeRoles = $configData;
+                 break;
+             }
+         }
+         $this->assertNotNull($attendeeRoles);
+         $this->assertContains('{', $attendeeRoles);
+         return $attendeeRoles;
+     }
+     public function testGetConfig()
+     {
+         $attendeeRoles = $this->testUpdateConfig();
+         $afj = new Admin_Frontend_Json();
+         $fetchedAttendeeRoles = $afj->getConfig($attendeeRoles['id']);
+         $this->assertEquals($attendeeRoles['value'], $fetchedAttendeeRoles['value']);
+     }
+     public function testUpdateConfig()
+     {
+         $attendeeRoles = $this->testSearchConfigs();
+         $keyFieldConfig = json_decode($attendeeRoles['value'], true);
+         $keyFieldConfig['records'][] = array(
+             'id'    => 'CHAIR',
+             'value' => 'Chair'
+         );
+         $attendeeRoles['value'] = json_encode($keyFieldConfig);
+         $attendeeRoles['id'] = '';
+         $afj = new Admin_Frontend_Json();
+         $afj->saveConfig($attendeeRoles);
+         $updatedAttendeeRoles = $this->testSearchConfigs();
+         $this->assertEquals($attendeeRoles['value'], $updatedAttendeeRoles['value']);
+         return $updatedAttendeeRoles;
+     }
  }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -756,29 -924,70 +756,29 @@@ msgstr "Mehrwertsteuer in Prozent
  msgid "automatically set..."
  msgstr "automatisch ausgefüllt..."
  
 -#: js/AddressEditDialog.js:77 js/DeliveryAddressGridPanel.js:39
 -msgid "Delivery Address"
 -msgstr "Lieferanschrift"
 -
 -#: js/AddressEditDialog.js:84
 -#, python-brace-format
 -msgid "Edit {0} \"{1}\""
 -msgstr "{0} \"{1}\" bearbeiten"
 -
 -#: js/AddressEditDialog.js:87
 -msgid "Add new Billing Address"
 -msgstr "Neue Rechnungsanschrift hinzufügen"
 -
 -#: js/AddressEditDialog.js:89
 -msgid "Add new Delivery Address"
 -msgstr "Neue Lieferanschrift hinzufügen"
 -
 -#: js/AddressEditDialog.js:128
 -msgid "Apply postal address"
 -msgstr "Postanschrift anwenden"
 -
 -#: js/OfferEditDialog.js:54
 -msgid "Add New Offer"
 -msgstr "Neues Angebot hinzufügen"
 -
 -#: js/OfferEditDialog.js:160 js/CustomerEditDialog.js:412
 -#: js/PurchaseInvoiceEditDialog.js:502 js/OrderConfirmationEditDialog.js:171
 -#: js/SupplierEditDialog.js:378
 -msgid "Enter description"
 -msgstr "Bitte geben Sie eine Beschreibung an"
 -
 -#: js/Sales-FAT-debug.js:49 js/Sales-FAT-debug.js:242
 -msgid "record list"
 -msgid_plural "record lists"
 -msgstr[0] ""
 -msgstr[1] ""
 -
 -#: js/Sales-FAT-debug.js:199
 -msgid "CostCenter"
 -msgid_plural "CostCenters"
 -msgstr[0] "Kostenstelle"
 -msgstr[1] "Kostenstellen"
 +#: js/DivisionEditDialog.js:52
 +msgid "Add New Division"
 +msgstr "Neue Abteilung hinzufügen"
  
 -#: js/Sales-FAT-debug.js:202
 -msgid "All CostCenters"
 -msgid_plural "All CostCenters"
 -msgstr[0] "Alle Kostenstellen"
 -msgstr[1] "Alle Kostenstellen"
 +#: js/AdminPanel.js:61 js/BillingDateDialog.js:127
 +msgid "Cancel"
 +msgstr "Abbrechen"
  
 -#: js/Sales-FAT-debug.js:1219
 -msgid "Company"
 -msgstr "Firma"
 +#: js/AdminPanel.js:69
 +msgid "OK"
 +msgstr "OK"
  
 -#: js/BillingDateDialog.js:135 js/CopyAddressDialog.js:121
 -msgid "Ok"
 -msgstr "Ok"
 +#: js/AdminPanel.js:90
 +msgid "Loading..."
 +msgstr "Lade ..."
  
 -#: js/InvoiceDetailsPanel.js:66 js/PurchaseInvoiceDetailsPanel.js:66
 -msgid "Select invoice"
 -msgstr "Rechnung auswählen"
 +#: js/AdminPanel.js:142
 +msgid "Euro (€)"
 +msgstr "Euro (€)"
  
- #: js/CustomerEditDialog.js:45 js/SupplierEditDialog.js:41
- msgid "Either street or postbox is required!"
- msgstr "Bitte geben Sie entweder eine Straße oder ein Postfach an!"
+ #: js/CustomerEditDialog.js:45 js/SupplierEditDialog.js:45
+ msgid "Either postalcode or postbox is required!"
+ msgstr "Bitte geben Sie entweder eine Postleitzahl oder ein Postfach an!"
  
  #: js/CustomerEditDialog.js:66
  msgid "Copy Customer"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -568,12 -571,178 +573,189 @@@ class Tinebase_Setup_Update_Release8 ex
      }
  
      /**
-     public function update_13()
+      * adds ondelete cascade to some indices (tags + roles)
+      *
+      * @see 0010249: Tinebase.purgeDeletedRecords fails
+      */
+     public function update_13()
+     {
+         $indexToChange = array(array(
+             'table'         => 'tags_acl',
+             'tableversion'  => 3,
+             'name'          => 'tags_acl::tag_id--tags::id',
+             'xml'           => '
+                 <index>
+                     <name>tags_acl::tag_id--tags::id</name>
+                     <field>
+                         <name>tag_id</name>
+                     </field>
+                     <foreign>true</foreign>
+                     <reference>
+                         <table>tags</table>
+                         <field>id</field>
+                         <ondelete>cascade</ondelete>
+                     </reference>
+                 </index>'
+         ), array(
+             'table'         => 'tags_context',
+             'tableversion'  => 2,
+             'name'          => 'tags_context::tag_id--tags::id',
+             'xml'           => '
+                 <index>
+                     <name>tags_context::tag_id--tags::id</name>
+                     <field>
+                         <name>tag_id</name>
+                     </field>
+                     <foreign>true</foreign>
+                     <reference>
+                         <table>tags</table>
+                         <field>id</field>
+                         <ondelete>cascade</ondelete>
+                     </reference>
+                 </index>
+             '
+         ), array(
+             'table'         => 'tagging',
+             'tableversion'  => 2,
+             'name'          => 'tagging::tag_id--tags::id',
+             'xml'           => '
+                 <index>
+                     <name>tagging::tag_id--tags::id</name>
+                     <field>
+                         <name>tag_id</name>
+                     </field>
+                     <foreign>true</foreign>
+                     <reference>
+                         <table>tags</table>
+                         <field>id</field>
+                         <ondelete>cascade</ondelete>
+                     </reference>
+                 </index>
+             '
+         ), array(
+             'table'         => 'role_rights',
+             'tableversion'  => 2,
+             'name'          => 'role_rights::role_id--roles::id',
+             'xml'           => '
+                 <index>
+                     <name>role_rights::role_id--roles::id</name>
+                     <field>
+                         <name>role_id</name>
+                     </field>
+                     <foreign>true</foreign>
+                     <reference>
+                         <table>roles</table>
+                         <field>id</field>
+                         <ondelete>cascade</ondelete>
+                     </reference>
+                 </index>
+             '
+         ), array(
+             'table'         => 'role_accounts',
+             'tableversion'  => 3,
+             'name'          => 'role_accounts::role_id--roles::id',
+             'xml'           => '
+                  <index>
+                     <name>role_accounts::role_id--roles::id</name>
+                     <field>
+                         <name>role_id</name>
+                     </field>
+                     <foreign>true</foreign>
+                     <reference>
+                         <table>roles</table>
+                         <field>id</field>
+                         <ondelete>cascade</ondelete>
+                     </reference>
+                 </index>
+             '
+         ));
+         foreach ($indexToChange as $index) {
+             if ($this->getTableVersion($index['table']) < $index['tableversion']) {
+                 try {
+                     $this->_backend->dropIndex($index['table'], $index['name']);
+                 } catch (Zend_Db_Statement_Exception $zdse) {
+                     if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+                         . ' ' . $zdse->getMessage());
+                 }
+                 try {
+                     $declaration = new Setup_Backend_Schema_Index_Xml($index['xml']);
+                     $this->_backend->addIndex($index['table'], $declaration);
+                     $this->setTableVersion($index['table'], $index['tableversion']);
+                 } catch (Zend_Db_Statement_Exception $zdse) {
+                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ .
+                         ' Index ' . $index['name'] . ' already exists.');
+                 }
+             }
+         }
+         $this->setApplicationVersion('Tinebase', '8.14');
+     }
+     /**
+      * update to 8.15
+      *
+      * move keyFieldConfig defaults to config files
+      */
+     public function update_14()
+     {
+         // either put default to DB or delete form DB
+         $cb = new Tinebase_Backend_Sql(array(
+             'modelName' => 'Tinebase_Model_Config',
+             'tableName' => 'config',
+         ));
+         $configRecords = $cb->getAll();
+         // iterate installed apps
+         foreach (Tinebase_Application::getInstance()->getApplications() as $application) {
+             try {
+                 // get config
+                 $config = Tinebase_Config::getAppConfig($application->name);
+                 if (! method_exists($config, 'getProperties'))  {
+                     continue;
+                 }
+                 foreach($config->getProperties() as $name => $property) {
+                     if ($property['type'] == Tinebase_Config_Abstract::TYPE_KEYFIELD_CONFIG) {
+                         $dbConfig = $config->get($name);
+                         $dbConfigRecords = $dbConfig['records']->toArray();
+                         $defaultRecords = $property['default']['records'];
+                         if (json_encode($dbConfigRecords) != json_encode($defaultRecords)) {
+                             // set default value
+                             if (array_key_exists('default', $property['default'])) {
+                                 $dbConfig->default = $property['default']['default'];
+                                 $config->set($name, $dbConfig->toArray());
+                             }
+                         } else {
+                             // delete default config
+                             $configRecord = $configRecords
+                                 ->filter('application_id', $application->getId())
+                                 ->filter('name', $name)
+                                 ->getFirstRecord();
+                             if ($configRecord) {
+                                 $cb->delete($configRecord->getId());
+                             }
+                         }
+                     }
+                 }
+             } catch(Exception $e) {
+                 Setup_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' could not migrate keyFieldConfig ' . $e);
+             }
+         }
+         $this->setApplicationVersion('Tinebase', '8.15');
+     }
++
++    /**
 +     * update to 9.0
 +     *
 +     * @return void
 +     */
++    public function update_15()
 +    {
 +        $this->setApplicationVersion('Tinebase', '9.0');
 +    }
++
  }
index 2cbc70d,0000000..b4134de
mode 100644,000000..100644
--- /dev/null
@@@ -1,36 -1,0 +1,60 @@@
 +<?php
 +/**
 + * Tine 2.0
 + *
 + * @package     Tinebase
 + * @subpackage  Setup
 + * @license     http://www.gnu.org/licenses/agpl.html AGPL3
 + * @copyright   Copyright (c) 2015 Metaways Infosystems GmbH (http://www.metaways.de)
 + * @author      Philipp Schüle <p.schuele@metaways.de>
 + */
 +class Tinebase_Setup_Update_Release9 extends Setup_Update_Abstract
 +{
 +    /**
 +     * update to 9.1
 +     * 
 +     * @see 0011178: allow to lock preferences for individual users
 +     */
 +    public function update_0()
 +    {
 +        $update8 = new Tinebase_Setup_Update_Release8($this->_backend);
 +        $update8->update_11();
 +        $this->setApplicationVersion('Tinebase', '9.1');
 +    }
 +
 +    /**
 +     * update to 9.2
 +     *
 +     * adds index to relations
 +     */
 +    public function update_1()
 +    {
 +        $update8 = new Tinebase_Setup_Update_Release8($this->_backend);
 +        $update8->update_12();
 +        $this->setApplicationVersion('Tinebase', '9.2');
 +    }
++
++    /**
++     * update to 9.3
++     *
++     * adds ondelete cascade to some indices (tags + roles)
++     */
++    public function update_2()
++    {
++        $update8 = new Tinebase_Setup_Update_Release8($this->_backend);
++        $update8->update_13();
++        $this->setApplicationVersion('Tinebase', '9.3');
++    }
++
++    /**
++     * update to 9.4
++     *
++     * move keyFieldConfig defaults to config files
++     */
++    public function update_3()
++    {
++        $update8 = new Tinebase_Setup_Update_Release8($this->_backend);
++        $update8->update_14();
++        $this->setApplicationVersion('Tinebase', '9.4');
++    }
 +}
@@@ -1,7 -1,7 +1,7 @@@
  <?xml version="1.0" encoding="utf-8"?>
  <application>
      <name>Tinebase</name>
-     <version>9.2</version>
 -    <version>8.15</version>
++    <version>9.4</version>
      <tables>
          <table>
              <name>applications</name>
Simple merge
Simple merge