[0004216] Print Work Orders: database error fixed when voided WO is in selected range.
[fa-stable.git] / gl / manage / exchange_rates.php
index 204c64f52202bf66a8ee2b2c878479b35a35cc3a..6d13b06bf90f3bd77b712eed49eaff45115ea39f 100644 (file)
@@ -19,7 +19,7 @@ include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/banking.inc");
 
 $js = "";
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
 page(_($help_context = "Exchange Rates"), false, false, "", $js);
 
@@ -108,8 +108,9 @@ function display_rates($curr_code)
 
 function display_rate_edit()
 {
-       global $selected_id, $Ajax;
-
+       global $selected_id, $Ajax, $SysPrefs;
+       $xchg_rate_provider = ((isset($SysPrefs->xr_providers) && isset($SysPrefs->dflt_xr_provider))
+               ? $SysPrefs->xr_providers[$SysPrefs->dflt_xr_provider] : 'ECB');
        start_table(TABLESTYLE2);
 
        if ($selected_id != "")
@@ -119,7 +120,7 @@ function display_rate_edit()
                $myrow = get_exchange_rate($selected_id);
 
                $_POST['date_'] = sql2date($myrow["date_"]);
-               $_POST['BuyRate'] = exrate_format($myrow["rate_buy"]);
+               $_POST['BuyRate'] = maxprec_format($myrow["rate_buy"]);
 
                hidden('selected_id', $selected_id);
                hidden('date_', $_POST['date_']);
@@ -138,8 +139,8 @@ function display_rate_edit()
                        maxprec_format(retrieve_exrate($_POST['curr_abrev'], $_POST['date_']));
                $Ajax->activate('BuyRate');
        }
-       small_amount_row(_("Exchange Rate:"), 'BuyRate', null, '',
-               submit('get_rate',_("Get"), false, _('Get current ECB rate') , true), 'max');
+       amount_row(_("Exchange Rate:"), 'BuyRate', null, '',
+               submit('get_rate',_("Get"), false, _('Get current rate from') . ' ' . $xchg_rate_provider , true), 'max');
 
        end_table(1);
 
@@ -177,7 +178,7 @@ if (!isset($_POST['curr_abrev']))
 
 echo "<center>";
 echo _("Select a currency :") . "  ";
-echo currencies_list('curr_abrev', null, true);
+echo currencies_list('curr_abrev', null, true, true);
 echo "</center>";
 
 // if currency sel has changed, clear the form
@@ -187,9 +188,9 @@ if ($_POST['curr_abrev'] != get_global_curr_code())
        $selected_id = "";
 }
 
-set_global_curr_code($_POST['curr_abrev']);
+set_global_curr_code(get_post('curr_abrev'));
 
-$sql = get_sql_for_exchange_rates();
+$sql = get_sql_for_exchange_rates(get_post('curr_abrev'));
 
 $cols = array(
        _("Date to Use From") => 'date', 
@@ -199,7 +200,7 @@ $cols = array(
 );
 $table =& new_db_pager('orders_tbl', $sql, $cols);
 
-if (is_company_currency($_POST['curr_abrev']))
+if (is_company_currency(get_post('curr_abrev')))
 {
 
        display_note(_("The selected currency is the company currency."), 2);
@@ -221,4 +222,3 @@ end_form();
 
 end_page();
 
-?>