From: Janusz Dobrowolski Date: Mon, 22 Dec 2008 13:39:08 +0000 (+0000) Subject: Fixed item_codes table update on item creation. X-Git-Tag: v2.4.2~19^2~1658 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=49ca66437a07440dad4428e6596f3e7dabc5fc33;p=fa-stable.git Fixed item_codes table update on item creation. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c63e0de1..ca2f78ea 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/inventory/includes/db/items_codes_db.inc b/inventory/includes/db/items_codes_db.inc index c349cb1e..f464545f 100644 --- a/inventory/includes/db/items_codes_db.inc +++ b/inventory/includes/db/items_codes_db.inc @@ -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"; diff --git a/inventory/includes/db/items_db.inc b/inventory/includes/db/items_db.inc index 7a6bd4ff..78c228fb 100644 --- a/inventory/includes/db/items_db.inc +++ b/inventory/includes/db/items_db.inc @@ -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)