//---------------------------------------------------------------------------------------------
+function add_new_exchange_rate($curr_code, $date_, $ex_rate)
+{
+ if (is_company_currency($curr_code) || !$ex_rate)
+ return;
+
+ if (!get_date_exchange_rate($curr_code, $date_))
+ add_exchange_rate($curr_code, $date_, 1.0/$ex_rate, 1.0/$ex_rate);
+}
+
+//---------------------------------------------------------------------------------------------
+
function delete_exchange_rate($rate_id)
{
$sql = "DELETE FROM ".TB_PREF."exchange_rates WHERE id=".db_escape($rate_id);
{
global $path_to_root;
+ if ($date != Today()) // no historical rates available
+ return 0;
+
$curr_a = get_company_pref('curr_default');
if ($provider == 'ECB')
{
} else {
$contents = url_get_contents("http://".$site.$filename);
}
- if (!$contents) {
- display_warning(sprintf(_("Cannot retrieve currency rate from %s page. Please set the rate manually."), $provider));
- }
if ($provider == 'ECB')
{
$contents = str_replace ("<Cube currency='USD'", " <Cube currency='EUR' rate='1'/> <Cube currency='USD'", $contents);