Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/units/currencies/currencies_event_handler.php
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Line(s) | |||||
$event->status = kEvent::erFAIL; | $event->status = kEvent::erFAIL; | ||||
return; | return; | ||||
} | } | ||||
$ids = $this->StoreSelectedIDs($event); | $ids = $this->StoreSelectedIDs($event); | ||||
$event->setEventParam('ids', $ids); | $event->setEventParam('ids', $ids); | ||||
$ids = $event->getEventParam('ids'); | $ids = $event->getEventParam('ids'); | ||||
$object = $event->getObject(); | if ( $ids ) { | ||||
if(is_array($ids) && $ids[0]) | $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); | ||||
{ | $sql = 'SELECT ISO FROM ' . $table_name . ' WHERE CurrencyId IN (' . implode(',', $ids) . ')'; | ||||
$sql = 'SELECT ISO FROM '.$object->TableName.' WHERE CurrencyId IN ('.implode(',', $ids).')'; | |||||
$iso_list = $this->Conn->GetCol($sql); | $iso_list = $this->Conn->GetCol($sql); | ||||
} | } | ||||
else { | |||||
$iso_list = array(); | |||||
} | |||||
$rate_source = $this->Application->ConfigValue('Comm_ExchangeRateSource'); | $rate_source = $this->Application->ConfigValue('Comm_ExchangeRateSource'); | ||||
$rate_source_classes = Array( 2 => 'FRNYCurrencyRates', | $rate_source_classes = Array( 2 => 'FRNYCurrencyRates', | ||||
3 => 'ECBCurrencyRates', | 3 => 'ECBCurrencyRates', | ||||
1 => 'BankLVCurrencyRates' | 1 => 'BankLVCurrencyRates' | ||||
); | ); | ||||
$rates_class = $rate_source_classes[$rate_source]; | $rates_class = $rate_source_classes[$rate_source]; | ||||
$rates = $this->Application->recallObject($rates_class); | $rates = $this->Application->recallObject($rates_class); | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | |||||
$calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields'); | $calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields'); | ||||
foreach ($calculated_fields[''] as $field_name => $field_expression) { | foreach ($calculated_fields[''] as $field_name => $field_expression) { | ||||
$calculated_fields[''][$field_name] = str_replace('%4$s', $language_id, $field_expression); | $calculated_fields[''][$field_name] = str_replace('%4$s', $language_id, $field_expression); | ||||
} | } | ||||
$this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields); | $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields); | ||||
} | } | ||||
} | } | ||||
No newline at end of file |