Improved calculation of standard cost in advanced manufacturing even if qoh = 0.
[fa-stable.git] / sql / alter2.2.php
index c5345233f9dad968a351735b71f50b2df0a31924..0f8591b2eee748e2f8461502c58ca5e4403efb26 100644 (file)
@@ -118,9 +118,13 @@ class fa2_2 {
                $patchcnt = 0;
                if (!$this->beta) {
                        $n = 16;
-                       if (check_table($pref, 'company', 'custom1_name')) $patchcnt++;
-                       if (!check_table($pref, 'company', 'profit_loss_year_act')) $patchcnt++;
-                       if (!check_table($pref, 'company', 'login_tout')) $patchcnt++;
+                       if (check_table($pref, 'company')) // skip in 2.3
+                               $n -= 3;
+                       else {
+                               if (check_table($pref, 'company', 'custom1_name')) $patchcnt++;
+                               if (!check_table($pref, 'company', 'profit_loss_year_act'))     $patchcnt++;
+                               if (!check_table($pref, 'company', 'login_tout')) $patchcnt++;
+                       }
                        if (!check_table($pref, 'stock_category', 'dflt_no_sale')) $patchcnt++;
                        if (!check_table($pref, 'users', 'sticky_doc_date')) $patchcnt++;
                        if (!check_table($pref, 'users', 'startup_tab')) $patchcnt++;
@@ -254,19 +258,11 @@ function fix_extensions() {
                $ext['tab'] = $ext['name'];
                $ext['name'] = access_string($ext['title'], true); 
                $ext['path'] = $ext['folder']; unset($ext['folder']);
-               $ext['type'] = 'module';
+               $ext['type'] = 'extension';
                $ext['active'] = '1';
                $exts[] = $ext;
        }
 
-       include($path_to_root.'/modules/installed_modules.php');
-       foreach($installed_modules as $mod) {
-               $mod['title'] = $mod['name'];
-               $mod['name'] = access_string($mod['name'], true);
-               $mod['type'] = 'plugin';
-               $ext['active'] = '1';
-               $exts[] = $mod;
-       }
        if (!write_extensions($exts))
                return false;
        
@@ -303,6 +299,9 @@ function sanitize_database($pref, $test = false) {
                        }
                }
 
+               if (empty($keys)) { // comments table have no primary key, so let's give up
+                       continue;
+               }
                if ($test)
                        error_log("Table $table (".implode(',',$keys)."):(".implode(',',$textcols)."):");
 
@@ -326,9 +325,10 @@ function sanitize_database($pref, $test = false) {
                                $key[] = $k.'=\''.$rec[substr($k,1,-1)].'\'';
                        }
                        $sql .= implode( ' AND ', $key);
-                       if ($test)
+                       if ($test) {
+                               error_log($sql);
                                error_log("\t(".implode(',',$val).") updated");
-                       else
+                       else
                                db_query($sql, 'cannot update record');
                }
        }