forked from extern/egroupware
moved formatted_address() to contacts class
This commit is contained in:
parent
11d0e8247d
commit
dcbf229a19
@ -624,80 +624,5 @@
|
||||
{
|
||||
return($this->country_array[$selected]);
|
||||
}
|
||||
|
||||
function formatted_address($id = '',$fields = '',$business = True)
|
||||
{
|
||||
global $phpgw,$phpgw_info;
|
||||
|
||||
$font = $phpgw_info['theme']['font'];
|
||||
|
||||
$d = CreateObject('phpgwapi.contacts');
|
||||
|
||||
$address = $d->read_single_entry($id,$fields);
|
||||
|
||||
if ($address[0]['title'])
|
||||
{
|
||||
$title = $address[0]['title'] . ' ';
|
||||
}
|
||||
|
||||
$a = '<table border="0" cellpadding="2" cellspacing="2"' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
$a .= '<td><font face="' . $font . '">' . $title . $address[0]['n_given'] . ' ' . $address[0]['n_family'] . '</font></td>' . "\n";
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
$a .= '<td><font face="' . $font . '">' . $address[0]['org_name'] . '</font></td>' . "\n";
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
$a .= '<td><font face="' . $font . '">' . $address[0]['org_unit'] . '</font></td>' . "\n";
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
|
||||
if ($business)
|
||||
{
|
||||
$street = $address[0]['adr_one_street'];
|
||||
$city = $address[0]['adr_one_locality'];
|
||||
$zip = $address[0]['adr_one_postalcode'];
|
||||
$state = $address[0]['adr_one_region'];
|
||||
$country = $address[0]['adr_one_countryname'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$street = $address[0]['adr_two_street'];
|
||||
$city = $address[0]['adr_two_locality'];
|
||||
$zip = $address[0]['adr_two_postalcode'];
|
||||
$state = $address[0]['adr_two_region'];
|
||||
$country = $address[0]['adr_two_countryname'];
|
||||
}
|
||||
|
||||
$a .= '<td><font face="' . $font . '">' . $street . '</font></td>' . "\n";
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
|
||||
if (! $country)
|
||||
{
|
||||
$country = $phpgw_info['user']['preferences']['common']['country'];
|
||||
}
|
||||
|
||||
if ($country == 'DE')
|
||||
{
|
||||
$a .= '<td><font face="' . $font . '">' . $city . '</font></td>' . "\n";
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
$a .= '<td><font face="' . $font . '">' . $zip . '</font></td>' . "\n";
|
||||
}
|
||||
|
||||
if ($country == 'US')
|
||||
{
|
||||
$a .= '<td><font face="' . $font . '">' . $city . ', ' . $state . ' ' . $zip . '</font></td>' . "\n";
|
||||
}
|
||||
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '<tr>' . "\n";
|
||||
$a .= '<td><font face="' . $font . '">' . lang($country) . '</font></td>' . "\n";
|
||||
$a .= '</tr>' . "\n";
|
||||
$a .= '</table>' . "\n";
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user