Fixed regresion in inst_upgrade.php
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 11 Jan 2015 16:24:33 +0000 (17:24 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 11 Jan 2015 16:24:33 +0000 (17:24 +0100)
admin/inst_upgrade.php
sql/alter2.4.sql

index e7b4667c9ba6fc50dc5c250653091d11de0bd04c..16eee5a7a06ceaaf5c49bcc9dbecf25945650407 100644 (file)
@@ -52,16 +52,13 @@ function get_installers()
 //
 //     Apply one differential data set.
 //
-function upgrade_step($inst, $company, $conn) 
+function upgrade_step($inst, $company, $conn, $force
 {
        global $path_to_root;
 
        $pref = $conn['tbpref'];
        $ret = true;
 
-       $force = get_post('force_'.$index);
-       if ($force || get_post('install_'.$index)) 
-       {
                $state = $inst->installed($pref);
                if (!$state || $force) 
                {
@@ -85,7 +82,6 @@ function upgrade_step($inst, $company, $conn)
                                display_error(_("Upgrade cannot be done because database has been already partially upgraded. Please downgrade database to clean previous version or try forced upgrade."));
                                $ret = false;
                        }
-       }
        return $ret;
 }
 
@@ -110,7 +106,10 @@ if (get_post('Upgrade'))
                foreach ($installers as $i => $inst) 
                {
 
-                       $ret = upgrade_step($installers[$index], $i, $comp, $conn);
+                       $force = get_post('force_'.$i);
+                       if ($force || get_post('install_'.$i)) 
+                               $ret = upgrade_step($installers[$i], $comp, $conn, $force);
+
                        if (!$ret)
                        {
                                display_error(
index 2d5725e6058a871b255df81bbd864122bf533fb9..1ab1effbab77e4d810eb4a389bc33c94ebd8d93f 100644 (file)
@@ -2,7 +2,7 @@ ALTER TABLE `0_suppliers` ADD COLUMN  `tax_algorithm` tinyint(1) NOT NULL defaul
 ALTER TABLE `0_supp_trans` ADD COLUMN `tax_algorithm` tinyint(1) NULL default '1' AFTER `tax_included`;
 INSERT INTO `0_sys_prefs` VALUES('tax_algorithm','glsetup.customer', 'tinyint', 1, '1');
 INSERT INTO `0_sys_prefs` VALUES('gl_closing_date','setup.closing_date', 'date', 8, '');
-ALTER TABLE `0_audit_trail` CHANGE   `fiscal_year` int(11) NOT NULL default 0,
+ALTER TABLE `0_audit_trail` CHANGE `fiscal_year` `fiscal_year` int(11) NOT NULL default 0;
 
 # Fix eventual invalid date/year in audit records
 UPDATE `0_audit_trail` audit