Index: branches/5.2.x/units/currencies/currencies_event_handler.php =================================================================== diff -u -N -r16516 -r16601 --- branches/5.2.x/units/currencies/currencies_event_handler.php (.../currencies_event_handler.php) (revision 16516) +++ branches/5.2.x/units/currencies/currencies_event_handler.php (.../currencies_event_handler.php) (revision 16601) @@ -1,6 +1,6 @@ setEventParam('ids', $ids); $ids = $event->getEventParam('ids'); - $object = $event->getObject(); - if(is_array($ids) && $ids[0]) - { - $sql = 'SELECT ISO FROM '.$object->TableName.' WHERE CurrencyId IN ('.implode(',', $ids).')'; + if ( $ids ) { + $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $sql = 'SELECT ISO FROM ' . $table_name . ' WHERE CurrencyId IN (' . implode(',', $ids) . ')'; $iso_list = $this->Conn->GetCol($sql); } + else { + $iso_list = array(); + } $rate_source = $this->Application->ConfigValue('Comm_ExchangeRateSource'); $rate_source_classes = Array( 2 => 'FRNYCurrencyRates', @@ -319,4 +321,4 @@ $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields); } -} \ No newline at end of file +} Index: branches/5.2.x/units/helpers/ecb_currency_rates.php =================================================================== diff -u -N -r16516 -r16601 --- branches/5.2.x/units/helpers/ecb_currency_rates.php (.../ecb_currency_rates.php) (revision 16516) +++ branches/5.2.x/units/helpers/ecb_currency_rates.php (.../ecb_currency_rates.php) (revision 16601) @@ -1,6 +1,6 @@ RateSource = 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml'; + $this->RateSource = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'; parent::__construct(); } @@ -28,9 +28,14 @@ /** @var kCurlHelper $curl_helper */ $curl_helper = $this->Application->recallObject('CurlHelper'); + $curl_helper->followLocation = true; $xml = $curl_helper->Send($this->RateSource); + if ( !$curl_helper->isGoodResponseCode() || strlen($xml) == 0 ) { + return; + } + xml_parse_into_struct($xml_parser, $xml, $struct, $index); $data_res = Array(); foreach($struct as $element) @@ -44,13 +49,14 @@ $data_res[$currency]['RATE'] = ($element['attributes']['RATE'] == 0) ? 0 : 1 / $element['attributes']['RATE']; } } - if(!$data_res['EUR']) - { + + if ( !isset($data_res['EUR']) ) { $data_res['EUR']['ID'] = 'EUR'; $data_res['EUR']['UNITS'] = 1; $data_res['EUR']['TARGET'] = 'EUR'; $data_res['EUR']['RATE'] = 1; } + $this->ExchangeRates = $data_res; } } Index: branches/5.2.x/units/helpers/frny_currency_rates.php =================================================================== diff -u -N -r16516 -r16601 --- branches/5.2.x/units/helpers/frny_currency_rates.php (.../frny_currency_rates.php) (revision 16516) +++ branches/5.2.x/units/helpers/frny_currency_rates.php (.../frny_currency_rates.php) (revision 16601) @@ -1,6 +1,6 @@ Application->recallObject('CurlHelper'); + $curl_helper->followLocation = true; for($i = 0; $i < 10; $i++) { $time = adodb_mktime() - $i * 3600 * 24; $source_file = sprintf($this->RateSource, adodb_date('Y-m-d', $time)); $xml = $curl_helper->Send($source_file); + if ( !$curl_helper->isGoodResponseCode() || strlen($xml) == 0 ) { + continue; + } + $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $xml, $struct, $index); foreach($struct as $element) Index: branches/5.2.x/units/helpers/bank_lv_currency_rates.php =================================================================== diff -u -N -r16516 -r16601 --- branches/5.2.x/units/helpers/bank_lv_currency_rates.php (.../bank_lv_currency_rates.php) (revision 16516) +++ branches/5.2.x/units/helpers/bank_lv_currency_rates.php (.../bank_lv_currency_rates.php) (revision 16601) @@ -1,6 +1,6 @@ Application->recallObject('CurlHelper'); + $curl_helper->followLocation = true; $xml = $curl_helper->Send($this->RateSource); + if ( !$curl_helper->isGoodResponseCode() || strlen($xml) == 0 ) { + return; + } + xml_parse_into_struct($xml_parser, $xml, $struct, $index); $data_res = Array(); $currency = '';