From 22ed1ab41193fc465d91d2ef46a58a27bad831eb Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 28 Sep 2010 19:55:55 +0000 Subject: [PATCH] Update private address country code also --- addressbook/inc/class.addressbook_bo.inc.php | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/addressbook/inc/class.addressbook_bo.inc.php b/addressbook/inc/class.addressbook_bo.inc.php index 27d9241989..ab34f81bc3 100755 --- a/addressbook/inc/class.addressbook_bo.inc.php +++ b/addressbook/inc/class.addressbook_bo.inc.php @@ -804,21 +804,23 @@ class addressbook_bo extends addressbook_so } // Update country codes - if($contact['adr_one_countryname'] && $code = $GLOBALS['egw']->country->country_code($contact['adr_one_countryname'])) - { - if(strlen($code) == 2) + foreach(array('adr_one_', 'adr_two_') as $c_prefix) { + if($contact[$c_prefix.'countryname'] && $code = $GLOBALS['egw']->country->country_code($contact[$c_prefix.'countryname'])) { - $contact['adr_one_countrycode'] = $code; + if(strlen($code) == 2) + { + $contact[$c_prefix.'countrycode'] = $code; + } + else + { + $contact[$c_prefix.'countrycode'] = null; + } } - else + if($contact[$c_prefix.'countrycode'] != null) { - $contact['adr_one_countrycode'] = null; + $contact[$c_prefix.'countryname'] = null; } } - if($contact['adr_one_countrycode'] != null) - { - $contact['adr_one_countryname'] = null; - } // last modified $contact['modifier'] = $this->user;