Fixed 2.4 upgrade routines (column drop moved to post-upgrade cleanup).
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Thu, 16 Feb 2012 11:25:21 +0000 (12:25 +0100)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Thu, 16 Feb 2012 11:25:21 +0000 (12:25 +0100)
sql/alter2.4.php
sql/alter2.4.sql

index 898c566ac36c68e76e7f9f34e73d0e3019858f38..f48ca015406cee3597a812faead05a151b6a097b 100644 (file)
@@ -30,7 +30,9 @@ class fa2_4 {
                if (get_company_pref('grn_clearing_act') === null) { // available form 2.3.1, can be not defined on pre-2.4 installations
                        set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
                }
-               if ($this->update_workorders())
+               $result = $this->update_workorders();
+               if ($result)
+                       $result = $this->do_cleanup();
 //             return  update_company_prefs(array('version_id'=>$db_version));
                return true;
        }
@@ -83,6 +85,12 @@ class fa2_4 {
                }
                return true;
        }
+
+       function do_cleanup()
+       {
+               $sql = "ALTER TABLE `".TB_PREF."tax_group_items` DROP COLUMN `rate`";
+               return db_query($sql);
+       }
 }
 
 $install = new fa2_4;
index 2c9f698d8d3866eaa2a70773ebe27ab5fc67c361..73bbcef51e2df4f2767267c8980358257808ed30 100644 (file)
@@ -33,7 +33,7 @@ UPDATE `0_tax_group_items` tgi
        WHERE tgi.rate=(SELECT 0_tax_types.rate FROM 0_tax_types, 0_tax_groups 
                WHERE tax_shipping=1 AND tgi.tax_group_id=0_tax_groups.id AND tgi.tax_type_id=0_tax_types.id);
 ALTER TABLE `0_tax_groups` DROP COLUMN `tax_shipping`;
-ALTER TABLE `0_tax_group_items` DROP COLUMN `rate`;
+
 ALTER TABLE `0_sales_order_details` ADD KEY `stkcode` (`stk_code`);
 ALTER TABLE `0_purch_order_details` ADD KEY `itemcode` (`item_code`);
 ALTER TABLE `0_sys_prefs` CHANGE `value` `value` TEXT NOT NULL DEFAULT '';