Index: branches/5.1.x/units/currencies/currencies_event_handler.php =================================================================== diff -u -r13147 -r13558 --- branches/5.1.x/units/currencies/currencies_event_handler.php (.../currencies_event_handler.php) (revision 13147) +++ branches/5.1.x/units/currencies/currencies_event_handler.php (.../currencies_event_handler.php) (revision 13558) @@ -1,6 +1,6 @@ Application->isAdminUser) { $object->addFilter('status_filter', $object->TableName.'.Status = 1'); } + + // site domain currency picker + if ($event->Special == 'selected' || $event->Special == 'available') { + $edit_picker_helper =& $this->Application->recallObject('EditPickerHelper'); + /* @var $edit_picker_helper EditPickerHelper */ + + $edit_picker_helper->applyFilter($event, 'Currencies'); + $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE); + } + + // apply domain-based currency filtering + $currencies = $this->Application->siteDomainField('Currencies'); + + if (strlen($currencies)) { + $currencies = explode('|', substr($currencies, 1, -1)); + $object->addFilter('domain_filter', '%1$s.CurrencyId IN (' . implode(',', $currencies) . ')'); + } } /** @@ -208,7 +225,17 @@ function OnChangeCurrency(&$event) { - $this->Application->StoreVar('curr_iso', $this->Application->GetVar('curr_iso')); + $currency_iso = $this->Application->GetVar('curr_iso'); + $available_currencies = $this->Application->siteDomainField('Currencies'); + + if ($available_currencies) { + if (strpos($available_currencies, '|' . $currency_iso . '|') === false) { + // currency isn't allowed in site domain + return ; + } + } + + $this->Application->StoreVar('curr_iso', $currency_iso); } /**