Merge branch 'pu/inventory'
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 27 Nov 2012 09:17:38 +0000 (10:17 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 27 Nov 2012 09:17:38 +0000 (10:17 +0100)
- added update script 7.1 -> 7.2 (6.2)

Conflicts:
tine20/Inventory/Setup/Update/Release6.php
tine20/Inventory/Setup/setup.xml
tine20/Inventory/translations/hr_HR.po
tine20/Inventory/translations/it.po

1  2 
tine20/Inventory/Setup/Update/Release6.php
tine20/Inventory/Setup/Update/Release7.php
tine20/Inventory/Setup/setup.xml
tine20/Tinebase/js/ApplicationStarter.js

@@@ -35,13 -35,58 +35,68 @@@ class Inventory_Setup_Update_Release6 e
          $this->setTableVersion('inventory_item', '2');
      }
      
-     public function update_1()
+      /**
+      * Delete depreciation and amortization column
+      * Add depreciate_status
+      * Rename add_time to invoice_date
+      * Rename item_added to added_date and item_removed to removed_date
+      * Update ExportDefinitions
+      */
+     public function update_1()
+     {
+         $this->_backend->dropCol('inventory_item', 'depreciation');
+         $this->_backend->dropCol('inventory_item', 'amortization');
+     
+         $declaration = new Setup_Backend_Schema_Field_Xml('
+             <field>
+                 <name>depreciate_status</name>
+                 <type>boolean</type>
+                 <default>false</default>
+             </field>
+         ');
+         $this->_backend->addCol('inventory_item', $declaration, 16);
+     
+         $field = '
+             <field>
+                 <name>invoice_date</name>
+                 <type>datetime</type>
+                 <notnull>false</notnull>
+             </field>';
+     
+         $declaration = new Setup_Backend_Schema_Field_Xml($field);
+         $this->_backend->alterCol('inventory_item', $declaration, 'add_time');
+     
+         $field = '
+             <field>
+                 <name>added_date</name>
+                 <type>datetime</type>
+             </field>';
+     
+         $declaration = new Setup_Backend_Schema_Field_Xml($field);
+         $this->_backend->alterCol('inventory_item', $declaration, 'item_added');
+     
+         $field = '
+             <field>
+                 <name>removed_date</name>
+                 <type>datetime</type>
+             </field>';
+     
+         $declaration = new Setup_Backend_Schema_Field_Xml($field);
+         $this->_backend->alterCol('inventory_item', $declaration, 'item_removed');
+         
+         Setup_Controller::getInstance()->createImportExportDefinitions(Tinebase_Application::getInstance()->getApplicationByName('Inventory'));
+         
+         $this->setApplicationVersion('Inventory', '6.2');
+         $this->setTableVersion('inventory_item', '3');
+     }
++    
 +    /**
 +     * update to 7.0
 +     * 
 +     * @return void
 +     */
++    public function update_2()
 +    {
 +        $this->setApplicationVersion('Inventory', '7.0');
 +    }
  }
index 09752eb,0000000..a0d6b6f
mode 100644,000000..100644
--- /dev/null
@@@ -1,33 -1,0 +1,51 @@@
 +<?php
 +/**
 + * Tine 2.0
 + *
 + * @package     Inventory
 + * @subpackage  Setup
 + * @license     http://www.gnu.org/licenses/agpl.html AGPL3
 + * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
 + * @author      Philipp Schüle <p.schuele@metaways.de>
 + */
 +class Inventory_Setup_Update_Release7 extends Setup_Update_Abstract
 +{
 +    /**
 +     * update to 7.1
 +     * - add seq
 +     * 
 +     * @see 0000554: modlog: records can't be updated in less than 1 second intervals
 +     */
 +    public function update_0()
 +    {
 +        $declaration = Tinebase_Setup_Update_Release7::getRecordSeqDeclaration();
 +        try {
 +            $this->_backend->addCol('inventory_item', $declaration);
 +        } catch (Zend_Db_Statement_Exception $zdse) {
 +            // ignore
 +        }
 +        $this->setTableVersion('inventory_item', 3);
 +        
 +        Tinebase_Setup_Update_Release7::updateModlogSeq('Inventory_Model_InventoryItem', 'inventory_item');
 +        
 +        $this->setApplicationVersion('Inventory', '7.1');
 +    }
++    
++    /**
++     * update to 7.2
++     * 
++     * - Delete depreciation and amortization column
++     * - Add depreciate_status
++     * - Rename add_time to invoice_date
++     * - Rename item_added to added_date and item_removed to removed_date
++     * - Update ExportDefinitions
++     */
++    public function update_1()
++    {
++        if ($this->getTableVersion('inventory_item') != 3) {
++            $release6 = new Inventory_Setup_Update_Release6($this->_backend);
++            $release6->update_1();
++        }
++        $this->setApplicationVersion('Inventory', '6.2');
++    }
 +}
@@@ -2,7 -2,7 +2,7 @@@
  <application>
      <name>Inventory</name>
      <!-- gettext('Inventory') -->   
-     <version>7.1</version>
 -    <version>6.2</version>
++    <version>7.2</version>
      <order>60</order>
      <status>enabled</status>
      <tables>
                          <name>container_id</name>
                      </field>
                  </index>
-- 
              </declaration>
          </table>
      </tables>