Index: branches/5.1.x/units/shipping_quote_engines/usps.php =================================================================== diff -u -r13100 -r13465 --- branches/5.1.x/units/shipping_quote_engines/usps.php (.../usps.php) (revision 13100) +++ branches/5.1.x/units/shipping_quote_engines/usps.php (.../usps.php) (revision 13465) @@ -1,6 +1,6 @@ Application->ConfigValue('Comm_Shipping_Country'); if ($country != '') { - $db =& $this->Application->GetADODBConnection(); - $this->shipping_origin_country = $db->GetOne( - 'SELECT DestAbbr2 - FROM '.TABLE_PREFIX.'StdDestinations - WHERE - DestAbbr = '.$db->qstr($country).' - AND destType = 1 - ' - ); + $this->shipping_origin_country = $this->GetUSPSCountry($country, ''); } + $contact_name = trim($this->_prepare_xml_param($this->Application->ConfigValue('Comm_Contacts_Name'))); $split_pos = strpos($contact_name, ' '); if ($split_pos === false) { @@ -1003,11 +996,14 @@ return array('TrackingNumber' => $TrackingNumber, 'PostnetBarCode' => $PostnetBarCode, 'Postage' => $Postage); } - function GetUSPSCountry($country) + function GetUSPSCountry($country, $default = 'US') { - $country = $this->Application->Conn->GetOne('SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = '.$this->Application->Conn->qstr($country)); - if ( $country == '' ) $country = 'US'; - return $country; + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $country = $cs_helper->getCountryIso($country); + + return $country == '' ? $default : $country; } function GetShippingQuotes($params = null)