Fixed item_codes table update on item creation.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 22 Dec 2008 13:39:08 +0000 (13:39 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 22 Dec 2008 13:39:08 +0000 (13:39 +0000)
CHANGELOG.txt
inventory/includes/db/items_codes_db.inc
inventory/includes/db/items_db.inc

index c63e0de1b4a9cd2e75fd4a9181067c1549a2d693..ca2f78ea55aaada7643a3c8d96e7d9eb03d3c681 100644 (file)
@@ -19,6 +19,11 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+22-Dec-2008 Janusz Dobrowolski
+# Fixed item_code database update on item creation.
+$ /inventory/includes/db/item_codes_db.inc
+  /inventory/includes/db/items_db.inc
+
 21-Dec-2008 Joe Hunt
 # Minor bugs in layout and quick entries.
 $ /Includes/ui/ui_view.inc
index c349cb1ef09d7c0dffd5ac8b7e13ef8f235bcb23..f464545f9ae9410f680169668a175d2fc4da9e7b 100644 (file)
@@ -15,7 +15,7 @@ function update_item_code($id, $item_code, $stock_id, $description, $category, $
                WHERE ";
                        
        if ($id == -1) // update with unknown $id i.e. from items table editor
-               "item_code = ".db_escape($item_code)
+               $sqk .= "item_code = ".db_escape($item_code)
                ." AND stock_id = ".db_escape($stock_id);
        else
                $sql .= "id = $id";
index 7a6bd4ff48bf8d15c2451467fd71a73169353f76..78c228fbdb8fabe1abb58095495de11362cd6609 100644 (file)
@@ -19,7 +19,7 @@ function update_item($stock_id, $description, $long_description, $category_id, $
 
        db_query($sql, "The item could not be updated");
 
-       update_item_code(-1, $stock_id, $stock_id, $description, 1, 0);
+       update_item_code(-1, $stock_id, $stock_id, $description, $category_id, 1, 0);
 }
 
 function add_item($stock_id, $description, $long_description, $category_id, $tax_type_id, $units, $mb_flag,
@@ -41,7 +41,7 @@ function add_item($stock_id, $description, $long_description, $category_id, $tax
 
        db_query($sql, "The item locstock could not be added");
 
-       add_item_code($stock_id, $stock_id, $description, 1, 0);
+       add_item_code($stock_id, $stock_id, $description, $category_id, 1, 0);
 }
 
 function delete_item($stock_id)