From 512f9dbe2a3dc1282358c6641ebd715e1bae5136 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 11 Mar 2008 21:09:11 +0000 Subject: [PATCH] Units of measure moved from config.php into item_units table --- applications/inventory.php | 2 +- inventory/includes/db/items_units_db.inc | 56 ++++++++++ inventory/includes/inventory_db.inc | 1 + inventory/manage/item_units.php | 134 +++++++++++++++++++++++ inventory/manage/items.php | 3 - sql/alter.sql | 10 ++ 6 files changed, 202 insertions(+), 4 deletions(-) create mode 100644 inventory/includes/db/items_units_db.inc create mode 100644 inventory/manage/item_units.php diff --git a/applications/inventory.php b/applications/inventory.php index 620e1bc4..5fa7d5e1 100644 --- a/applications/inventory.php +++ b/applications/inventory.php @@ -23,7 +23,7 @@ $this->add_lapp_function(2, _("Inventory Locations"),"inventory/manage/locations.php?"); $this->add_rapp_function(2, _("Inventory Movement Types"),"inventory/manage/movement_types.php?"); $this->add_rapp_function(2, _("Item Tax Types"),"taxes/item_tax_types.php?"); - $this->add_rapp_function(2, "",""); + $this->add_rapp_function(2, _("Units of Measure"),"inventory/manage/item_units.php?"); $this->add_rapp_function(2, _("Reorder Levels"),"inventory/reorder_level.php?"); $this->add_module(_("Pricing and Costs")); diff --git a/inventory/includes/db/items_units_db.inc b/inventory/includes/db/items_units_db.inc new file mode 100644 index 00000000..f755fed5 --- /dev/null +++ b/inventory/includes/db/items_units_db.inc @@ -0,0 +1,56 @@ + 0); +} + +function get_all_item_units() { + $sql = "SELECT * FROM ".TB_PREF."item_units ORDER BY name"; + return db_query($sql, "could not get stock categories"); +} +?> \ No newline at end of file diff --git a/inventory/includes/inventory_db.inc b/inventory/includes/inventory_db.inc index b48fc54a..1faf253f 100644 --- a/inventory/includes/inventory_db.inc +++ b/inventory/includes/inventory_db.inc @@ -12,5 +12,6 @@ include_once($path_to_root . "/inventory/includes/db/items_locations_db.inc"); include_once($path_to_root . "/inventory/includes/db/movement_types_db.inc"); include_once($path_to_root . "/inventory/includes/db/items_adjust_db.inc"); include_once($path_to_root . "/inventory/includes/db/items_transfer_db.inc"); +include_once($path_to_root . "/inventory/includes/db/items_units_db.inc"); ?> \ No newline at end of file diff --git a/inventory/manage/item_units.php b/inventory/manage/item_units.php new file mode 100644 index 00000000..0df22f8e --- /dev/null +++ b/inventory/manage/item_units.php @@ -0,0 +1,134 @@ + diff --git a/inventory/manage/items.php b/inventory/manage/items.php index af08d027..486a3d16 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -319,9 +319,6 @@ item_tax_types_list_row(_("Item Tax Type:"), 'tax_type_id', null); stock_item_types_list_row(_("Item Type:"), 'mb_flag', null, (!isset($_POST['NewStockID']) || isset($_POST['New']))); -/* The array stock_units is set up in config.php for user modification -possible units of measure can added or modifying the array definition by editing that file */ - stock_units_list_row(_('Units of Measure:'), 'units', null, (!isset($_POST['NewStockID']) || isset($_POST['New']))); end_table(); diff --git a/sql/alter.sql b/sql/alter.sql index 3a98d59f..ae2fd817 100644 --- a/sql/alter.sql +++ b/sql/alter.sql @@ -16,6 +16,16 @@ -- ALTER TABLE -- +CREATE TABLE `0_item_units` ( + `abbr` VARCHAR(20) NOT NULL, + `name` VARCHAR(40) NOT NULL, + `decimals` TINYINT(2) NOT NULL, + PRIMARY KEY (`abbr`), + UNIQUE (`name`) +) +TYPE = myisam +COMMENT = 'units of measure'; + DROP TABLE IF EXISTS `0_form_items`; ALTER TABLE `0_tax_types` DROP INDEX `name`, ADD UNIQUE `name` ( `name` , `rate` ); -- 2.30.2