Index: branches/5.3.x/units/currencies/currencies_tag_processor.php =================================================================== diff -u -N -r15492 -r15695 --- branches/5.3.x/units/currencies/currencies_tag_processor.php (.../currencies_tag_processor.php) (revision 15492) +++ branches/5.3.x/units/currencies/currencies_tag_processor.php (.../currencies_tag_processor.php) (revision 15695) @@ -1,6 +1,6 @@ Application->RecallVar('saved_curr_ids'); // when saving currency(-ies) - $check_all = $this->Application->RecallVar('check_unused_currencies'); // when saving payment type $ret = ''; - if($saved_ids || $check_all) - { - $sql = 'SELECT DISTINCT CurrencyId FROM '.$this->Application->getUnitOption('ptc', 'TableName'); + $saved_ids = $this->Application->RecallVar('saved_curr_ids'); // when saving currency(-ies) + $check_all = $this->Application->RecallVar('check_unused_currencies'); // when saving payment type + + $config = $this->getUnitConfig(); + + if ( $saved_ids || $check_all ) { + $sql = 'SELECT DISTINCT CurrencyId + FROM ' . $this->Application->getUnitConfig('ptc')->getTableName(); $used_ids = $this->Conn->GetCol($sql); - if($check_all) - { - $sql = 'SELECT DISTINCT CurrencyId FROM '.$this->Application->getUnitOption('curr', 'TableName'); + + if ( $check_all ) { + $sql = 'SELECT DISTINCT CurrencyId + FROM ' . $config->getTableName(); $all_ids = $this->Conn->GetCol($sql); - $unused_ids = implode(',', array_diff($all_ids, $used_ids) ); + + $unused_ids = implode(',', array_diff($all_ids, $used_ids)); $this->Application->RemoveVar('check_unused_currencies'); } - else - { + else { $saved_ids = explode(',', $saved_ids); - $unused_ids = implode(',', array_diff($saved_ids, $used_ids) ); + $unused_ids = implode(',', array_diff($saved_ids, $used_ids)); $this->Application->RemoveVar('saved_curr_ids'); } if ( $unused_ids ) { $this->Application->SetVar('unused_ids', $unused_ids); + $sql = 'SELECT ISO - FROM '.$this->Application->getUnitOption($this->Prefix, 'TableName').' - WHERE CurrencyId IN('.$unused_ids.') AND Status = 1'; + FROM ' . $config->getTableName() . ' + WHERE CurrencyId IN(' . $unused_ids . ') AND Status = 1'; $params['unused_iso'] = implode(', ', $this->Conn->GetCol($sql)); if ( $params['unused_iso'] ) { @@ -52,6 +57,7 @@ } } } + return $ret; } @@ -82,7 +88,7 @@ function PrimaryCurrencyISO($params) { $sql = 'SELECT ISO - FROM ' . $this->Application->getUnitOption($this->Prefix, 'TableName') . ' + FROM ' . $this->getUnitConfig()->getTableName() . ' WHERE IsPrimary = 1'; return $this->Conn->GetOne($sql); @@ -91,7 +97,7 @@ function PrimaryCurrencyName($params) { $sql = 'SELECT Name - FROM ' . $this->Application->getUnitOption($this->Prefix, 'TableName') . ' + FROM ' . $this->getUnitConfig()->getTableName() . ' WHERE IsPrimary = 1'; return $this->Application->Phrase( $this->Conn->GetOne($sql) );