X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=inventory%2Fmanage%2Fitem_categories.php;h=b52d67c812b27497a42eb5f4a54258bd37086148;hb=4274e2d6ed6f5ee12bdf8425138ccdca1b92a95b;hp=a12f56ff0da23e06975e8a06d77615c27390831e;hpb=ebc600101ceab69c06eac4b1bd4d1782af45de05;p=fa-stable.git diff --git a/inventory/manage/item_categories.php b/inventory/manage/item_categories.php index a12f56ff..b52d67c8 100644 --- a/inventory/manage/item_categories.php +++ b/inventory/manage/item_categories.php @@ -67,10 +67,7 @@ if ($Mode == 'Delete') { // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master' - $sql= "SELECT COUNT(*) FROM ".TB_PREF."stock_master WHERE category_id=".db_escape($selected_id); - $result = db_query($sql, "could not query stock master"); - $myrow = db_fetch_row($result); - if ($myrow[0] > 0) + if (key_in_foreign_table($selected_id, 'stock_master', 'category_id')) { display_error(_("Cannot delete this item category because items have been created using this item category.")); } @@ -94,14 +91,10 @@ if (list_updated('mb_flag')) { } //---------------------------------------------------------------------------------- -$sql = "SELECT c.*, t.name as tax_name FROM ".TB_PREF."stock_category c, " - .TB_PREF."item_tax_types t WHERE c.dflt_tax_type=t.id"; -if (!check_value('show_inactive')) $sql .= " AND !c.inactive"; - -$result = db_query($sql, "could not get stock categories"); +$result = get_item_categories(check_value('show_inactive')); start_form(); -start_table("$table_style width=80%"); +start_table(TABLESTYLE, "width=80%"); $th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"), _("Inventory Account"), _("COGS Account"), _("Adjustment Account"), _("Assembly Account"), "", ""); @@ -136,7 +129,7 @@ echo '
'; //---------------------------------------------------------------------------------- div_start('details'); -start_table($table_style2); +start_table(TABLESTYLE2); if ($selected_id != -1) {