Re: No exchange rate
There is a little bug in the function get_exchange_rate_from_home_currency in the includes/banking.inc module. Version 2.2.4.
If you are working with only one currency you get an error-message : "Cannot retrieve exchange rate for currency as of 31/01/2010"...
Code should be :
function get_exchange_rate_from_home_currency($currency_code, $date_)
{
if ($currency_code == get_company_currency() Or $currency_code == Null) {
return 1.0000;
} else {
$date = date2sql($date_);
$sql = "SELECT rate_buy, max(date_) as date_ FROM ".TB_PREF."exchange_rates WHERE curr_code = '$currency_code'
AND date_ <= '$date' GROUP BY rate_buy ORDER BY date_ Desc LIMIT 1";
$result = db_query($sql, "could not query exchange rates");
if (db_num_rows($result) == 0)
{
// no stored exchange rate, just return 1
display_error(
sprintf(_("Cannot retrieve exchange rate for currency %s as of %s. Please add exchange rate manually on Exchange Rates page."),
$currency_code, $date_));
return 1.000;
}
$myrow = db_fetch_row($result);
return $myrow[0];
}
}