From: Michael J. Rubinsky Date: Tue, 11 May 2010 15:33:12 +0000 (-0400) Subject: Fix country handling for AS. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=08ff640a899e24b87ad0eb48e6dcada817155d48;p=horde.git Fix country handling for AS. Use the localized name of the country when sending to the device, and assume the value coming from the device is also the localized name. --- diff --git a/turba/lib/Driver.php b/turba/lib/Driver.php index 982598ce4..8547bf70a 100644 --- a/turba/lib/Driver.php +++ b/turba/lib/Driver.php @@ -2340,7 +2340,7 @@ class Turba_Driver $message->homepostalcode = Horde_String::convertCharset($hash['homePostalCode'], $charset, 'utf-8'); break; case 'homeCountry': - $message->homecountry = Horde_String::convertCharset($hash['homeCountry'], $charset, 'utf-8'); + $message->homecountry = Horde_String::convertCharset(self::getCountry($hash['homeCountry']), $charset, 'utf-8'); break; case 'workStreet': $message->businessstreet = Horde_String::convertCharset($hash['workStreet'], $charset, 'utf-8'); @@ -2450,12 +2450,10 @@ class Turba_Driver 'homecity' => 'homeCity', 'homestate' => 'homeProvince', 'homepostalcode' => 'homePostalCode', - 'homecountry' => 'homeCountry', 'businessstreet' => 'workStreet', 'businesscity' => 'workCity', 'businessstate' => 'workProvince', 'businesspostalcode' => 'workPostalCode', - 'businesscountry' => 'workCountry', 'jobtitle' => 'title', 'companyname' => 'company', 'department' => 'department', @@ -2517,6 +2515,19 @@ class Turba_Driver $hash['anniversary'] = null; } + /* Countries */ + include 'Horde/Nls/Countries.php'; + $country = array_search($message->homecountry, $countries); + if ($country === false) { + $country = Horde_String::convertCharset($message->homecountry, 'utf-8', $charset); + } + $hash['homeCountry'] = $country; + $country = array_search($message->businesscountry, $countries); + if ($country === false) { + $country = Horde_String::convertCharset($message->businesscountry, 'utf-8', $charset); + } + $hash['workCountry'] = $country; + return $hash; }