fix update path of Sales application
authorLars Kneschke <l.kneschke@metaways.de>
Wed, 18 Feb 2015 18:00:45 +0000 (19:00 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 18 Feb 2015 18:25:06 +0000 (19:25 +0100)
Change-Id: I1efacfbd5302e155dc10864aadb2ae254e1a38b7
Reviewed-on: http://gerrit.tine20.com/customers/1672
Reviewed-by: Lars Kneschke <l.kneschke@metaways.de>
Tested-by: Jenkins CI (http://ci.tine20.com/)
tine20/Sales/Setup/Update/Release8.php
tine20/Sales/Setup/setup.xml

index 067f5de..e0890f1 100644 (file)
@@ -772,12 +772,12 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
             $this->_createCustomerAndAddressTables();
         }
         
-        // repeat from update_4 if setup has been run on another branch
-        if (! $this->_backend->columnExists('seq', 'sales_divisions')) {
+        // repeat from update_3 if setup has been run on another branch
+        if ($this->getTableVersion('sales_divisions') < 2) {
             $this->_addDivisionsModlog();
         }
-        // repeat from update_4 if setup has been run on another branch
-        if (! $this->_backend->columnExists('start_date', 'sales_contracts')) {
+        // repeat from update_3 if setup has been run on another branch
+        if ($this->getTableVersion('sales_contracts') < 6) {
             $this->_updateContractsFields();
         }
         
@@ -1188,7 +1188,7 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
         $sql = 'UPDATE ' . $db->quoteIdentifier(SQL_TABLE_PREFIX . 'sales_products') . ' SET ' . $db->quoteInto($db->quoteIdentifier('accountable') . ' = ?', 'Sales_Model_Product');
         $db->query($sql);
         
-        if (! $this->_backend->columnExists('created_by', 'sales_product_agg')) {
+        if ($this->getTableVersion('sales_product_agg') < 3) {
             $this->_addModlogToProductAggregates();
         }
         try {
@@ -1226,7 +1226,7 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
      */
     public function update_16()
     {
-        if (! $this->_backend->columnExists('billing_point', 'sales_product_agg')) {
+        if ($this->getTableVersion('sales_product_agg') < 2) {
             $this->update_15();
         }
         
@@ -1352,12 +1352,11 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
             <notnull>false</notnull>
             <default>null</default>
         </field>';
-    
+        
         $declaration = new Setup_Backend_Schema_Field_Xml($field);
         $this->_backend->alterCol('sales_product_agg', $declaration);
-    
-    
-        $this->setTableVersion('sales_product_agg', 2);
+        
+        $this->setTableVersion('sales_product_agg', 4);
         $this->setApplicationVersion('Sales', '8.19');
     }
     
@@ -1459,10 +1458,14 @@ class Sales_Setup_Update_Release8 extends Setup_Update_Abstract
      */
     public function update_20()
     {
-        if ($this->_backend->tableVersionQuery('sales_product_agg') != '3') {
+        if ($this->getTableVersion('sales_product_agg') < 3) {
             $this->_addModlogToProductAggregates();
         }
         
+        if ($this->getTableVersion('sales_product_agg') < 4) {
+            $this->update_18();
+        }
+        
         $this->setApplicationVersion('Sales', '8.21');
     }
     
index 0fbc8ce..4812959 100644 (file)
         </table>
         <table>
             <name>sales_product_agg</name>
-            <version>3</version>
+            <version>4</version>
             <declaration>
                 <field>
                     <name>id</name>