Update private address country code also

This commit is contained in:
Nathan Gray 2010-09-28 19:55:55 +00:00
parent b86490c0a7
commit 22ed1ab411

View File

@ -804,21 +804,23 @@ class addressbook_bo extends addressbook_so
} }
// Update country codes // Update country codes
if($contact['adr_one_countryname'] && $code = $GLOBALS['egw']->country->country_code($contact['adr_one_countryname'])) foreach(array('adr_one_', 'adr_two_') as $c_prefix) {
{ if($contact[$c_prefix.'countryname'] && $code = $GLOBALS['egw']->country->country_code($contact[$c_prefix.'countryname']))
if(strlen($code) == 2)
{ {
$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 // last modified
$contact['modifier'] = $this->user; $contact['modifier'] = $this->user;