*** empty log message ***
[fa-stable.git] / sql / alter2.1.php
index 17fda983e27fe4774b8660c058b6d2f58146cc11..e5a5dbf8765bc209f1c7fd3301c9e7cd567f79dc 100644 (file)
@@ -1,4 +1,14 @@
 <?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU Affero General Public License,
+       AGPL, as published by the Free Software Foundation, either version 
+       3 of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+***********************************************************************/
 class fa2_1 {
        var $version = '2.1';   // version installed
        var $description = 'Version 2.1';
@@ -32,7 +42,7 @@ class fa2_1 {
                        }
                }
                // copy all item codes from stock_master into item_codes
-               $sql = "SELECT `stock_id`,`description` FROM `".$pref."stock_master`";
+               $sql = "SELECT `stock_id`,`description`,`category_id` FROM ".$pref."stock_master";
                $result = db_query($sql);
                if (!$result) {
                        display_error(_("Cannot select stock identificators")
@@ -41,9 +51,9 @@ class fa2_1 {
                } else {
                        while ($row = db_fetch_assoc($result)) {
                                $sql = "INSERT IGNORE "
-                                       .$pref."item_codes (`item_code`,`stock_id`,`description`)
+                                       .$pref."item_codes (`item_code`,`stock_id`,`description`,`category_id`)
                                        VALUES('".$row['stock_id']."','".$row['stock_id']."','"
-                                       .$row['description']."')";
+                                       .$row['description']."','".$row['category_id']."')";
                                $res2 = db_query($sql);
                                if (!$res2) {
                                        display_error(_("Cannot insert stock id into item_codes")
@@ -72,6 +82,7 @@ class fa2_1 {
        function installed($pref) {
                if (check_table($pref, 'item_codes')) return false;
                if (check_table($pref, 'company', 'foreign_codes')) return false;
+               if (check_table($pref, 'supplier', 'credit_limit') return false;                
                return true;
        }
 };