From fe5ffc2ae3bf2d2221a837131dd425a7c69633b9 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sun, 5 Apr 2015 23:06:14 +0200 Subject: [PATCH] Inventory Transfer: removed movement type from transfer form, cleanups. --- doc/api_changes.txt | 11 +++++++++- inventory/includes/db/items_transfer_db.inc | 8 +++---- inventory/includes/stock_transfers_ui.inc | 8 ++----- inventory/transfers.php | 23 +++++++-------------- inventory/view/view_transfer.php | 2 -- 5 files changed, 24 insertions(+), 28 deletions(-) diff --git a/doc/api_changes.txt b/doc/api_changes.txt index 6839ed30..c0053195 100644 --- a/doc/api_changes.txt +++ b/doc/api_changes.txt @@ -1,6 +1,6 @@ Changes in framework API introduced in FrontAccounting 2.4 ---------------------------------------------------------- -The list does not contain changes made in user interface files. +The list does not contain changes made in user interface files or local functions. Changed functions: company_db_inc: @@ -18,6 +18,8 @@ Changed functions: add_stock_move($type, $stock_id, $trans_no, $location, $date_, $reference, $quantity, $std_cost, $person_id=0, $price=0) sales_db.inc: add_stock_move_customer() removed + items_transfer_db.inc: + add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_) Before 2.4: get_tax_type_default_rate($type_id) @@ -98,3 +100,10 @@ Now: None Description: Obsolete and removed. + +Before 2.4: + add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_) +Now: + add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_) +Description: + Removed obsolete $type argument. diff --git a/inventory/includes/db/items_transfer_db.inc b/inventory/includes/db/items_transfer_db.inc index f537e491..e4a452fe 100644 --- a/inventory/includes/db/items_transfer_db.inc +++ b/inventory/includes/db/items_transfer_db.inc @@ -11,14 +11,14 @@ ***********************************************************************/ //------------------------------------------------------------------------------------------------------------- -function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_) +function add_stock_transfer($Items, $location_from, $location_to, $date_, $reference, $memo_) { global $SysPrefs, $path_to_root, $Refs; begin_transaction(); $args = func_get_args(); $args = (object)array_combine(array('Items', 'location_from', 'location_to', - 'date_', 'type', 'reference', 'memo_'), $args); + 'date_', 'reference', 'memo_'), $args); $args->trans_no = 0; hook_db_prewrite($args, ST_LOCTRANSFER); @@ -37,7 +37,7 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, if ($SysPrefs->loc_notification() == 1) $loc = calculate_reorder_level($location_from, $line_item, $st_ids, $st_names, $st_num, $st_reorder); add_stock_transfer_item($transfer_id, $line_item->stock_id, $location_from, - $location_to, $date_, $type, $reference, $line_item->quantity); + $location_to, $date_, $reference, $line_item->quantity); } add_comments(ST_LOCTRANSFER, $transfer_id, $date_, $memo_); @@ -64,7 +64,7 @@ function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, // it seems the standard_cost field is not used at all function add_stock_transfer_item($transfer_id, $stock_id, $location_from, $location_to, - $date_, $type, $reference, $quantity) + $date_, $reference, $quantity) { add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_from, $date_, $reference, -$quantity, 0); diff --git a/inventory/includes/stock_transfers_ui.inc b/inventory/includes/stock_transfers_ui.inc index a1330236..8c143196 100644 --- a/inventory/includes/stock_transfers_ui.inc +++ b/inventory/includes/stock_transfers_ui.inc @@ -35,15 +35,11 @@ function display_order_header(&$order) locations_list_row(_("From Location:"), 'FromStockLocation', null); locations_list_row(_("To Location:"), 'ToStockLocation', null); - table_section(2, "33%"); - - ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_LOCTRANSFER)); + table_section(2, "50%"); date_row(_("Date:"), 'AdjDate', '', true); - table_section(3, "33%"); - - movement_types_list_row(_("Transfer Type:"), 'type', null); + ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_LOCTRANSFER)); end_outer_table(1); // outer table } diff --git a/inventory/transfers.php b/inventory/transfers.php index 7d4a3484..5315a23c 100644 --- a/inventory/transfers.php +++ b/inventory/transfers.php @@ -31,8 +31,6 @@ page(_($help_context = "Inventory Location Transfers"), false, false, "", $js); check_db_has_costable_items(_("There are no inventory items defined in the system (Purchased or manufactured items).")); -check_db_has_movement_types(_("There are no inventory movement types defined in the system. Please define at least one inventory adjustment type.")); - //----------------------------------------------------------------------------------------------- if (isset($_GET['AddedID'])) @@ -137,7 +135,7 @@ if (isset($_POST['Process'])) $trans_no = add_stock_transfer($_SESSION['transfer_items']->line_items, $_POST['FromStockLocation'], $_POST['ToStockLocation'], - $_POST['AdjDate'], $_POST['type'], $_POST['ref'], $_POST['memo_']); + $_POST['AdjDate'], $_POST['ref'], $_POST['memo_']); new_doc_date($_POST['AdjDate']); $_SESSION['transfer_items']->clear_items(); unset($_SESSION['transfer_items']); @@ -149,7 +147,7 @@ if (isset($_POST['Process'])) function check_item_data() { - if (!check_num('qty', 0)) + if (!check_num('qty', 0) || input_num('qty') == 0) { display_error(_("The quantity entered must be a positive number.")); set_focus('qty'); @@ -162,13 +160,10 @@ function check_item_data() function handle_update_item() { - if($_POST['UpdateItem'] != "" && check_item_data()) - { - $id = $_POST['LineNo']; - if (!isset($_POST['std_cost'])) - $_POST['std_cost'] = $_SESSION['transfer_items']->line_items[$id]->standard_cost; - $_SESSION['transfer_items']->update_cart_item($id, input_num('qty'), $_POST['std_cost']); - } + $id = $_POST['LineNo']; + if (!isset($_POST['std_cost'])) + $_POST['std_cost'] = $_SESSION['transfer_items']->line_items[$id]->standard_cost; + $_SESSION['transfer_items']->update_cart_item($id, input_num('qty'), $_POST['std_cost']); line_start_focus(); } @@ -184,8 +179,6 @@ function handle_delete_item($id) function handle_new_item() { - if (!check_item_data()) - return; if (!isset($_POST['std_cost'])) $_POST['std_cost'] = 0; add_to_order($_SESSION['transfer_items'], $_POST['stock_id'], input_num('qty'), $_POST['std_cost']); @@ -197,10 +190,10 @@ $id = find_submit('Delete'); if ($id != -1) handle_delete_item($id); -if (isset($_POST['AddItem'])) +if (isset($_POST['AddItem']) && check_item_data()) handle_new_item(); -if (isset($_POST['UpdateItem'])) +if (isset($_POST['UpdateItem']) && check_item_data()) handle_update_item(); if (isset($_POST['CancelItemChanges'])) { diff --git a/inventory/view/view_transfer.php b/inventory/view/view_transfer.php index ecdc9610..ce17ce75 100644 --- a/inventory/view/view_transfer.php +++ b/inventory/view/view_transfer.php @@ -42,8 +42,6 @@ label_cells(_("To Location"), $to_trans['location_name'], "class='tableheader2'" end_row(); start_row(); label_cells(_("Reference"), $from_trans['reference'], "class='tableheader2'"); -$adjustment_type = get_movement_type($from_trans['person_id']) ; -label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'"); label_cells(_("Date"), sql2date($from_trans['tran_date']), "class='tableheader2'"); end_row(); -- 2.30.2