Removed obsolete Movement Types handling.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 6 Apr 2015 09:18:13 +0000 (11:18 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 7 Apr 2015 19:45:50 +0000 (21:45 +0200)
applications/inventory.php
includes/data_checks.inc
includes/ui/ui_lists.inc
inventory/includes/db/movement_types_db.inc [deleted file]
inventory/includes/inventory_db.inc
inventory/manage/movement_types.php [deleted file]
sql/alter2.4.sql
sql/en_US-demo.sql
sql/en_US-new.sql

index 1c4b4277461396c501873ba3794cb27e1e208ac1..965109b64b735040aa97520e4d0bcaae74261b34 100644 (file)
@@ -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"),
index 272584c3270c7b0e0ccee3d78d5757bf829efb4f..7ce8d668adced13db154009c9bca372e8d77edc6 100644 (file)
@@ -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 "
index e5e113e4e783991a41eb4ec16261e86a32720140..6170e79f41496303cda59347fc4fd520a38bb721 100644 (file)
@@ -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 "<td>$label</td>\n";
-       echo "<td>";
-       echo movement_types_list($name, $selected_id);
-       echo "</td>\n";
-}
-
-function movement_types_list_row($label, $name, $selected_id=null)
-{
-       echo "<tr><td class='label'>$label</td>";
-       movement_types_list_cells(null, $name, $selected_id);
-       echo "</tr>\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 (file)
index cb5bff3..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/**********************************************************************
-    Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU General Public License, GPL, 
-       as published by the Free Software Foundation, either version 3 
-       of the License, or (at your option) any later version.
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
-***********************************************************************/
-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); 
-}
index bc70582b5fea715f6d8da5c44dffd51ebb49a73d..5e4cee82fd1aa114bcfe7da2a4c3ea5018c5c26b 100644 (file)
@@ -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 (file)
index b9d7f79..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**********************************************************************
-    Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU General Public License, GPL, 
-       as published by the Free Software Foundation, either version 3 
-       of the License, or (at your option) any later version.
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
-***********************************************************************/
-$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();
-
index aabaed559921e4fd40d072835c892a38a36a7309..55fc2ab63e49e06e73ff34bfc4f9c66c98c5c9dd 100644 (file)
@@ -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`;
index 4d04e82ea7d7a0c89bdba9c36f7c01b726eafdd0..75c9fe04a921510d6793234dadf844a465ec5dc5 100644 (file)
@@ -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`
 --
index 802ccfdf8a383bfa08a44a40313ebafcc50f691e..1cd4bd33fda0c83fbe9b72ad05d5263e24db02cf 100644 (file)
@@ -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);
-
 -- --------------------------------------------------------
 
 --