Index: branches/2.2/contactcenter/inc/class.so_group.inc.php
===================================================================
--- branches/2.2/contactcenter/inc/class.so_group.inc.php	(revision 3215)
+++ branches/2.2/contactcenter/inc/class.so_group.inc.php	(revision 3216)
@@ -112,30 +112,31 @@
 			if ( $shared_from == NULL )
 			{
-				$query = "select"
-						. " phpgw_cc_connections.id_connection,"
-						. " phpgw_cc_contact.id_contact,"
-						. " phpgw_cc_contact.names_ordered,"
-						. " phpgw_cc_contact.alias,"
-						. " phpgw_cc_connections.connection_value ,"
-						. " phpgw_cc_contact_conns.id_typeof_contact_connection,"
-						. " phpgw_cc_addresses.address1,"
-						. " phpgw_cc_addresses.complement,"
-						. " phpgw_cc_addresses.postal_code,"
-						. " phpgw_cc_city.city_name,"
-						. " phpgw_cc_state.state_name,"
-						. " phpgw_cc_addresses.id_country";
-
-				$query .= " from"
-						. " phpgw_cc_contact"
-						. " inner join phpgw_cc_contact_conns on ( phpgw_cc_contact.id_contact = phpgw_cc_contact_conns.id_contact )"
-						. " inner join phpgw_cc_connections on ( phpgw_cc_contact_conns.id_connection = phpgw_cc_connections.id_connection )"
-						. " left join phpgw_cc_contact_addrs on ( phpgw_cc_contact.id_contact = phpgw_cc_contact_addrs.id_contact )"
-						. " left join phpgw_cc_addresses on ( phpgw_cc_contact_addrs.id_address = phpgw_cc_addresses.id_address )"
-						. " left join phpgw_cc_city on ( phpgw_cc_addresses.id_city = phpgw_cc_city.id_city )"
-						. " left join phpgw_cc_state on ( phpgw_cc_addresses.id_state = phpgw_cc_state.id_state)";
-
-				$query .= " where"
+				$query = 'select'
+						. ' phpgw_cc_connections.id_connection,'
+						. ' phpgw_cc_contact.id_contact,'
+						. ' phpgw_cc_contact.names_ordered,'
+						. ' phpgw_cc_contact.alias,'
+						. ' phpgw_cc_connections.connection_value,'
+						. ' phpgw_cc_contact_conns.id_typeof_contact_connection,'
+						. ' phpgw_cc_contact_addrs.id_typeof_contact_address,'
+						. ' phpgw_cc_addresses.address1,'
+						. ' phpgw_cc_addresses.complement,'
+						. ' phpgw_cc_addresses.postal_code,'
+						. ' phpgw_cc_city.city_name,'
+						. ' phpgw_cc_state.state_name,'
+						. ' phpgw_cc_addresses.id_country';
+
+				$query .= ' from'
+						. ' phpgw_cc_contact'
+						. ' inner join phpgw_cc_contact_conns on ( phpgw_cc_contact.id_contact = phpgw_cc_contact_conns.id_contact )'
+						. ' inner join phpgw_cc_connections on ( phpgw_cc_contact_conns.id_connection = phpgw_cc_connections.id_connection )'
+						. ' left join phpgw_cc_contact_addrs on ( phpgw_cc_contact.id_contact = phpgw_cc_contact_addrs.id_contact )'
+						. ' left join phpgw_cc_addresses on ( phpgw_cc_contact_addrs.id_address = phpgw_cc_addresses.id_address )'
+						. ' left join phpgw_cc_city on ( phpgw_cc_addresses.id_city = phpgw_cc_city.id_city )'
+						. ' left join phpgw_cc_state on ( phpgw_cc_addresses.id_state = phpgw_cc_state.id_state)';
+
+				$query .= ' where'
 						. " phpgw_cc_contact.id_owner = {$this->owner}"
-						. " and phpgw_cc_connections.connection_is_default = true";
+						. ' and phpgw_cc_connections.connection_is_default = true';
 
 			}
