X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=inventory%2Ftransfers.php;h=5315a23c64b6573d46a4d9eef46af8913dffad44;hb=b6ae2ddcd0cbc571edd01157ca1c8d44bbe071ef;hp=b04c7d87cd0db347d7f189407a957a23beb2908b;hpb=ec51d9a922df61d39de8444cd0a3aaf51ebcbf2b;p=fa-stable.git diff --git a/inventory/transfers.php b/inventory/transfers.php index b04c7d87..5315a23c 100644 --- a/inventory/transfers.php +++ b/inventory/transfers.php @@ -21,9 +21,9 @@ include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/inventory/includes/stock_transfers_ui.inc"); include_once($path_to_root . "/inventory/includes/inventory_db.inc"); $js = ""; -if ($use_popup_windows) +if ($SysPrefs->use_popup_windows) $js .= get_js_open_window(800, 500); -if ($use_date_picker) +if (user_use_date_picker()) $js .= get_js_date_picker(); page(_($help_context = "Inventory Location Transfers"), false, false, "", $js); @@ -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'])) @@ -76,7 +74,6 @@ function handle_new_order() if (isset($_POST['Process'])) { - global $Refs; $tr = &$_SESSION['transfer_items']; $input_error = 0; @@ -84,7 +81,7 @@ if (isset($_POST['Process'])) if (count($tr->line_items) == 0) { display_error(_("You must enter at least one non empty item line.")); set_focus('stock_id'); - return false; + $input_error = 1; } if (!$Refs->is_valid($_POST['ref'])) { @@ -106,7 +103,7 @@ if (isset($_POST['Process'])) } elseif (!is_date_in_fiscalyear($_POST['AdjDate'])) { - display_error(_("The entered date is not in fiscal year.")); + display_error(_("The entered date is out of fiscal year or is closed for further data entry.")); set_focus('AdjDate'); $input_error = 1; } @@ -138,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']); @@ -150,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'); @@ -163,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(); } @@ -185,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']); @@ -198,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'])) { @@ -219,7 +211,7 @@ start_form(); display_order_header($_SESSION['transfer_items']); -start_table(TABLESTYLE, "width=70%", 10); +start_table(TABLESTYLE, "width='70%'", 10); start_row(); echo ""; display_transfer_items(_("Items"), $_SESSION['transfer_items']); @@ -234,4 +226,3 @@ submit_center_last('Process', _("Process Transfer"), '', 'default'); end_form(); end_page(); -?>