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,20 +804,22 @@ class addressbook_bo extends addressbook_so
}
// 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;
$contact[$c_prefix.'countrycode'] = $code;
}
else
{
$contact['adr_one_countrycode'] = null;
$contact[$c_prefix.'countrycode'] = null;
}
}
if($contact['adr_one_countrycode'] != null)
if($contact[$c_prefix.'countrycode'] != null)
{
$contact['adr_one_countryname'] = null;
$contact[$c_prefix.'countryname'] = null;
}
}
// last modified