$sales_account, $inventory_account, $cogs_account, $adjustment_account,
$assembly_account, $dimension_id, $dimension2_id)
{
- $sql = "UPDATE ".TB_PREF."stock_master SET long_description='$long_description',
- description='$description',
+ $sql = "UPDATE ".TB_PREF."stock_master SET long_description=".db_escape($long_description).",
+ description=".db_escape($description).",
category_id='$category_id',
sales_account='$sales_account',
inventory_account='$inventory_account',
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,
$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,
adjustment_account, assembly_account, dimension_id, dimension2_id)
- VALUES ('$stock_id', '$description', '$long_description',
+ VALUES (".db_escape($stock_id).", ".db_escape($description).", ".db_escape($long_description).",
'$category_id', $tax_type_id, '$units', '$mb_flag',
'$sales_account', '$inventory_account', '$cogs_account',
'$adjustment_account', '$assembly_account', $dimension_id, $dimension2_id)";
SELECT ".TB_PREF."locations.loc_code, '$stock_id' FROM ".TB_PREF."locations";
db_query($sql, "The item locstock could not be added");
+
+ add_item_code($stock_id, $stock_id, $description, $category_id, 1, 0);
}
function delete_item($stock_id)
/*and cascade delete the bill of material if any */
$sql = "DELETE FROM ".TB_PREF."bom WHERE parent='$stock_id'";
db_query($sql, "could not delete stock item bom");
+
+ delete_item_kit($stock_id);
}
function get_item($stock_id)