From: Janusz Dobrowolski Date: Mon, 6 Apr 2015 09:18:13 +0000 (+0200) Subject: Removed obsolete Movement Types handling. X-Git-Tag: v2.4.2~19^2~213 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=cfaa5cec1f5137bcc1599a4306879e3265d1dacd;p=fa-stable.git Removed obsolete Movement Types handling. --- diff --git a/applications/inventory.php b/applications/inventory.php index 1c4b4277..965109b6 100644 --- a/applications/inventory.php +++ b/applications/inventory.php @@ -38,10 +38,8 @@ class inventory_app extends application "inventory/manage/sales_kits.php?", 'SA_SALESKIT', MENU_MAINTENANCE); $this->add_lapp_function(2, _("Item &Categories"), "inventory/manage/item_categories.php?", 'SA_ITEMCATEGORY', MENU_MAINTENANCE); - $this->add_lapp_function(2, _("Inventory &Locations"), + $this->add_rapp_function(2, _("Inventory &Locations"), "inventory/manage/locations.php?", 'SA_INVENTORYLOCATION', MENU_MAINTENANCE); - $this->add_rapp_function(2, _("Inventory &Movement Types"), - "inventory/manage/movement_types.php?", 'SA_INVENTORYMOVETYPE', MENU_MAINTENANCE); $this->add_rapp_function(2, _("&Units of Measure"), "inventory/manage/item_units.php?", 'SA_UOM', MENU_MAINTENANCE); $this->add_rapp_function(2, _("&Reorder Levels"), diff --git a/includes/data_checks.inc b/includes/data_checks.inc index 272584c3..7ce8d668 100644 --- a/includes/data_checks.inc +++ b/includes/data_checks.inc @@ -118,22 +118,6 @@ function check_db_has_tax_groups($msg) } } -function db_has_movement_types() -{ - return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."movement_types"); -} - -function check_db_has_movement_types($msg) -{ - global $path_to_root; - if (!db_has_movement_types()) - { - display_error($msg, true); - end_page(); - exit; - } -} - function db_customer_has_branches($customer_id) { return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."cust_branch " diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index e5e113e4..6170e79f 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -1312,29 +1312,6 @@ function sales_types_list_row($label, $name, $selected_id=null, $submit_on_chang //----------------------------------------------------------------------------------------------- -function movement_types_list($name, $selected_id=null) -{ - $sql = "SELECT id, name FROM ".TB_PREF."movement_types"; - return combo_input($name, $selected_id, $sql, 'id', 'name', array()); -} - -function movement_types_list_cells($label, $name, $selected_id=null) -{ - if ($label != null) - echo "$label\n"; - echo ""; - echo movement_types_list($name, $selected_id); - echo "\n"; -} - -function movement_types_list_row($label, $name, $selected_id=null) -{ - echo "$label"; - movement_types_list_cells(null, $name, $selected_id); - echo "\n"; -} - -//----------------------------------------------------------------------------------------------- function _format_date($row) { return sql2date($row['reconciled']); diff --git a/inventory/includes/db/movement_types_db.inc b/inventory/includes/db/movement_types_db.inc deleted file mode 100644 index cb5bff32..00000000 --- a/inventory/includes/db/movement_types_db.inc +++ /dev/null @@ -1,74 +0,0 @@ -. -***********************************************************************/ -function add_movement_type($name) -{ - $sql = "INSERT INTO ".TB_PREF."movement_types (name) - VALUES (".db_escape($name).")"; - - db_query($sql, "could not add item movement type"); -} - -function update_movement_type($type_id, $name) -{ - $sql = "UPDATE ".TB_PREF."movement_types SET name=".db_escape($name)." - WHERE id=".db_escape($type_id); - - db_query($sql, "could not update item movement type"); -} - -function get_all_movement_type($all=false) -{ - $sql = "SELECT * FROM ".TB_PREF."movement_types"; - if (!$all) $sql .= " WHERE !inactive"; - - return db_query($sql, "could not get all item movement type"); -} - -function get_movement_type($type_id) -{ - $sql = "SELECT * FROM ".TB_PREF."movement_types WHERE id=".db_escape($type_id); - - $result = db_query($sql, "could not get item movement type"); - - return db_fetch($result); -} - -function delete_movement_type($type_id) -{ - $sql="DELETE FROM ".TB_PREF."movement_types WHERE id=".db_escape($type_id); - - db_query($sql, "could not delete item movement type"); -} - - -function get_stock_movements_before($stock_id, $StockLocation, $AfterDate) -{ - $after_date = date2sql($AfterDate); - $sql = "SELECT SUM(qty) FROM ".TB_PREF."stock_moves WHERE stock_id=".db_escape($stock_id); - if ($StockLocation) - $sql .= " AND loc_code=".db_escape( $StockLocation); - $sql .= " AND tran_date < '" . $after_date . "'"; - $before_qty = db_query($sql, "The starting quantity on hand could not be calculated"); - - $before_qty_row = db_fetch_row($before_qty); - return $before_qty_row[0]; -} - -function movement_types_in_stock_moves($selected_id) -{ - $sql= "SELECT COUNT(*) FROM ".TB_PREF."stock_moves - WHERE type=" . ST_INVADJUST. " AND person_id=".db_escape($selected_id); - - $result = db_query($sql, "could not query stock moves"); - $myrow = db_fetch_row($result); - return ($myrow[0] > 0); -} diff --git a/inventory/includes/inventory_db.inc b/inventory/includes/inventory_db.inc index bc70582b..5e4cee82 100644 --- a/inventory/includes/inventory_db.inc +++ b/inventory/includes/inventory_db.inc @@ -20,7 +20,6 @@ include_once($path_to_root . "/inventory/includes/db/items_purchases_db.inc"); include_once($path_to_root . "/inventory/includes/db/items_codes_db.inc"); include_once($path_to_root . "/inventory/includes/db/items_db.inc"); 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"); diff --git a/inventory/manage/movement_types.php b/inventory/manage/movement_types.php deleted file mode 100644 index b9d7f79d..00000000 --- a/inventory/manage/movement_types.php +++ /dev/null @@ -1,140 +0,0 @@ -. -***********************************************************************/ -$page_security = 'SA_INVENTORYMOVETYPE'; -$path_to_root = "../.."; -include($path_to_root . "/includes/session.inc"); - -page(_($help_context = "Inventory Movement Types")); - -include_once($path_to_root . "/inventory/includes/inventory_db.inc"); - -include_once($path_to_root . "/includes/ui.inc"); - -simple_page_mode(true); -//----------------------------------------------------------------------------------- - -if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') -{ - - //initialise no input errors assumed initially before we test - $input_error = 0; - - if (strlen($_POST['name']) == 0) - { - $input_error = 1; - display_error(_("The inventory movement type name cannot be empty.")); - set_focus('name'); - } - - if ($input_error != 1) - { - if ($selected_id != -1) - { - update_movement_type($selected_id, $_POST['name']); - display_notification(_('Selected movement type has been updated')); - } - else - { - add_movement_type($_POST['name']); - display_notification(_('New movement type has been added')); - } - - $Mode = 'RESET'; - } -} - -//----------------------------------------------------------------------------------- - -function can_delete($selected_id) -{ - if (movement_types_in_stock_moves($selected_id)) - { - display_error(_("Cannot delete this inventory movement type because item transactions have been created referring to it.")); - return false; - } - - return true; -} - - -//----------------------------------------------------------------------------------- - -if ($Mode == 'Delete') -{ - if (can_delete($selected_id)) - { - delete_movement_type($selected_id); - display_notification(_('Selected movement type has been deleted')); - } - $Mode = 'RESET'; -} - -if ($Mode == 'RESET') -{ - $selected_id = -1; - $sav = get_post('show_inactive'); - unset($_POST); - $_POST['show_inactive'] = $sav; -} -//----------------------------------------------------------------------------------- - -$result = get_all_movement_type(check_value('show_inactive')); - -start_form(); -start_table(TABLESTYLE, "width='30%'"); - -$th = array(_("Description"), "", ""); -inactive_control_column($th); -table_header($th); -$k = 0; -while ($myrow = db_fetch($result)) -{ - - alt_table_row_color($k); - - label_cell($myrow["name"]); - inactive_control_cell($myrow["id"], $myrow["inactive"], 'movement_types', 'id'); - edit_button_cell("Edit".$myrow['id'], _("Edit")); - delete_button_cell("Delete".$myrow['id'], _("Delete")); - end_row(); -} -inactive_control_row($th); -end_table(1); - -//----------------------------------------------------------------------------------- - -start_table(TABLESTYLE2); - -if ($selected_id != -1) -{ - if ($Mode == 'Edit') { - //editing an existing status code - - $myrow = get_movement_type($selected_id); - - $_POST['name'] = $myrow["name"]; - } - hidden('selected_id', $selected_id); -} - -text_row(_("Description:"), 'name', null, 50, 50); - -end_table(1); - -submit_add_or_update_center($selected_id == -1, '', 'both'); - -end_form(); - -//------------------------------------------------------------------------------------ - -end_page(); - diff --git a/sql/alter2.4.sql b/sql/alter2.4.sql index aabaed55..55fc2ab6 100644 --- a/sql/alter2.4.sql +++ b/sql/alter2.4.sql @@ -115,7 +115,6 @@ ALTER TABLE `0_groups` ENGINE=InnoDB; ALTER TABLE `0_item_codes` ENGINE=InnoDB; ALTER TABLE `0_item_units` ENGINE=InnoDB; ALTER TABLE `0_locations` ENGINE=InnoDB; -ALTER TABLE `0_movement_types` ENGINE=InnoDB; ALTER TABLE `0_payment_terms` ENGINE=InnoDB; ALTER TABLE `0_prices` ENGINE=InnoDB; ALTER TABLE `0_printers` ENGINE=InnoDB; @@ -236,3 +235,5 @@ ALTER TABLE `0_stock_moves` DROP COLUMN `visible`; UPDATE `0_stock_moves` SET price = price*(1-discount_percent); ALTER TABLE `0_stock_moves` DROP COLUMN `discount_percent`; + +DROP TABLE IF EXISTS `0_movement_types`; diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index 4d04e82e..75c9fe04 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -1183,27 +1183,6 @@ INSERT INTO `0_loc_stock` VALUES('DEF', '3400', 0); -- -------------------------------------------------------- --- --- Table structure for table `0_movement_types` --- - -DROP TABLE IF EXISTS `0_movement_types`; -CREATE TABLE IF NOT EXISTS `0_movement_types` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - `inactive` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; - --- --- Dumping data for table `0_movement_types` --- - -INSERT INTO `0_movement_types` VALUES(1, 'Adjustment', 0); - --- -------------------------------------------------------- - -- -- Table structure for table `0_payment_terms` -- diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index 802ccfdf..1cd4bd33 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -1020,28 +1020,6 @@ CREATE TABLE IF NOT EXISTS `0_loc_stock` ( -- Dumping data for table `0_loc_stock` -- - --- -------------------------------------------------------- - --- --- Table structure for table `0_movement_types` --- - -DROP TABLE IF EXISTS `0_movement_types`; -CREATE TABLE IF NOT EXISTS `0_movement_types` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(60) NOT NULL default '', - `inactive` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; - --- --- Dumping data for table `0_movement_types` --- - -INSERT INTO `0_movement_types` VALUES(1, 'Adjustment', 0); - -- -------------------------------------------------------- --