/** This function returns the conversion rate and vtiger_currency symbol
 * in array format for a given id.
 * param $id - vtiger_currency id.
 */
function getCurrencySymbolandCRate($id)
{
    global $log;
    $log->debug("Entering getCurrencySymbolandCRate(" . $id . ") method ...");
    // To initialize the currency information in cache
    getCurrencyName($id);
    $currencyinfo = VTCacheUtils::lookupCurrencyInfo($id);
    $rate_symbol['rate'] = $currencyinfo['rate'];
    $rate_symbol['symbol'] = $currencyinfo['symbol'];
    $log->debug("Exiting getCurrencySymbolandCRate method ...");
    return $rate_symbol;
}
Example #2
0
function getCurrencyInfo($currencyid)
{
    $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid);
    if ($currencyinfo === false) {
        global $adb;
        $sql1 = "select * from vtiger_currency_info where id= ?";
        $result = $adb->pquery($sql1, array($currencyid));
        $resultinfo = $adb->fetch_array($result);
        // Update cache
        VTCacheUtils::updateCurrencyInfo($currencyid, $resultinfo['currency_name'], $resultinfo['currency_code'], $resultinfo['currency_symbol'], $resultinfo['conversion_rate']);
        // Re-look at the cache now
        $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid);
    }
    return $currencyinfo;
}