<?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 = 9;
$path_to_root="../..";
include($path_to_root . "/includes/db_pager.inc");
set_focus('date_');
return false;
}
- if (!check_num('BuyRate', 0))
- {
- display_error( _("The exchange rate must be numeric and greater than zero."));
- set_focus('BuyRate');
- return false;
- }
- if ($_POST['BuyRate'] <= 0)
+ if (input_num('BuyRate') <= 0)
{
display_error( _("The exchange rate cannot be zero or a negative number."));
set_focus('BuyRate');
}
if (isset($_POST['get_rate']))
{
- $_POST['BuyRate'] = exrate_format(get_ecb_rate($_POST['curr_abrev']));
- if ($_POST['BuyRate'] == 0) {
- display_error(_('This currency is not listed by ECB. Enter exchange rate manually.'));
- }
+ $_POST['BuyRate'] =
+ exrate_format(retrieve_exrate($_POST['curr_abrev'], $_POST['date_']));
$Ajax->activate('BuyRate');
}
small_amount_row(_("Exchange Rate:"), 'BuyRate', null, '',
end_table(1);
- submit_add_or_update_center($selected_id == '', '', true);
+ submit_add_or_update_center($selected_id == '', '', 'both');
display_note(_("Exchange rates are entered against the company currency."), 1);
}
//---------------------------------------------------------------------------------------------
-start_form(false, true);
+start_form();
if (!isset($_POST['curr_abrev']))
$_POST['curr_abrev'] = get_global_curr_code();