Old ineffective sql_trail superseded by new improved db_trail logging only calls...
[fa-stable.git] / inventory / includes / db / items_category_db.inc
index 48984bb665a9844c0724166efef9859bfc6071c2..78f7092dc910f1986ebdc4b8943ef55403a84151 100644 (file)
@@ -13,6 +13,7 @@ function add_item_category($description, $tax_type_id, $sales_account,
        $cogs_account, $inventory_account, $adjustment_account, $wip_account, 
        $units, $mb_flag, $dim1, $dim2, $no_sale, $no_purchase, $vat_category)
 {
+       begin_transaction(__FUNCTION__, func_get_args());
        $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_wip_act, 
@@ -34,6 +35,7 @@ function add_item_category($description, $tax_type_id, $sales_account,
                .db_escape($vat_category).")";
 
        db_query($sql,"an item category could not be added");
+       commit_transaction();
 }
 
 function update_item_category($id, $description, $tax_type_id, 
@@ -41,6 +43,7 @@ function update_item_category($id, $description, $tax_type_id,
        $wip_account, $units, $mb_flag, $dim1, $dim2, $no_sale, $no_purchase, $vat_category)
 
 {
+       begin_transaction(__FUNCTION__, func_get_args());
        $sql = "UPDATE ".TB_PREF."stock_category SET "
                ."description = ".db_escape($description).","
                ."dflt_tax_type = ".db_escape($tax_type_id).","
@@ -59,13 +62,16 @@ function update_item_category($id, $description, $tax_type_id,
         ."WHERE category_id = ".db_escape($id);
 
        db_query($sql,"an item category could not be updated");
+       commit_transaction();
 }
 
 function delete_item_category($id)
 {
+       begin_transaction(__FUNCTION__, func_get_args());
        $sql="DELETE FROM ".TB_PREF."stock_category WHERE category_id=".db_escape($id);
 
        db_query($sql,"an item category could not be deleted");
+       commit_transaction();
 }
 
 function get_item_categories($show_inactive, $fixed_asset=false)