X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fgl_deposit.php;h=3b9a3c621eb925c58dcf0dce99e41076f8c92a2d;hb=6183e9450dcd7e4c747889c10903f6ff1b0add33;hp=fd4f98e567a28e5228a03d7e2276bae285c341b6;hpb=431531eebf3ba494002cfbf7ea36f9e82d4975c0;p=fa-stable.git diff --git a/gl/gl_deposit.php b/gl/gl_deposit.php index fd4f98e5..3b9a3c62 100644 --- a/gl/gl_deposit.php +++ b/gl/gl_deposit.php @@ -12,13 +12,13 @@ include_once($path_to_root . "/gl/includes/ui/gl_deposit_ui.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); include_once($path_to_root . "/gl/includes/gl_ui.inc"); -$js = get_js_form_entry("CodeID2", "code_id", "amount"); +$js = ''; if ($use_popup_windows) $js .= get_js_open_window(800, 500); if ($use_date_picker) $js .= get_js_date_picker(); -$js .= get_js_set_focus('CodeID2'); -page(_("Bank Account Deposit Entry"), false, false, "setFocus()", $js); +set_focus('CodeID2'); +page(_("Bank Account Deposit Entry"), false, false, '', $js); //----------------------------------------------------------------------------------------------- @@ -101,23 +101,27 @@ if (isset($_POST['Process'])) if (!references::is_valid($_POST['ref'])) { display_error( _("You must enter a reference.")); + set_focus('ref'); $input_error = 1; } elseif (!is_new_reference($_POST['ref'], systypes::bank_deposit())) { display_error( _("The entered reference is already in use.")); + set_focus('ref'); $input_error = 1; } if (!is_date($_POST['date_'])) { display_error(_("The entered date for the deposit is invalid.")); + set_focus('date_'); $input_error = 1; } if (!is_date_in_fiscalyear($_POST['date_'])) { display_error(_("The entered date is not in fiscal year.")); + set_focus('date_'); $input_error = 1; } @@ -149,27 +153,24 @@ if (isset($_POST['Process'])) function check_item_data() { - if (!is_numeric($_POST['amount'])) + if (!check_num('amount', 0)) { - display_error( _("The amount entered is not a valid number.")); - return false; - } - - if ($_POST['amount'] <= 0) - { - display_error( _("The amount entered must be a postitive number.")); + display_error( _("The amount entered is not a valid number or is less than zero.")); + set_focus('amount'); return false; } if ($_POST['code_id'] == $_POST['bank_account']) { display_error( _("The source and destination accouts cannot be the same.")); + set_focus('code_id'); return false; } if (is_bank_account($_POST['code_id'])) { display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this.")); + set_focus('code_id'); return false; } @@ -182,7 +183,8 @@ function handle_update_item() { if($_POST['UpdateItem'] != "" && check_item_data()) { - $_SESSION['deposit_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'], $_POST['dimension2_id'], -$_POST['amount'], $_POST['LineMemo']); + $_SESSION['deposit_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'], + $_POST['dimension2_id'], -input_num('amount'), $_POST['LineMemo']); } } @@ -200,7 +202,8 @@ function handle_new_item() if (!check_item_data()) return; - $_SESSION['deposit_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'], $_POST['dimension2_id'], -$_POST['amount'], $_POST['LineMemo']); + $_SESSION['deposit_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'], + $_POST['dimension2_id'], -input_num('amount'), $_POST['LineMemo']); } //-----------------------------------------------------------------------------------------------