Index: branches/5.1.x/core/units/helpers/country_states_helper.php =================================================================== diff -u -r13086 -r13151 --- branches/5.1.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 13086) +++ branches/5.1.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 13151) @@ -1,6 +1,6 @@ Application->GetVar('m_lang'); + + $sql = 'SELECT p.l' . $language_id . '_Translation as DestName, sd.DestAbbr FROM ' . TABLE_PREFIX . 'StdDestinations AS sd LEFT JOIN ' . TABLE_PREFIX . 'Phrase AS p ON p.Phrase = sd.DestName - WHERE DestType = 2 AND DestParentId = ' . $country_id . ' AND LanguageId = ' . $this->Application->GetVar('m_lang') . ' - ORDER BY Translation'; - + WHERE DestType = 2 AND DestParentId = ' . $country_id . ' + ORDER BY l' . $language_id . '_Translation'; $country_states[$country_abbr] = $this->Conn->GetCol($sql, 'DestAbbr'); } @@ -72,18 +73,19 @@ */ function CheckState($state_name, $country_code) { - if( !$this->CountryHasStates($country_code) ) return $state_name; + if (!$this->CountryHasStates($country_code)) { + return $state_name; + } $sql = 'SELECT sdStates.DestAbbr FROM '.TABLE_PREFIX.'StdDestinations AS sdStates LEFT JOIN '.TABLE_PREFIX.'Phrase AS p ON p.Phrase = sdStates.DestName LEFT JOIN '.TABLE_PREFIX.'StdDestinations AS sdCountries ON sdStates.DestParentId = sdCountries.DestId WHERE (sdStates.DestType = 2) AND (sdStates.DestParentId = sdCountries.DestId) AND - (p.LanguageId = %1$s) AND (sdCountries.DestAbbr = %2$s) AND ( - (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.Translation) = %3$s) + (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.l%1$s_Translation) = %3$s) )'; $state_name = trim( mb_strtolower($state_name) );