From: Janusz Dobrowolski Date: Wed, 13 May 2009 12:41:59 +0000 (+0000) Subject: Fixed error during new category addition. X-Git-Tag: v2.4.2~19^2~1389 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=80f65fcccf34fc034e369f44de103599de96fd87;p=fa-stable.git Fixed error during new category addition. --- diff --git a/inventory/includes/db/items_category_db.inc b/inventory/includes/db/items_category_db.inc index 71e9af34..2d3cefd1 100644 --- a/inventory/includes/db/items_category_db.inc +++ b/inventory/includes/db/items_category_db.inc @@ -16,7 +16,7 @@ function add_item_category($description, $tax_type_id, $sales_account, $sql = "INSERT INTO ".TB_PREF."stock_category (description, dflt_tax_type, dflt_units, dflt_mb_flag, dflt_sales_act, dflt_cogs_act, dflt_inventory_act, dflt_adjustment_act, dflt_assembly_act, - dflt_dim1, flt_dim2) + dflt_dim1, dflt_dim2) VALUES (" .db_escape($description)."," .db_escape($tax_type_id)."," diff --git a/inventory/includes/db/items_db.inc b/inventory/includes/db/items_db.inc index e3361552..dae24ac7 100644 --- a/inventory/includes/db/items_db.inc +++ b/inventory/includes/db/items_db.inc @@ -9,9 +9,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -function update_item($stock_id, $description, $long_description, $category_id, $tax_type_id, - $sales_account, $inventory_account, $cogs_account, $adjustment_account, - $assembly_account, $dimension_id, $dimension2_id) +function update_item($stock_id, $description, $long_description, $category_id, + $tax_type_id, $units='', $mb_flag='', $sales_account, $inventory_account, + $cogs_account, $adjustment_account, $assembly_account, $dimension_id, + $dimension2_id) { $sql = "UPDATE ".TB_PREF."stock_master SET long_description=".db_escape($long_description).", description=".db_escape($description).", @@ -23,17 +24,25 @@ function update_item($stock_id, $description, $long_description, $category_id, $ assembly_account='$assembly_account', dimension_id=$dimension_id, dimension2_id=$dimension2_id, - tax_type_id=$tax_type_id - WHERE stock_id='$stock_id'"; + tax_type_id=$tax_type_id"; + + if ($units != '') + $sql .= ", units=$units"; + + if ($mb_flag != '') + $sql .= ", mb_flag=$mb_flag"; + + $sql .= " WHERE stock_id='$stock_id'"; db_query($sql, "The item could not be updated"); 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, - $sales_account, $inventory_account, $cogs_account, $adjustment_account, - $assembly_account, $dimension_id, $dimension2_id) +function add_item($stock_id, $description, $long_description, $category_id, + $tax_type_id, $units, $mb_flag, $sales_account, $inventory_account, + $cogs_account, $adjustment_account, $assembly_account, $dimension_id, + $dimension2_id) { $sql = "INSERT INTO ".TB_PREF."stock_master (stock_id, description, long_description, category_id, tax_type_id, units, mb_flag, sales_account, inventory_account, cogs_account,