New combo3 class searchable from start of the code (used in gl accounts list).
[fa-stable.git] / sql / alter2.3.php
index e480eda5eb12eed2e79079ffb518722d7bd42890..c568245962f3a648890ebd5b1dd9c278f93a2c15 100644 (file)
@@ -26,7 +26,7 @@ class fa2_3 {
        //
        function install($pref, $force) 
        {
-               global $db_version;
+               global $db_version, $dflt_lang;
 
                if (!$this->preconf)
                        return false;
@@ -91,6 +91,7 @@ class fa2_3 {
                        if (!db_query($sql))
                                return false;
                }
+               $this->update_lang_cfg();
                return  update_company_prefs(array('version_id'=>$db_version), $pref);
        }
        //
@@ -137,14 +138,15 @@ class fa2_3 {
                include_once("$path_to_root/sales/includes/cart_class.inc");
                include_once("$path_to_root/purchasing/includes/po_class.inc");
                $cart = new cart(ST_SALESORDER);
-               $sql = "SELECT order_no FROM {$pref}sales_orders";
+               $sql = "SELECT order_no, trans_type FROM {$pref}sales_orders";
                $orders = db_query($sql);
                if (!$orders)
                        return false;
-
-               while ($order_no = db_fetch($orders)) {
-                       read_sales_order($order_no[0], $cart, ST_SALESORDER);
-                       $result = db_query("UPDATE {$pref}sales_orders SET total=".$cart->get_trans_total());
+               while ($order = db_fetch($orders)) {
+                       read_sales_order($order['order_no'], $cart, $order['trans_type']);
+                       $result = db_query("UPDATE {$pref}sales_orders 
+                               SET total=".$cart->get_trans_total()
+                               ." WHERE order_no=".$order[0]);
                        unset($cart->line_items);
                }
                unset($cart);
@@ -348,6 +350,21 @@ class fa2_3 {
                } else
                        return true;
        }
+       
+       function update_lang_cfg()
+       {
+               global $dflt_lang, $installed_languages;
+
+               foreach($installed_languages as $n => $lang) {
+                       if ($lang['code'] == 'en_GB') {
+                               $installed_languages[$n] = array('code'=>'C','name'=>'English',
+                                       'encoding'=>'iso-8859-1', 'path' => '', 'package' => '');
+                               if ($dflt_lang == 'en_GB')
+                                       $dflt_lang = 'C';
+                               write_lang();
+                       }
+               }
+       }
 }
 
 $install = new fa2_3;