@@ -175,4 +176,26 @@
 			foreach( $return as $i => $object )
 			{
+				if ( ! array_key_exists( $object[ 'id_contact' ], $all_contacts ) )
+					$all_contacts[ $object[ 'id_contact' ] ] = array(
+						'connection_value' => '',
+						'phone' => '',
+						'names_ordered' => '',
+						'id_contact' => '',
+						'id_connection' => '',
+						'alias' => '',
+						'business-address' => '',
+						'complement' => '',
+						'postal_code' => '',
+						'city_name' => '',
+						'state_name' => '',
+						'id_country' => '',
+						'home-address' => '',
+						'complement' => '',
+						'postal_code' => '',
+						'city_name' => '',
+						'state_name' => '',
+						'id_country' => ''
+					);
+
 				switch( $object[ 'id_typeof_contact_connection' ] )
 				{
@@ -189,10 +212,24 @@
 				$all_contacts[ $object[ 'id_contact' ] ][ 'id_connection' ] = $object[ 'id_connection' ];
 				$all_contacts[ $object[ 'id_contact' ] ][ 'alias' ]         = $object[ 'alias' ];
-				$all_contacts[ $object[ 'id_contact' ] ][ 'address1' ]      = $object[ 'address1' ];
-				$all_contacts[ $object[ 'id_contact' ] ][ 'complement' ]    = $object[ 'complement' ];
-				$all_contacts[ $object[ 'id_contact' ] ][ 'postal_code' ]   = $object[ 'postal_code' ];
-				$all_contacts[ $object[ 'id_contact' ] ][ 'city_name' ]     = $object[ 'city_name' ];
-				$all_contacts[ $object[ 'id_contact' ] ][ 'state_name' ]    = $object[ 'state_name' ];
-				$all_contacts[ $object[ 'id_contact' ] ][ 'id_country' ]    = $object[ 'id_country' ];
+
+				switch( $object[ 'id_typeof_contact_address' ] )
+				{
+					case 1 :
+						$all_contacts[ $object[ 'id_contact' ] ][ 'business-address' ]     = $object[ 'address1' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'business-complement' ]  = $object[ 'complement' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'business-postal_code' ] = $object[ 'postal_code' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'business-city_name' ]   = $object[ 'city_name' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'business-state_name' ]  = $object[ 'state_name' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'business-id_country' ]  = $object[ 'id_country' ];
+						break;
+					case 2 :
+						$all_contacts[ $object[ 'id_contact' ] ][ 'home-address' ]     = $object[ 'address1' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'home-complement' ]  = $object[ 'complement' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'home-postal_code' ] = $object[ 'postal_code' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'home-city_name' ]   = $object[ 'city_name' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'home-state_name' ]  = $object[ 'state_name' ];
+						$all_contacts[ $object[ 'id_contact' ] ][ 'home-id_country' ]  = $object[ 'id_country' ];
+						break;
+				}
 			}
 
Index: branches/2.2/contactcenter/inc/class.ui_data.inc.php
===================================================================
--- branches/2.2/contactcenter/inc/class.ui_data.inc.php	(revision 3215)
+++ branches/2.2/contactcenter/inc/class.ui_data.inc.php	(revision 3216)
@@ -3479,17 +3479,26 @@
 
 				case 'expresso':
-					$streamBuffer = "Nome,Apelido,Email,Telefone,Endereço,Complemento,CEP,Cidade,Estado,País\r\n";
+					$streamBuffer = 'Nome,Apelido,Email,Telefone,'
+						. 'Endereço Comercial,Complemento End. Comercial,CEP Comercial,Cidade End. Comercial,Estado End. Comercial,País End. Comercial'
+						. 'Endereço Residencial,Complemento End. Residencial,CEP Residencial,Cidade End. Residencial,Estado End. Residencial,País End. Residencial'
+						. "\r\n";
 
 					foreach($contacts as $index => $object){
-						$streamBuffer .= $object[ 'names_ordered'] . ","
-							. $object[ 'alias' ] . ","
-							. $object[ 'connection_value' ] . ","
-							. $object[ 'phone' ] . ","
-							. $object[ 'address1' ] . ","
-							. $object[ 'complement' ] . ","
-							. $object[ 'postal_code' ] . ","
-							. $object[ 'city_name' ] . ","
-							. $object[ 'state_name' ] . ","
-							. $object[ 'id_country' ] . "\r\n";
+						$streamBuffer .= $object[ 'names_ordered'] . ','
+							. $object[ 'alias' ] . ','
+							. $object[ 'connection_value' ] . ','
+							. $object[ 'phone' ] . ','
+							. $object[ 'business-address' ] . ','
+							. $object[ 'business-complement' ] . ','
+							. $object[ 'business-postal_code' ] . ','
+							. $object[ 'business-city_name' ] . ','
+							. $object[ 'business-state_name' ] . ','
+							. $object[ 'business-id_country' ] . ','
+							. $object[ 'home-address' ] . ','
+							. $object[ 'home-complement' ] . ','
+							. $object[ 'home-postal_code' ] . ','
+							. $object[ 'home-city_name' ] . ','
+							. $object[ 'home-state_name' ] . ','
+							. $object[ 'home-id_country' ] . "\r\n";
 					}
 				break;
