Inventory Transfer: removed movement type from transfer form, cleanups.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 5 Apr 2015 21:06:14 +0000 (23:06 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 7 Apr 2015 19:03:40 +0000 (21:03 +0200)
doc/api_changes.txt
inventory/includes/db/items_transfer_db.inc
inventory/includes/stock_transfers_ui.inc
inventory/transfers.php
inventory/view/view_transfer.php

index 6839ed30f7d239a7d667baacf0994463edcc3efd..c0053195b49e355a85e80d17536ed6998e8ce7ab 100644 (file)
@@ -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.
index f537e491dafecaa33f7dd99c26ec8c1e9be11c56..e4a452fe3ed12e00c63b4f67f6703d4657e448e2 100644 (file)
 ***********************************************************************/
 //-------------------------------------------------------------------------------------------------------------
 
-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);
index a133023698b4d4615122657b6b849a9cd240dc5f..8c143196475878885de54900ff6a84d947a3e73b 100644 (file)
@@ -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
 }
index 7d4a34845cb06a56853ad30842fb07b6fd840a19..5315a23c64b6573d46a4d9eef46af8913dffad44 100644 (file)
@@ -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'])) {
index ecdc9610803b5a708b76c8d9137f7c569daa9798..ce17ce75eccdc3ca3e49b96b158ac0c0a76e3228 100644 (file)
@@ -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();