function getCountryPrimaryCurrencyID()
 {
     $iso_code = $this->getCountryPrimaryCurrency();
     //ISO Code
     if ($iso_code != '' and is_numeric($this->getCompany())) {
         $clf = new CurrencyListFactory();
         $clf->getByCompanyIdAndISOCode($this->getCompany(), $iso_code);
         if ($clf->getRecordCount() > 0) {
             $currency_id = $clf->getCurrent()->getId();
             //Debug::Text('Country Primary Currency ID: '. $currency_id , __FILE__, __LINE__, __METHOD__, 10 );
             return $currency_id;
         }
     }
     Debug::Text('Country Primary Currency does not exist: ' . $iso_code, __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
 static function updateCurrencyRates($company_id)
 {
     /*
     	Contact info@timetrex.com to request adding custom currency data feeds.
     */
     $base_currency = FALSE;
     $clf = new CurrencyListFactory();
     $clf->getByCompanyId($company_id);
     if ($clf->getRecordCount() > 0) {
         foreach ($clf as $c_obj) {
             if ($c_obj->getBase() == TRUE) {
                 $base_currency = $c_obj->getISOCode();
             }
             if ($c_obj->getStatus() == 10 and $c_obj->getAutoUpdate() == TRUE) {
                 $active_currencies[] = $c_obj->getISOCode();
             }
         }
     }
     unset($clf, $c_obj);
     if ($base_currency != FALSE and isset($active_currencies) and is_array($active_currencies) and count($active_currencies) > 0) {
         $ttsc = new TimeTrexSoapClient();
         $currency_rates = $ttsc->getCurrencyExchangeRates($company_id, $active_currencies, $base_currency);
     } else {
         Debug::Text('Invalid Currency Data, not getting rates...', __FILE__, __LINE__, __METHOD__, 10);
     }
     if (isset($currency_rates) and is_array($currency_rates) and count($currency_rates) > 0) {
         foreach ($currency_rates as $currency => $rate) {
             if (is_numeric($rate)) {
                 $clf = new CurrencyListFactory();
                 $clf->getByCompanyIdAndISOCode($company_id, $currency);
                 if ($clf->getRecordCount() == 1) {
                     $c_obj = $clf->getCurrent();
                     if ($c_obj->getAutoUpdate() == TRUE) {
                         $c_obj->setActualRate($rate);
                         $c_obj->setConversionRate($c_obj->getPercentModifiedRate($rate));
                         $c_obj->setActualRateUpdatedDate(time());
                         if ($c_obj->isValid()) {
                             $c_obj->Save();
                         }
                     }
                 }
             } else {
                 Debug::Text('Invalid rate from data feed! Currency: ' . $currency . ' Rate: ' . $rate, __FILE__, __LINE__, __METHOD__, 10);
             }
         }
         return TRUE;
     }
     Debug::Text('Updating Currency Data Failed...', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }