Index: branches/5.3.x/core/units/helpers/country_states_helper.php =================================================================== diff -u -N -r15483 -r15698 --- branches/5.3.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 15483) +++ branches/5.3.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 15698) @@ -1,6 +1,6 @@ Application->getUnitOption('country-state', 'TableName'); + if ( !isset($cache) ) { + $table_name = $this->Application->getUnitConfig('country-state')->getTableName(); $sql = 'SELECT DISTINCT cname.IsoCode, cid.StateCountryId FROM ' . $table_name . ' cid @@ -106,7 +106,7 @@ $primary_language = $this->Application->GetDefaultLanguageId(); $sql = 'SELECT IF(l' . $current_language . '_Name = "", l' . $primary_language . '_Name, l' . $current_language . '_Name) AS Name, IsoCode - FROM ' . $this->Application->getUnitOption('country-state', 'TableName') . ' + FROM ' . $this->Application->getUnitConfig('country-state')->getTableName() . ' WHERE (Type = ' . DESTINATION_TYPE_STATE . ') AND (StateCountryId = ' . $country_id . ') ORDER BY Name ASC'; @@ -122,11 +122,11 @@ */ function getStateIso($state_name, $country_iso) { - if (!$this->CountryHasStates($country_iso)) { + if ( !$this->CountryHasStates($country_iso) ) { return $state_name; } - $table_name = $this->Application->getUnitOption('country-state', 'TableName'); + $table_name = $this->Application->getUnitConfig('country-state')->getTableName(); $country_id = $this->getCountryStateId($country_iso, DESTINATION_TYPE_COUNTRY); // don't use GetVar('m_lang') since it's always equals to default language on editing form in admin @@ -140,7 +140,7 @@ (IsoCode = %2$s) OR (UPPER(l%3$s_Name) = %2$s) OR (UPPER(l%4$s_Name) = %2$s) )'; - $state_name = trim( mb_strtoupper($state_name) ); + $state_name = trim(mb_strtoupper($state_name)); $sql = sprintf($sql, $country_id, $this->Conn->qstr($state_name), $current_language, $primary_language); return $this->Conn->GetOne($sql); @@ -191,8 +191,10 @@ */ function getCountryStateId($iso_code, $type) { - $sql = 'SELECT ' . $this->Application->getUnitOption('country-state', 'IDField') . ' - FROM ' . $this->Application->getUnitOption('country-state', 'TableName') . ' + $config = $this->Application->getUnitConfig('country-state'); + + $sql = 'SELECT ' . $config->getIDField() . ' + FROM ' . $config->getTableName() . ' WHERE (Type = ' . $type . ') AND (IsoCode = ' . $this->Conn->qstr($iso_code) . ')'; return (int)$this->Conn->GetOne($sql);