Page MenuHomeIn-Portal Phabricator

D474.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 5:07 AM

D474.diff

Index: branches/5.2.x/units/currencies/currencies_event_handler.php
===================================================================
--- branches/5.2.x/units/currencies/currencies_event_handler.php
+++ branches/5.2.x/units/currencies/currencies_event_handler.php
@@ -279,11 +279,21 @@
*/
protected function OnChangeCurrency($event)
{
- $currency_iso = $this->Application->GetVar('curr_iso');
+ $currency_iso = $this->Application->GetVar('curr_iso', '');
+
+ $sql = 'SELECT CurrencyId
+ FROM ' . TABLE_PREFIX . 'Currencies
+ WHERE ISO = ' . $this->Conn->qstr($currency_iso) . ' AND Status = ' . STATUS_ACTIVE;
+ $currency_id = $this->Conn->GetOne($sql);
+
+ if ( $currency_id === false ) {
+ return;
+ }
+
$available_currencies = $this->Application->siteDomainField('Currencies');
if ($available_currencies) {
- if (strpos($available_currencies, '|' . $currency_iso . '|') === false) {
+ if (strpos($available_currencies, '|' . $currency_id . '|') === false) {
// currency isn't allowed in site domain
return ;
}

Event Timeline