From 596f252eb760a3a5b37b82c910b52618c832895c Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 2 Jun 2011 20:01:25 +0000 Subject: [PATCH] Patch from Bjorn Padding to silence JS error when addressbook is in LDAP --- addressbook/inc/class.addressbook_ldap.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_ldap.inc.php b/addressbook/inc/class.addressbook_ldap.inc.php index dd705c1be5..0124161424 100644 --- a/addressbook/inc/class.addressbook_ldap.inc.php +++ b/addressbook/inc/class.addressbook_ldap.inc.php @@ -123,12 +123,14 @@ class addressbook_ldap 'mozillaabpersonalpha' => array( 'adr_one_street2' => 'mozillaworkstreet2', 'adr_one_countryname' => 'c', // 2 letter country code + 'adr_one_countrycode' => 'c', // 2 letter country code 'adr_two_street' => 'mozillahomestreet', 'adr_two_street2' => 'mozillahomestreet2', 'adr_two_locality' => 'mozillahomelocalityname', 'adr_two_region' => 'mozillahomestate', 'adr_two_postalcode' => 'mozillahomepostalcode', 'adr_two_countryname' => 'mozillahomecountryname', + 'adr_two_countrycode' => 'mozillahomecountryname', 'email_home' => 'mozillasecondemail', 'url_home' => 'mozillahomeurl', ), @@ -1113,9 +1115,17 @@ class addressbook_ldap */ function _egw2mozillaabpersonalpha(&$ldapContact,$data,$isUpdate) { - if ($data['adr_one_countryname']) + if ($data['adr_one_countrycode']) + { + $ldapContact['c'] = $data['adr_one_countrycode']; + } + elseif ($data['adr_one_countryname']) { $ldapContact['c'] = ExecMethod('phpgwapi.country.country_code',$data['adr_one_countryname']); + if ($ldapContact['c'] && strlen($ldapContact['c']) > 2) // Bad countryname when "custom" selected! + { + $ldapContact['c'] = array(); // should return error... + } } elseif ($isUpdate) {