Changeset 3322 for branches


Ignore:
Timestamp:
10/05/10 11:40:25 (14 years ago)
Author:
eduardoalex
Message:

Ticket #1259 - adicionado campos para exportacao de todos os padroes

Location:
branches/2.2/contactcenter/inc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/contactcenter/inc/class.bo_people_catalog.inc.php

    r1517 r3322  
    10801080                                $preferences['personCardPhone'] = 2; 
    10811081                        } 
     1082                        if(!$data['is_quick_add']){                      
     1083                                $sql = "select * FROM phpgw_cc_state where (upper(state_name) = upper('".$data['addresses']['address_corporative']['id_state']."')) or (upper(state_symbol) = upper('".$data['addresses']['address_corporative']['id_state']."'))";      
     1084                                                         
     1085                                $this->db->query($sql, __LINE__, __FILE__); 
     1086                                 
     1087                                $corporative_state = array('id_state'=>2); 
     1088                                while($this->db->next_record()) 
     1089                                { 
     1090                                        $corporative_state = $this->db->row();  
     1091                                } 
     1092                                 
     1093                                $sql = "select * FROM phpgw_cc_city where id_state = ".$corporative_state['id_state']." and upper(city_name) = upper('".$data['addresses']['address_corporative']['id_city']."') "; 
     1094                                                                                 
     1095                                $this->db->query($sql, __LINE__, __FILE__); 
     1096                                 
     1097                                $corporative_city = array('id_city'=>null); 
     1098                                while($this->db->next_record()) 
     1099                                { 
     1100                                        $corporative_city = $this->db->row();  
     1101                                } 
     1102                                 
     1103                                //Personal Address 
     1104                                 
     1105                                $sql = "select * FROM phpgw_cc_state where upper(state_name) = upper('".$data['addresses']['address_personal']['id_state']."')";         
     1106                                                         
     1107                                $this->db->query($sql, __LINE__, __FILE__); 
     1108                                 
     1109                                $personal_state = array('id_state'=>2); 
     1110                                while($this->db->next_record()) 
     1111                                { 
     1112                                        $personal_state = $this->db->row();  
     1113                                } 
     1114                                 
     1115                                $sql = "select * FROM phpgw_cc_city where id_state = ".$personal_state['id_state']." and upper(city_name) = upper('".$data['addresses']['address_personal']['id_city']."') "; 
     1116                                                                                 
     1117                                $this->db->query($sql, __LINE__, __FILE__); 
     1118                                 
     1119                                $personal_city = array('id_city'=>null); 
     1120                                while($this->db->next_record()) 
     1121                                { 
     1122                                        $personal_city = $this->db->row();  
     1123                                } 
     1124                        } 
    10821125                         
    10831126                        $new_data = array( 
    1084                                 'alias'                 => $data['alias'], 
    1085                                 'id_status'             => 1, 
    1086                                 'given_names'           => $data['given_names'], 
    1087                                 'family_names'          => $data['family_names'], 
    1088                                 'names_ordered'         => $data['given_names'].' '.$data['family_names'], 
    1089                                 'birthdate'             => $data['birthdate'], 
    1090                                 'notes'                 => $data['notes'], 
     1127                                'notes'              => $data['notes'], 
     1128                                'alias'              => $data['alias'], 
     1129                                'id_status'          => 1, 
     1130                                'given_names'        => $data['given_names'], 
     1131                                'family_names'       => $data['family_names'], 
     1132                                'names_ordered'      => $data['given_names'].' '.$data['family_names'], 
     1133                                'family_names'       => $data['family_names'], 
     1134                                'alias'                  => $data['alias'], 
     1135                                'corporate_name'     => $data['corporate_name'], 
     1136                                'job_title'              => $data['job_title'], 
     1137                                'department'             => $data['department'], 
     1138                                'web_page'               => $data['web_page'], 
     1139                                'birthdate'                      => $data['birthdate'], 
     1140                                'pgp_key'                => $data['pgp_key'], 
     1141                                'sex'                    => $data['sex'], 
    10911142                        ); 
    10921143 
     
    11021153                                $i++; 
    11031154                        } 
    1104  
     1155                         
     1156                        if ($data['connections']['aditional_email']['connection_value']) 
     1157                        { 
     1158                                $new_data['connections']['connection'.$i] = array( 
     1159                                        'id_typeof_connection'  => $preferences['personCardEmail'], 
     1160                                        'connection_name'       => $data['connections']['aditional_email']['connection_name'], 
     1161                                        'connection_value'      => $data['connections']['aditional_email']['connection_value'], 
     1162                                        'connection_is_default' => 0, 
     1163                                ); 
     1164                                $i++; 
     1165                        } 
     1166                                                         
    11051167                        if ($data['connections']['default_phone']['connection_value']) 
    11061168                        { 
     
    11111173                                        'connection_is_default' => 1, 
    11121174                                ); 
     1175                                 
     1176                                 
     1177                                foreach($data['connections']['aditional_phone'] as $connection_name => $connection_fields) 
     1178                                { 
     1179                                        if($connection_fields['connection_value'] != ''){ 
     1180                                                $i++; 
     1181                                                $new_data['connections']['connection'.$i] = array( 
     1182                                                'id_typeof_connection'  => $preferences['personCardPhone'], 
     1183                                                'connection_name'       => $connection_fields['connection_name'], 
     1184                                                'connection_value'      => $connection_fields['connection_value'], 
     1185                                                'connection_is_default' => 0, 
     1186                                                ); 
     1187                                        }                                        
     1188                                } 
     1189                                 
     1190                        }else{ 
     1191                                $default =1; 
     1192                                foreach($data['connections']['aditional_phone'] as $connection_name => $connection_fields) 
     1193                                { 
     1194                                        $i++; 
     1195                                        $new_data['connections']['connection'.$i] = array( 
     1196                                        'id_typeof_connection'  => $preferences['personCardPhone'], 
     1197                                        'connection_name'       => $connection_fields['connection_name'], 
     1198                                        'connection_value'      => $connection_fields['connection_value'], 
     1199                                        'connection_is_default' => $default, 
     1200                                        ); 
     1201                                        $default = 0;                                    
     1202                                } 
     1203                        } 
     1204                        if(!$data['is_quick_add']){                      
     1205                                $new_data['addresses']['address'.$i] = array( 
     1206                                        'id_typeof_address'  => 2, 
     1207                                        'address1'       => $data['addresses']['address_personal']['address1'], 
     1208                                        'address2'       => $data['addresses']['address_personal']['address2'], 
     1209                                        'complement'     => $data['addresses']['address_personal']['complement'], 
     1210                                        'postal_code'    => $data['addresses']['address_personal']['postal_code'], 
     1211                                        'id_country'     => $data['addresses']['address_personal']['id_country'], 
     1212                                        'id_state'               => $personal_state['id_state'], 
     1213                                        'id_city'                => $personal_city['id_city'], 
     1214                                        'address_is_default' => 0, 
     1215                                ); 
    11131216                                $i++; 
    1114                         } 
    1115  
    1116                         if($data['connections']['fax']['connection_value']) 
    1117                         { 
    1118                                 $new_data['connections']['connection'.$i] = array( 
    1119                                         'id_typeof_connection'  => $preferences['personCardPhone'], 
    1120                                         'connection_name'       => $data['connections']['fax']['connection_name'], 
    1121                                         'connection_value'      => $data['connections']['fax']['connection_value'], 
    1122                                         'connection_is_default' => 'false', 
    1123                                 ); 
     1217                         
     1218                                $new_data['addresses']['address'.$i] = array( 
     1219                                        'id_typeof_address'  => 1, 
     1220                                        'address1'       => $data['addresses']['address_corporative']['address1'], 
     1221                                        'address2'       => $data['addresses']['address_corporative']['address2'], 
     1222                                        'complement'     => $data['addresses']['address_corporative']['complement'], 
     1223                                        'postal_code'    => $data['addresses']['address_corporative']['postal_code'], 
     1224                                        'id_country'     => $data['addresses']['address_corporative']['id_country'], 
     1225                                        'id_state'               => $corporative_state['id_state'], 
     1226                                        'id_city'                => $corporative_city['id_city'], 
     1227                                        'address_is_default' => 1, 
     1228                                );                                                       
    11241229                                $i++; 
    11251230                        } 
    11261231 
    1127                         if($data['connections']['residencial_phone']['connection_value']) 
    1128                         { 
    1129                                 $new_data['connections']['connection'.$i] = array( 
    1130                                         'id_typeof_connection'  => $preferences['personCardPhone'], 
    1131                                         'connection_name'       => $data['connections']['residencial_phone']['connection_name'], 
    1132                                         'connection_value'      => $data['connections']['residencial_phone']['connection_value'], 
    1133                                         'connection_is_default' => 'false', 
    1134                                 ); 
    1135                                 $i++; 
    1136                         } 
    1137  
    1138                         if($data['connections']['cellular_phone']['connection_value']) 
    1139                         { 
    1140                                 $new_data['connections']['connection'.$i] = array( 
    1141                                         'id_typeof_connection'  => $preferences['personCardPhone'], 
    1142                                         'connection_name'       => $data['connections']['cellular_phone']['connection_name'], 
    1143                                         'connection_value'      => $data['connections']['cellular_phone']['connection_value'], 
    1144                                         'connection_is_default' => 'false', 
    1145                                 ); 
    1146                                 $i++; 
    1147                         } 
    1148  
    1149                         if($data['connections']['pager']['connection_value']) 
    1150                         { 
    1151                                 $new_data['connections']['connection'.$i] = array( 
    1152                                         'id_typeof_connection'  => $preferences['personCardPhone'], 
    1153                                         'connection_name'       => $data['connections']['pager']['connection_name'], 
    1154                                         'connection_value'      => $data['connections']['pager']['connection_value'], 
    1155                                         'connection_is_default' => 'false', 
    1156                                 ); 
    1157                                 $i++; 
    1158                         } 
    1159  
    1160                         if($data['connections']['alternative_email']['connection_value']) 
    1161                         { 
    1162                                 $new_data['connections']['connection'.$i] = array( 
    1163                                         'id_typeof_connection'  => $preferences['personCardEmail'], 
    1164                                         'connection_name'       => $data['connections']['alternative_email']['connection_name'], 
    1165                                         'connection_value'      => $data['connections']['alternative_email']['connection_value'], 
    1166                                         'connection_is_default' => 'false', 
    1167                                 ); 
    1168                                 $i++; 
    1169                         } 
    11701232                        $j = 1; 
    11711233 
    1172                         if($data['addresses']['addr1']['address_value']) 
     1234                        /*if($data['addresses']['addr1']['address_value']) 
    11731235                        { 
    11741236                                $new_data['addresses']['address'.$j] = array( 
     
    11851247                                ); 
    11861248                                $j++; 
    1187                         } 
     1249                        }*/ 
    11881250 
    11891251 
  • branches/2.2/contactcenter/inc/class.so_group.inc.php

    r3217 r3322  
    117117                                                . ' phpgw_cc_contact.names_ordered,' 
    118118                                                . ' phpgw_cc_contact.alias,' 
     119                                                . ' phpgw_cc_contact.birthdate,' 
     120                                                . ' phpgw_cc_contact.sex,' 
     121                                                . ' phpgw_cc_contact.pgp_key,' 
     122                                                . ' phpgw_cc_contact.notes,' 
     123                                                . ' phpgw_cc_contact.web_page,' 
     124                                                . ' phpgw_cc_contact.corporate_name,' 
     125                                                . ' phpgw_cc_contact.job_title,' 
     126                                                . ' phpgw_cc_contact.department,' 
    119127                                                . ' phpgw_cc_connections.connection_name,' 
    120128                                                . ' phpgw_cc_connections.connection_value,' 
     
    122130                                                . ' phpgw_cc_contact_addrs.id_typeof_contact_address,' 
    123131                                                . ' phpgw_cc_addresses.address1,' 
     132                                                . ' phpgw_cc_addresses.address2,' 
    124133                                                . ' phpgw_cc_addresses.complement,' 
    125134                                                . ' phpgw_cc_addresses.postal_code,' 
     
    189198                                                'id_connection' => '', 
    190199                                                'alias' => '', 
     200                                                'birthdate' => '', 
     201                                                'sex' => '', 
     202                                                'pgp_key' => '', 
     203                                                'notes' => '', 
     204                                                'web_page' => '', 
     205                                                'corporate_name' => '', 
     206                                                'job_title' => '', 
     207                                                'department' => '',                              
    191208                                                'main-mail' => '', 
    192209                                                'aternative-mail' => '', 
     
    198215                                                'business-state_name' => '', 
    199216                                                'business-id_country' => '', 
     217                                                'business-fax' => '', 
     218                                                'business-pager' => '', 
     219                                                'business-mobile' => '', 
     220                                                'business-address-2' => '', 
    200221                                                'home-phone' => '', 
    201222                                                'home-address' => '', 
     
    204225                                                'home-city_name' => '', 
    205226                                                'home-state_name' => '', 
    206                                                 'home-id_country' => '' 
     227                                                'home-fax' => '', 
     228                                                'home-pager' => '', 
     229                                                'home-address-2' => '' 
     230                                                 
     231                                                 
    207232                                        ); 
    208233 
     
    233258                                                        case 'trabalho' : 
    234259                                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-phone' ] = $object[ 'connection_value' ]; 
     260                                                                break;                                                           
     261                                                        case 'fax' : 
     262                                                                $all_contacts[ $object[ 'id_contact' ] ][ 'home-fax' ] = $object[ 'connection_value' ]; 
     263                                                                break; 
     264                                                        case 'pager' : 
     265                                                                $all_contacts[ $object[ 'id_contact' ] ][ 'home-pager' ] = $object[ 'connection_value' ]; 
     266                                                                break; 
     267                                                        case 'celular corporativo' : 
     268                                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-mobile' ] = $object[ 'connection_value' ]; 
     269                                                                break;                                                           
     270                                                        case 'pager corporativo' : 
     271                                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-pager' ] = $object[ 'connection_value' ]; 
     272                                                                break; 
     273                                                        case 'fax corporativo' : 
     274                                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-fax' ] = $object[ 'connection_value' ]; 
    235275                                                                break; 
    236276                                                } 
     
    241281                                $all_contacts[ $object[ 'id_contact' ] ][ 'id_contact' ]    = $object[ 'id_contact' ]; 
    242282                                $all_contacts[ $object[ 'id_contact' ] ][ 'id_connection' ] = $object[ 'id_connection' ]; 
    243                                 $all_contacts[ $object[ 'id_contact' ] ][ 'alias' ]         = $object[ 'alias' ]; 
     283                                $all_contacts[ $object[ 'id_contact' ] ][ 'alias' ]         = $object[ 'alias' ];                                
     284                                $all_contacts[ $object[ 'id_contact' ] ][ 'birthdate' ]         = $object[ 'birthdate' ]; 
     285                                $all_contacts[ $object[ 'id_contact' ] ][ 'sex' ]               = $object[ 'sex' ]; 
     286                                $all_contacts[ $object[ 'id_contact' ] ][ 'pgp_key' ]           = $object[ 'pgp_key' ]; 
     287                                $all_contacts[ $object[ 'id_contact' ] ][ 'notes' ]         = $object[ 'notes' ]; 
     288                                $all_contacts[ $object[ 'id_contact' ] ][ 'web_page' ]          = $object[ 'web_page' ]; 
     289                                $all_contacts[ $object[ 'id_contact' ] ][ 'corporate_name' ]= $object[ 'corporate_name' ]; 
     290                                $all_contacts[ $object[ 'id_contact' ] ][ 'job_title' ]         = $object[ 'job_title' ]; 
     291                                $all_contacts[ $object[ 'id_contact' ] ][ 'department' ]    = $object[ 'department' ]; 
    244292 
    245293                                switch( $object[ 'id_typeof_contact_address' ] ) 
     
    247295                                        case 1 : 
    248296                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-address' ]     = $object[ 'address1' ]; 
     297                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-address-2' ]   = $object[ 'address2' ]; 
    249298                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-complement' ]  = $object[ 'complement' ]; 
    250299                                                $all_contacts[ $object[ 'id_contact' ] ][ 'business-postal_code' ] = $object[ 'postal_code' ]; 
     
    255304                                        case 2 : 
    256305                                                $all_contacts[ $object[ 'id_contact' ] ][ 'home-address' ]     = $object[ 'address1' ]; 
     306                                                $all_contacts[ $object[ 'id_contact' ] ][ 'home-address-2' ]   = $object[ 'address2' ]; 
    257307                                                $all_contacts[ $object[ 'id_contact' ] ][ 'home-complement' ]  = $object[ 'complement' ]; 
    258308                                                $all_contacts[ $object[ 'id_contact' ] ][ 'home-postal_code' ] = $object[ 'postal_code' ]; 
  • branches/2.2/contactcenter/inc/class.ui_data.inc.php

    r3313 r3322  
    17101710                        /*Corporative*/ 
    17111711                        if($GLOBALS['phpgw_info']['server']['personal_contact_type']=='True'){ 
    1712                                 $data['personal']['cc_name_corporate'] = $entry['corporate_name']; 
    17131712                                $data['personal']['cc_job_title'] = $entry['job_title']; 
    17141713                                $data['personal']['cc_department'] = $entry['department']; 
     
    35253524                                case 'outlook_en': 
    35263525                                        $streamBuffer = "Name;E-mail Address;Notes;Mobile Phone;Pager;Company;". 
    3527                                         "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n";                                                         
    3528  
     3526                                                        "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n";                                                         
    35293527                                        foreach($contacts as $index => $object){ 
    3530                                                 $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;\r\n"; 
     3528                                                $streamBuffer.= "\"".$object[ 'names_ordered'] . "\";" 
     3529                                                        . "\"".$object[ 'main-mail' ] . "\";" 
     3530                                                        . "\"".str_replace("\r\n\x0a","\t",$object[ 'notes' ]) . "\";" 
     3531                                                        . "\"".$object[ 'mobile' ] . "\";" 
     3532                                                        . "\"".$object[ 'business-pager' ] . "\";" 
     3533                                                        . "\"".$object[ 'corporate_name' ] . "\";" 
     3534                                                        . "\"".$object[ 'job_title' ] . "\";" 
     3535                                                        . "\"".$object[ 'home-phone' ] . "\";" 
     3536                                                        . "\"".$object[ 'home-fax' ] . "\";" 
     3537                                                        . "\"".$object[ 'business-phone' ] . "\";" 
     3538                                                        . "\"".$object[ 'business-fax' ] . "\"\r\n"; 
    35313539                                        } 
    35323540                                        break; 
    35333541 
    35343542                                case 'outlook_pt-BR': 
    3535                                         $streamBuffer = "Nome;End. de email;Endereï¿œo residencial;". 
    3536                                         "Cidade do endereï¿œo residencial;CEP do endereï¿œo residencial;". 
    3537                                         "Estado;Paï¿œs/regiï¿œo do endereï¿œo residencial;Telefone residencial;". 
    3538                                         "Rua do endereï¿œo comercial;Cidade do endereï¿œo comercial;". 
    3539                                         "CEP do endereï¿œo comercial;Estado do endereï¿œo comercial;". 
    3540                                         "Paï¿œs/regiï¿œo do endereï¿œo comercial;Telefone comercial;Empresa;Cargo\r\n"; 
     3543                                        $streamBuffer = "Nome;Sobrenome;Segundo nome;Nome;Apelido;End. de email;Endereço residencial;" 
     3544                                                                        ."Cidade do endereço residencial;CEP do endereço residencial;Estado;País/região do endereço residencial;" 
     3545                                                                        ."Telefone residencial;Fax residencial;Telefone celular;Página pessoal da Web;Rua do endereço comercial;" 
     3546                                                                        ."Cidade do endereço comercial;CEP do endereço comercial;Estado do endereço comercial;" 
     3547                                                                        ."País/região do endereço comercial;Página comercial da Web;Telefone comercial;Fax comercial;Pager;Empresa;" 
     3548                                                                        ."Cargo;Departamento;End. comercial;Observações\r\n"; 
    35413549 
    35423550                                        foreach($contacts as $index => $object){ 
    3543                                                 $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 
     3551                                                $streamBuffer.= "\"".$object[ 'names_ordered'] . "\";" 
     3552                                                        .";;;" 
     3553                                                        . "\"".$object[ 'alias' ] . "\";" 
     3554                                                        . "\"".$object[ 'main-mail' ] . "\";" 
     3555                                                        . "\"".$object[ 'home-address' ] . "\";" 
     3556                                                        . "\"".$object[ 'home-city_name' ] . "\";" 
     3557                                                        . "\"".$object[ 'home-postal_code' ] . "\";" 
     3558                                                        . "\"".$object[ 'home-state_name' ] . "\";" 
     3559                                                        . "\"".$object[ 'home-id_country' ] . "\";" 
     3560                                                        . "\"".$object[ 'home-phone' ] . "\";" 
     3561                                                        . "\"".$object[ 'home-fax' ] . "\";" 
     3562                                                        . "\"".$object[ 'mobile' ] . "\";" 
     3563                                                        . "\"".$object[ 'web_page' ] . "\";" 
     3564                                                        . "\"".$object[ 'business-address' ] . "\";" 
     3565                                                        . "\"".$object[ 'business-city_name' ] . "\";" 
     3566                                                        . "\"".$object[ 'business-postal_code' ] . "\";" 
     3567                                                        . "\"".$object[ 'business-state_name' ] . "\";" 
     3568                                                        . "\"".$object[ 'business-id_country' ] . "\";" 
     3569                                                        . "\"".$object[ 'web_page' ] . "\";" 
     3570                                                        . "\"".$object[ 'business-phone' ] . "\";" 
     3571                                                        . "\"".$object[ 'business-fax' ] . "\";" 
     3572                                                        . "\"".$object[ 'business-pager' ] . "\";" 
     3573                                                        . "\"".$object[ 'corporate_name' ] . "\";" 
     3574                                                        . "\"".$object[ 'job_title' ] . "\";" 
     3575                                                        . "\"".$object[ 'department' ] . "\";" 
     3576                                                        .";" 
     3577                                                        . "\"".str_replace("\r\n\x0a","\t",$object[ 'notes' ]) . "\"\r\n"; 
    35443578                                        } 
     3579 
    35453580                                break; 
    35463581 
    35473582                                case 'outlook2000_pt-BR': 
    35483583                                        $streamBuffer = "\"Tratamento\",\"Nome\",\"Segundo Nome\",\"Sobrenome\",\"Sufixo\",". 
    3549                                         "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endereï¿œo comercial\",\"Rua do endereï¿œo comercial 2\",". 
    3550                                         "\"Rua do endereï¿œo comercial 3\",\"Cidade do endereï¿œo comercial\",\"Estado do endereï¿œo comercial\",". 
    3551                                         "\"CEP do endereï¿œo comercial\",\"Paï¿œs do endereï¿œo comercial\",\"Endereï¿œo residencial\",\"Rua residencial 2\",". 
    3552                                         "\"Rua residencial 3\",\"Cidade do endereï¿œo residencial\",\"Estado\",\"CEP do endereï¿œo residencial\",\"Paï¿œs do endereï¿œo residencial\",". 
    3553                                         "\"Outro endereï¿œo\",\"Outro endereï¿œo 2\",\"Outro endereï¿œo 3\",\"Cidade\",\"Estado\",\"CEP\",\"Paï¿œs\",". 
     3584                                        "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endereço comercial\",\"Rua do endereço comercial 2\",". 
     3585                                        "\"Rua do endereço comercial 3\",\"Cidade do endereço comercial\",\"Estado do endereço comercial\",". 
     3586                                        "\"CEP do endereço comercial\",\"País do endereço comercial\",\"Endereço residencial\",\"Rua residencial 2\",". 
     3587                                        "\"Rua residencial 3\",\"Cidade do endereço residencial\",\"Estado\",\"CEP do endereço residencial\",\"País do endereço residencial\",". 
     3588                                        "\"Outro endereço\",\"Outro endereço 2\",\"Outro endereço 3\",\"Cidade\",\"Estado\",\"CEP\",\"País\",". 
    35543589                                        "\"Telefone do assistente\",\"Fax comercial\",\"Telefone comercial\",\"Telefone comercial 2\",\"Retorno de chamada\",". 
    35553590                                        "\"Telefone do carro\",\"Telefone principal da empresa\",\"Fax residencial\",\"Telefone residencial\",". 
    35563591                                        "\"Telefone residencial 2\",\"ISDN\",\"Telefone celular\",\"Outro fax\",\"Outro telefone\",\"Pager\",\"Telefone principal\",". 
    3557                                         "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Aniversï¿œrio\",\"Anotaᅵᅵes\",\"Caixa postal\",\"Categorias\",". 
    3558                                         "\"Cï¿œdigo da empresa\",\"Cï¿œdigo do governo\",\"Cï¿œnjuge\",\"Conta\",\"Endereï¿œo de correio eletrï¿œnico\",". 
    3559                                         "\"Nome de exibiᅵᅵo do correio eletr.\",\"Endereï¿œo de correio eletrï¿œnico 2\",". 
    3560                                         "\"Nome de exibiᅵᅵo do correio eletr.2\",\"Endereï¿œo de correio eletrï¿œnico 3\",". 
    3561                                         "\"Nome de exibiᅵᅵo do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",". 
    3562                                         "\"Filhos\",\"Hobby\",\"Idioma\",\"Indicaᅵᅵo\",\"Informaᅵᅵes para cobranï¿œa\",\"Iniciais\",\"Local\",". 
    3563                                         "\"Nome do assistente\",\"Nome do gerenciador\",\"Pï¿œgina da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",". 
    3564                                         "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissï¿œo\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretï¿œrio\",". 
     3592                                        "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Aniversário\",\"Anotações\",\"Caixa postal\",\"Categorias\",". 
     3593                                        "\"Código da empresa\",\"Código do governo\",\"Cônjuge\",\"Conta\",\"Endereço de correio eletrônico\",". 
     3594                                        "\"Nome de exibição do correio eletr.\",\"Endereço de correio eletrônico 2\",". 
     3595                                        "\"Nome de exibição do correio eletr.2\",\"Endereço de correio eletrônico 3\",". 
     3596                                        "\"Nome de exibição do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",". 
     3597                                        "\"Filhos\",\"Hobby\",\"Idioma\",\"Indicação\",\"Informações para cobrança\",\"Iniciais\",\"Local\",". 
     3598                                        "\"Nome do assistente\",\"Nome do gerenciador\",\"Página da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",". 
     3599                                        "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissão\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretório\",". 
    35653600                                        "\"Sexo\"\r\n"; 
    35663601 
     3602 
     3603 
    35673604                                        foreach($contacts as $index => $object){ 
    3568                                                 $streamBuffer.= ",\"".$object['names_ordered']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['connection_value']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    3569                                         } 
     3605                                $streamBuffer .= "\"".$object[ 'alias' ] . "\","                                     
     3606                                                                . "\"".$object[ 'names_ordered' ] . "\"," 
     3607                                                                .",,," 
     3608                                                                . "\"".$object[ 'corporate_name' ] . "\"," 
     3609                                                                . "\"".$object[ 'department' ] . "\"," 
     3610                                                                . "\"".$object[ 'job_title' ] . "\"," 
     3611                                                                . "\"".$object[ 'business-address' ] . "\"," 
     3612                                                                . "\"".$object[ 'business-address-2' ] . "\"," 
     3613                                                                ."," 
     3614                                                                . "\"".$object[ 'business-city_name' ] . "\"," 
     3615                                                                . "\"".$object[ 'business-state' ] . "\"," 
     3616                                                                . "\"".$object[ 'business-postal_code' ] . "\"," 
     3617                                                                . "\"".$object[ 'business-id_country' ] . "\"," 
     3618                                                                . "\"".$object[ 'home-address' ] . "\"," 
     3619                                                                . "\"".$object[ 'home-address-2' ] . "\"," 
     3620                                                                ."," 
     3621                                                                . "\"".$object[ 'home-city_name' ] . "\"," 
     3622                                                                . "\"".$object[ 'home-state_name' ] . "\"," 
     3623                                                                . "\"".$object[ 'home-postal_code' ] . "\"," 
     3624                                                                . "\"".$object[ 'home-id_country' ] . "\"," 
     3625                                                                .",,,,,,,," 
     3626                                                                . "\"".$object[ 'business-fax' ] . "\"," 
     3627                                                                . "\"".$object[ 'business-phone' ] . "\"," 
     3628                                                                . "\"".$object[ 'business-mobile' ] . "\"," 
     3629                                                                .",,," 
     3630                                                                . "\"".$object[ 'home-fax' ] . "\"," 
     3631                                                                . "\"".$object[ 'home-phone' ] . "\"," 
     3632                                                                .",," 
     3633                                                                . "\"".$object[ 'mobile' ] . "\"," 
     3634                                                                .",," 
     3635                                                                . "\"".$object[ 'home-pager' ] . "\"," 
     3636                                                                . "\"".$object[ 'business-phone' ] . "\"," 
     3637                                                                .",,," 
     3638                                                                . "\"".$object[ 'birthdate' ] . "\"," 
     3639                                                                . "\"".str_replace("\r\n\x0a","\t",$object[ 'notes' ]) . "\"," 
     3640                                                                .",,,,,," 
     3641                                                                . "\"".$object[ 'main-mail' ] . "\"," 
     3642                                                                ."," 
     3643                                                                . "\"".$object[ 'alternative-mail' ] . "\"," 
     3644                                                                .",,,,,,,,,,,,,," 
     3645                                                                . "\"".$object[ 'web_page' ] . "\"," 
     3646                                                                .",,,,,,,,,,,," 
     3647                                                                . "\"".$object[ 'sex' ] . "\"\r\n";                                                              
     3648                            } 
    35703649                                break; 
    35713650 
     
    35833662 
    35843663                                        foreach($contacts as $index => $object){ 
    3585                                                 $streamBuffer.= ",".$object['names_ordered'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['connection_value'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     3664                                                $streamBuffer.= "\"".$object[ 'alias' ] . "\"," 
     3665                                                        . "\"".$object[ 'names_ordered'] . "\"," 
     3666                                                        .",,," 
     3667                                                        . "\"".$object[ 'corporate_name' ] . "\"," 
     3668                                                        . "\"".$object[ 'department' ] . "\"," 
     3669                                                        . "\"".$object[ 'job_title' ] . "\"," 
     3670                                                        . "\"".$object[ 'business-address' ] . "\"," 
     3671                                                        . "\"".$object[ 'business-address-2' ] . "\"," 
     3672                                                        ."," 
     3673                                                        . "\"".$object[ 'business-city_name' ] . "\"," 
     3674                                                        . "\"".$object[ 'business-state' ] . "\"," 
     3675                                                        . "\"".$object[ 'business-postal_code' ] . "\"," 
     3676                                                        . "\"".$object[ 'business-id_country' ] . "\"," 
     3677                                                        . "\"".$object[ 'home-address' ] . "\"," 
     3678                                                        . "\"".$object[ 'home-address-2' ] . "\"," 
     3679                                                        ."," 
     3680                                                        . "\"".$object[ 'home-city_name' ] . "\"," 
     3681                                                        . "\"".$object[ 'home-state_name' ] . "\"," 
     3682                                                        . "\"".$object[ 'home-postal_code' ] . "\"," 
     3683                                                        . "\"".$object[ 'home-id_country' ] . "\"," 
     3684                                                        .",,,,,,,," 
     3685                                                        . "\"".$object[ 'business-fax' ] . "\"," 
     3686                                                        . "\"".$object[ 'business-phone' ] . "\"," 
     3687                                                        . "\"".$object[ 'business-mobile' ] . "\"," 
     3688                                                        .",,," 
     3689                                                        . "\"".$object[ 'home-fax' ] . "\"," 
     3690                                                        . "\"".$object[ 'home-phone' ] . "\"," 
     3691                                                        .",," 
     3692                                                        . "\"".$object[ 'mobile' ] . "\"," 
     3693                                                        .",," 
     3694                                                        . "\"".$object[ 'business-pager' ] . "\"," 
     3695                                                        . "\"".$object[ 'home-pager' ] . "\"," 
     3696                                                        .",,,,,,,," 
     3697                                                        . "\"".$object[ 'birthdate' ] . "\"," 
     3698                                                        .",,," 
     3699                                                        . "\"".$object[ 'main-mail' ] . "\"," 
     3700                                                        .",," 
     3701                                                        . "\"".$object[ 'alternative-mail' ] . "\"," 
     3702                                                        .",,,,,,,,,,,,,,," 
     3703                                                        . "\"".str_replace("\r\n\x0a","\t",$object[ 'notes' ]) . "\"," 
     3704                                                        .",,,,,,,,,,,,," 
     3705                                                        . "\"".$object[ 'web_page' ] . "\"\r\n"; 
     3706 
    35863707                                        } 
    35873708                                break; 
    35883709 
    35893710                                case 'thunderbird': 
    3590                                         $streamBuffer = "\n"; 
     3711                                        $streamBuffer = "First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email," 
     3712                                                ."Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address," 
     3713                                                ."Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2," 
     3714                                                ."Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1," 
     3715                                                ."Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes,\n"; 
    35913716 
    35923717                                        foreach($contacts as $index => $object){ 
    3593                                                 $streamBuffer.= ",,".$object['names_ordered'].",,".$object['connection_value'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     3718                                                $array_birth = explode("-",$object[ 'birthdate' ]); 
     3719                                                $streamBuffer.= "\"".$object[ 'names_ordered'] . "\"," 
     3720                                                        .",," 
     3721                                                        . "\"".$object[ 'alias' ] . "\"," 
     3722                                                        . "\"".$object[ 'main-mail' ] . "\"," 
     3723                                                        . "\"".$object[ 'alternative-mail' ] . "\"," 
     3724                                                        ."," 
     3725                                                        . "\"".$object[ 'business-phone' ] . "\"," 
     3726                                                        . "\"".$object[ 'home-phone' ] . "\"," 
     3727                                                        . "\"".$object[ 'business-fax' ] . "\"," 
     3728                                                        . "\"".$object[ 'business-pager' ] . "\"," 
     3729                                                        . "\"".$object[ 'mobile' ] . "\"," 
     3730                                                        . "\"".$object[ 'home-address' ] . "\"," 
     3731                                                        . "\"".$object[ 'home-address-2' ] . "\"," 
     3732                                                        . "\"".$object[ 'home-city_name' ] . "\"," 
     3733                                                        . "\"".$object[ 'home-state_name' ] . "\"," 
     3734                                                        . "\"".$object[ 'home-postal_code' ] . "\"," 
     3735                                                        . "\"".$object[ 'home-id_country' ] . "\"," 
     3736                                                        . "\"".$object[ 'business-address' ] . "\"," 
     3737                                                        . "\"".$object[ 'business-address-2' ] . "\"," 
     3738                                                        . "\"".$object[ 'business-city_name' ] . "\"," 
     3739                                                        . "\"".$object[ 'business-state_name' ] . "\"," 
     3740                                                        . "\"".$object[ 'business-postal_code' ] . "\"," 
     3741                                                        . "\"".$object[ 'business-id_country' ] . "\"," 
     3742                                                        . "\"".$object[ 'job_title' ] . "\"," 
     3743                                                        . "\"".$object[ 'department' ] . "\"," 
     3744                                                        . "\"".$object[ 'corporate_name' ] . "\"," 
     3745                                                        . "\"".$object[ 'web_page' ] . "\"," 
     3746                                                        . "\"".$object[ 'web_page' ] . "\"," 
     3747                                                        . "\"".$array_birth[0] . "\"," 
     3748                                                        . "\"".$array_birth[1] . "\"," 
     3749                                                        . "\"".$array_birth[2] . "\"," 
     3750                                                        .",,,," 
     3751                                                        . "\"".str_replace("\r\n\x0a","\t",$object[ 'notes' ]) . "\",\r\n"; 
     3752 
    35943753                                        } 
    35953754                                break; 
    35963755 
    35973756                                case 'expresso': 
    3598                                         $streamBuffer = 'Nome,Apelido,E-mail Principal,E-mail Alternativo,Celular,' 
    3599                                                 . 'Telefone Comercial,Endereço Comercial,Complemento End. Comercial,CEP Comercial,Cidade End. Comercial,Estado End. Comercial,País End. Comercial,' 
    3600                                                 . 'Telefone Residencial,Endereço Residencial,Complemento End. Residencial,CEP Residencial,Cidade End. Residencial,Estado End. Residencial,País End. Residencial' 
    3601                                                 . "\r\n"; 
    3602  
    3603                                         foreach($contacts as $index => $object){ 
    3604                                                 $streamBuffer .= $object[ 'names_ordered'] . ',' 
    3605                                                         . $object[ 'alias' ] . ',' 
    3606                                                         . $object[ 'main-mail' ] . ',' 
    3607                                                         . $object[ 'alternative-mail' ] . ',' 
    3608                                                         . $object[ 'mobile' ] . ',' 
    3609                                                         . $object[ 'business-phone' ] . ',' 
    3610                                                         . $object[ 'business-address' ] . ',' 
    3611                                                         . $object[ 'business-complement' ] . ',' 
    3612                                                         . $object[ 'business-postal_code' ] . ',' 
    3613                                                         . $object[ 'business-city_name' ] . ',' 
    3614                                                         . $object[ 'business-state_name' ] . ',' 
    3615                                                         . $object[ 'business-id_country' ] . ',' 
    3616                                                         . $object[ 'home-phone' ] . ',' 
    3617                                                         . $object[ 'home-address' ] . ',' 
    3618                                                         . $object[ 'home-complement' ] . ',' 
    3619                                                         . $object[ 'home-postal_code' ] . ',' 
    3620                                                         . $object[ 'home-city_name' ] . ',' 
    3621                                                         . $object[ 'home-state_name' ] . ',' 
    3622                                                         . $object[ 'home-id_country' ] . "\r\n"; 
    3623                                         } 
    3624                                 break; 
     3757                            $streamBuffer = 'Nome,Apelido,E-mail Principal,E-mail Alternativo,Celular,' 
     3758                                . 'Telefone Comercial,Endereço Comercial,Complemento End. Comercial,CEP Comercial,Cidade End. Comercial,Estado End. Comercial,País End. Comercial,' 
     3759                                . 'Telefone Residencial,Endereço Residencial,Complemento End. Residencial,CEP Residencial,Cidade End. Residencial,Estado End. Residencial,País End. Residencial,' 
     3760                                . 'Aniversário,Sexo,Assinatura GPG,Notas,Página Web,Empresa,Cargo,Departamento,Fax Comercial,Pager Comercial,Celular Comercial,Fax,Pager,Endereço Comercial 2,Endereço Residencial 2' 
     3761                                                        . "\r\n"; 
     3762 
     3763                            foreach($contacts as $index => $object){ 
     3764                                $streamBuffer .= "\"".$object[ 'names_ordered'] . "\"," 
     3765                                    . "\"".$object[ 'alias' ] . "\"," 
     3766                                    . "\"".$object[ 'main-mail' ] . "\"," 
     3767                                    . "\"".$object[ 'alternative-mail' ] . "\"," 
     3768                                    . "\"".$object[ 'mobile' ] . "\"," 
     3769                                    . "\"".$object[ 'business-phone' ] . "\"," 
     3770                                    . "\"".$object[ 'business-address' ] . "\"," 
     3771                                    . "\"".$object[ 'business-complement' ] . "\"," 
     3772                                    . "\"".$object[ 'business-postal_code' ] . "\"," 
     3773                                    . "\"".$object[ 'business-city_name' ] . "\"," 
     3774                                    . "\"".$object[ 'business-state_name' ] . "\"," 
     3775                                    . "\"".$object[ 'business-id_country' ] . "\"," 
     3776                                    . "\"".$object[ 'home-phone' ] . "\"," 
     3777                                    . "\"".$object[ 'home-address' ] . "\"," 
     3778                                    . "\"".$object[ 'home-complement' ] . "\"," 
     3779                                    . "\"".$object[ 'home-postal_code' ] . "\"," 
     3780                                    . "\"".$object[ 'home-city_name' ] . "\"," 
     3781                                    . "\"".$object[ 'home-state_name' ] . "\"," 
     3782                                    . "\"".$object[ 'home-id_country' ] . "\"," 
     3783                                                                . "\"".$object[ 'birthdate' ] . "\"," 
     3784                                                                . "\"".$object[ 'sex' ] . "\"," 
     3785                                                                . "\"".$object[ 'pgp_key' ] . "\"," 
     3786                                                                . "\"".str_replace("\r\n\x0a","\t",$object[ 'notes' ]) . "\"," 
     3787                                                                . "\"".$object[ 'web_page' ] . "\"," 
     3788                                                                . "\"".$object[ 'corporate_name' ] . "\"," 
     3789                                                                . "\"".$object[ 'job_title' ] . "\"," 
     3790                                                                . "\"".$object[ 'department' ] . "\"," 
     3791                                                                . "\"".$object[ 'business-fax' ] . "\"," 
     3792                                                                . "\"".$object[ 'business-pager' ] . "\"," 
     3793                                                                . "\"".$object[ 'business-mobile' ] . "\"," 
     3794                                                                . "\"".$object[ 'home-fax' ] . "\"," 
     3795                                                                . "\"".$object[ 'home-pager' ] . "\"," 
     3796                                                                . "\"".$object[ 'business-address-2' ] . "\"," 
     3797                                                                . "\"".$object[ 'home-address-2' ] . "\"\r\n"; 
     3798                            } 
     3799                        break; 
    36253800 
    36263801                        } 
     
    37073882                                        $delim = ';'; 
    37083883 
    3709                         $boGroup = CreateObject('contactcenter.bo_group'); 
    3710                         $boPeople = CreateObject('contactcenter.bo_people_catalog'); 
    3711                                 switch($typeImport){ 
    3712                                         case 'outlook2000': 
    3713                                                 $name_pos=1; 
    3714                                                 $name2_pos=2; 
    3715                                                 $name3_pos=3; 
    3716                                                 $addr1_pos=8; 
    3717                                                 $cep_pos=13; 
    3718                                                 $addr2_pos=22; 
    3719                                                 $fax_pos=30; 
    3720                                                 $phone_pos=31; 
    3721                                                 $resPhone_pos=37; 
    3722                                                 $cellPhone_pos=40; 
    3723                                                 $pager_pos=43; 
    3724                                                 $birth_pos=48; 
    3725                                                 $notes_pos=49; 
    3726                                                 $email_pos=56; 
    3727                                                 $altEmail_pos=59; 
    3728  
    3729                                                 break; 
    3730                                         case 'outlook': 
    3731                                                 $name_pos=3; 
    3732                                                 $email_pos=4; 
    3733                                                 $phone_pos=7; 
    3734                                                 $resPhone_pos=10; 
    3735                                                 $cellPhone_pos=12; 
    3736                                                 $addr1_pos=13; 
    3737                                                 $cep_pos=15; 
    3738                                                 $phone_pos=18; 
    3739                                                 $fax_pos=19; 
    3740                                                 $pager_pos=20; 
    3741                                                 $notes_pos=25; 
    3742                                                 break; 
    3743                                         case 'thunderbird': 
    3744                                                 $name_pos=2; 
    3745                                                 $email_pos=4; 
    3746                                                 $phone_pos=7; 
    3747                                                 break; 
    3748                                         case 'expresso': 
    3749                                                 $name_pos=0; 
    3750                                                 $email_pos=1; 
    3751                                                 $phone_pos=2; 
    3752                                                 break; 
     3884                                $boGroup = CreateObject('contactcenter.bo_group'); 
     3885                                $boPeople = CreateObject('contactcenter.bo_people_catalog'); 
     3886                                        switch($typeImport){ 
     3887                                                case 'outlook2000': 
     3888                                                        $name_pos=1; 
     3889                                                        $name2_pos=2; 
     3890                                                        $name3_pos=3; 
     3891                                                        $corporate_street_pos=8; 
     3892                                                        $cep_pos=13; 
     3893                                                        $corporate_street_2_pos=22; 
     3894                                                        $fax_pos=30; 
     3895                                                        $phone_pos=31; 
     3896                                                        $home_phone_pos=37; 
     3897                                                        $personal_cell_pos=40; 
     3898                                                        $pager_pos=43; 
     3899                                                        $birth_pos=48; 
     3900                                                        $notes_pos=49; 
     3901                                                        $email_pos=56; 
     3902                                                        $aditionalEmail_pos=59; 
     3903 
     3904                                                        break; 
     3905                                                case 'outlook': 
     3906                                                        $name_pos=3; 
     3907                                                        $email_pos=4; 
     3908                                                        $phone_pos=7; 
     3909                                                        $home_phone_pos=10; 
     3910                                                        $personal_cell_pos=12; 
     3911                                                        $corporate_street_pos=13; 
     3912                                                        $cep_pos=15; 
     3913                                                        $phone_pos=18; 
     3914                                                        $fax_pos=19; 
     3915                                                        $pager_pos=20; 
     3916                                                        $notes_pos=25; 
     3917                                                        break; 
     3918                                                case 'thunderbird': 
     3919                                                        $name_pos=2; 
     3920                                                        $email_pos=4; 
     3921                                                        $phone_pos=7; 
     3922                                                        break; 
     3923                                                case 'expresso': 
     3924                                                        $name_pos=0; 
     3925                                                        $alias_pos=1; 
     3926                                                        $email_pos=2; 
     3927                                                        $aditionalEmail_pos=3; 
     3928                                                        $personal_cell_pos=4; 
     3929                                                        $corporate_phone_pos=5; 
     3930                                                        $corporate_street_pos=6; 
     3931                                                        $corporate_comp_pos=7; 
     3932                                                        $corporate_cep_pos=8; 
     3933                                                        $corporate_city_pos=9; 
     3934                                                        $corporate_state_pos=10; 
     3935                                                        $corporate_country_pos=11; 
     3936                                                        $home_phone_pos=12; 
     3937                                                        $street_pos=13; 
     3938                                                        $comp_pos=14; 
     3939                                                        $cep_pos=15; 
     3940                                                        $city_pos=16; 
     3941                                                        $state_pos=17; 
     3942                                                        $country_pos=18; 
     3943                                                        $birth_pos=19; 
     3944                                                        $sex_pos = 20; 
     3945                                                        $pgp_key_pos = 21; 
     3946                                                        $notes_pos=22; 
     3947                                                        $web_page_pos=23; 
     3948                                                        $corporate_name_pos=24; 
     3949                                                        $job_title_pos=25; 
     3950                                                        $department_pos=26; 
     3951                                                        $corporate_fax_pos=27; 
     3952                                                        $corporate_pager_pos=28; 
     3953                                                        $corporate_cell_pos=29; 
     3954                                                        $fax_pos=30; 
     3955                                                        $pager_pos=31; 
     3956                                                        $corporate_street_2_pos = 32; 
     3957                                                        $street_2_pos = 33;                                              
     3958                                                        break; 
    37533959                                        default: 
    3754                                                 foreach($csv_header as $index => $fieldName) 
    3755                                                 { 
    3756                                                         switch($fieldName){ 
    3757                                                         case 'Name': 
    3758                                                         case 'Nome': 
    3759                                                         case 'First Name': 
    3760                                                                 $name_pos = $index; 
    3761                                                                 break; 
    3762                                                         case 'Second name': 
    3763                                                         case 'Segundo nome': 
    3764                                                                 $name2_pos = $index; 
    3765                                                                 break; 
    3766                                                         case 'Sobrenome': 
    3767                                                         case 'Surname': 
    3768                                                                 $name3_pos = $index; 
    3769                                                                 break; 
    3770                                                         case 'Business Street': 
    3771                                                         case 'Rua do endereço comercial': 
    3772                                                                 $addr1_pos = $index; 
    3773                                                                 break; 
    3774                                                         case 'Rua do endereço comercial 2': 
    3775                                                         case 'Outro endereço': 
    3776                                                                 $addr2_pos = $index; 
    3777                                                                 break; 
    3778                                                         case 'Business Postal Code': 
    3779                                                         case 'CEP do endereço comercial': 
    3780                                                                 $cep_pos = $index; 
    3781                                                                 break; 
    3782                                                         case 'Business Fax': 
    3783                                                         case 'Fax comercial': 
    3784                                                         case 'Fax': 
    3785                                                                 $fax_pos = $index; 
    3786                                                                 break; 
    3787                                                         case 'Home Phone': 
    3788                                                         case 'Telefone residencial': 
    3789                                                                 $resPhone_pos = $index; 
    3790                                                                 break; 
    3791                                                         case 'Mobile phone': 
    3792                                                         case 'Telefone celular': 
    3793                                                                 $cellPhone_pos = $index; 
    3794                                                                 break; 
    3795                                                         case 'Pager': 
    3796                                                                 $pager_pos = $index; 
    3797                                                                 break; 
    3798                                                         case 'Phone': 
    3799                                                         case 'Business Phone': 
    3800                                                         case 'Telefone': 
    3801                                                         case 'Telefone principal': 
    3802                                                         case 'Telefone comercial': 
    3803                                                                 $phone_pos = $index; 
    3804                                                                 break; 
    3805                                                         case 'Aniversário': 
    3806                                                         case 'Birthdate': 
    3807                                                                 $birth_pos = $index; 
    3808                                                         case 'Anotações': 
    3809                                                         case 'Notes': 
    3810                                                                 $notes_pos = $index; 
    3811                                                         case 'E-mail': 
    3812                                                         case 'Email': 
    3813                                                         case 'E-mail Address': 
    3814                                                         case 'Endereï¿œo de correio eletrï¿œnico': 
    3815                                                         case 'End. de email': 
    3816                                                                 $email_pos = $index; 
    3817                                                                 break; 
    3818                                                         case 'Endereï¿œo de correio eletrï¿œnico 2': 
    3819                                                                 $altEmail_pos = $index; 
    3820                                                                 break; 
     3960                                                        foreach($csv_header as $index => $fieldName) 
     3961                                                        { 
     3962                                                                switch($fieldName){ 
     3963                                                                case 'Name': 
     3964                                                                case 'Nome': 
     3965                                                                case 'First Name': 
     3966                                                                        $name_pos = $index; 
     3967                                                                        break; 
     3968                                                                case 'Second name': 
     3969                                                                case 'Segundo nome': 
     3970                                                                        $name2_pos = $index; 
     3971                                                                        break; 
     3972                                                                case 'Sobrenome': 
     3973                                                                case 'Surname': 
     3974                                                                        $name3_pos = $index; 
     3975                                                                        break; 
     3976                                                                case 'Business Street': 
     3977                                                                case 'Rua do endereço comercial': 
     3978                                                                        $corporate_street_pos = $index; 
     3979                                                                        break; 
     3980                                                                case 'Rua do endereço comercial 2': 
     3981                                                                case 'Outro endereço': 
     3982                                                                        $corporate_street_2_pos = $index; 
     3983                                                                        break; 
     3984                                                                case 'Business Postal Code': 
     3985                                                                case 'CEP do endereço comercial': 
     3986                                                                        $cep_pos = $index; 
     3987                                                                        break; 
     3988                                                                case 'Business Fax': 
     3989                                                                case 'Fax comercial': 
     3990                                                                case 'Fax': 
     3991                                                                        $fax_pos = $index; 
     3992                                                                        break; 
     3993                                                                case 'Home Phone': 
     3994                                                                case 'Telefone residencial': 
     3995                                                                        $home_phone_pos = $index; 
     3996                                                                        break; 
     3997                                                                case 'Mobile phone': 
     3998                                                                case 'Telefone celular': 
     3999                                                                        $personal_cell_pos = $index; 
     4000                                                                        break; 
     4001                                                                case 'Pager': 
     4002                                                                        $pager_pos = $index; 
     4003                                                                        break; 
     4004                                                                case 'Phone': 
     4005                                                                case 'Business Phone': 
     4006                                                                case 'Telefone': 
     4007                                                                case 'Telefone principal': 
     4008                                                                case 'Telefone comercial': 
     4009                                                                        $phone_pos = $index; 
     4010                                                                        break; 
     4011                                                                case 'Aniversário': 
     4012                                                                case 'Birthdate': 
     4013                                                                        $birth_pos = $index; 
     4014                                                                case 'Anotações': 
     4015                                                                case 'Notes': 
     4016                                                                        $notes_pos = $index; 
     4017                                                                case 'E-mail': 
     4018                                                                case 'Email': 
     4019                                                                case 'E-mail Address': 
     4020                                                                case 'Endereço de correio eletrônico': 
     4021                                                                case 'End. de email': 
     4022                                                                        $email_pos = $index; 
     4023                                                                        break; 
     4024                                                                case 'Endereço de correio eletrônico 2': 
     4025                                                                        $aditionalEmail_pos = $index; 
     4026                                                                        break; 
     4027                                                                } 
    38214028                                                        } 
    3822                                                 } 
    3823                                                 break; 
     4029                                                        break; 
    38244030                                } 
    38254031 
    38264032                                while (($data = fgetcsv($handle, $len, $delim))) { 
    3827                                 foreach ($header as $key=>$heading) 
     4033                                        foreach ($header as $key=>$heading) 
    38284034                                $row[$heading]=(isset($data[$key])) ? $data[$key] : ''; 
    38294035 
    3830                                         $sdata = array(); 
    3831                                         $full_name      = trim($row[$header[$name_pos]]); 
    3832                                         $email          = trim($row[$header[$email_pos]]); 
    3833                                         $phone          = trim($row[$header[$phone_pos]]); 
    3834                                         $name2          = trim($row[$header[$name2_pos]]); 
    3835                                         $name3          = trim($row[$header[$name3_pos]]); 
    3836  
    3837                                         $addr1          = trim($row[$header[$addr1_pos]]); 
    3838                                         $addr2          = trim($row[$header[$addr2_pos]]); 
    3839                                         $cep            = trim($row[$header[$cep_pos]]); 
    3840                                         $fax            = trim($row[$header[$fax_pos]]); 
    3841                                         $resPhone       = trim($row[$header[$resPhone_pos]]); 
    3842                                         $cellPhone      = trim($row[$header[$cellPhone_pos]]); 
    3843                                         $pager          = trim($row[$header[$pager_pos]]); 
    3844                                         $birth          = trim($row[$header[$birth_pos]]); 
    3845                                         $notes          = trim($row[$header[$notes_pos]]); 
    3846                                         $altEmail       = trim($row[$header[$altEmail_pos]]); 
    3847  
    3848                                         $full_name = escapeshellcmd($full_name); 
     4036                                                $sdata = array(); 
     4037                                                $full_name  = trim($row[$header[$name_pos]]); 
     4038                                                $email          = trim($row[$header[$email_pos]]); 
     4039                                                $phone          = trim($row[$header[$phone_pos]]); 
     4040                                                $name2          = trim($row[$header[$name2_pos]]); 
     4041                                                $name3          = trim($row[$header[$name3_pos]]); 
     4042 
     4043                                                $birth          = trim($row[$header[$birth_pos]]); 
     4044                                                $notes          = trim($row[$header[$notes_pos]]); 
     4045                                                $altEmail       = trim($row[$header[$altEmail_pos]]); 
     4046                                                $sdata['alias']                         = trim($row[$header[$alias_pos]]); 
     4047                                                $sdata['corporate_name']      = trim($row[$header[$corporate_name_pos]]); 
     4048                                                $sdata['job_title']             = trim($row[$header[$job_title_pos]]); 
     4049                                                $sdata['department']            = trim($row[$header[$department_pos]]); 
     4050                                                $sdata['web_page']                      = trim($row[$header[$web_page_pos]]); 
     4051                                                 
     4052                                                $sdata['sex']                   = trim($row[$header[$sex_pos]]); 
     4053                                                $sdata['pgp_key']      = trim($row[$header[$pgp_key_pos]]); 
     4054 
     4055 
     4056                                        $full_name = $full_name; 
    38494057                                        $array_name = explode(' ', str_replace('"','',(str_replace('\'','',$full_name)))); 
    3850                                         $sdata['given_names'] = escapeshellcmd($array_name[0]); 
     4058                                        $sdata['given_names'] = $array_name[0]; 
    38514059                                        $array_name[0] = null; 
    38524060                                        $sdata['family_names'] = trim(implode(' ',$array_name)); 
    38534061                                        if($sdata['family_names'] == '') 
    38544062                                        { 
    3855                                                 $sdata['family_names'] = escapeshellcmd($name2) . " " . escapeshellcmd($name3); 
     4063                                                $sdata['family_names'] = $name2 . " " . $name3; 
    38564064                                        } 
    3857  
    3858                                         $sdata['connections']['default_email']['connection_name'] = lang('Main'); 
    3859                                         $sdata['connections']['default_email']['connection_value'] = escapeshellcmd($email); 
    3860  
    3861                                         $sdata['connections']['default_phone']['connection_name'] = lang('Main'); 
    3862                                         $sdata['connections']['default_phone']['connection_value'] = escapeshellcmd($phone); 
    3863  
    3864                                         $sdata['connections']['fax']['connection_name'] = lang('Fax'); 
    3865                                         $sdata['connections']['fax']['connection_value'] = escapeshellcmd($fax); 
    3866  
    3867                                         $sdata['connections']['residencial_phone']['connection_name'] = lang('Residencial'); 
    3868                                         $sdata['connections']['residencial_phone']['connection_value'] = escapeshellcmd($resPhone); 
    3869  
    3870                                         $sdata['connections']['cellular_phone']['connection_name'] = lang('Cellphone'); 
    3871                                         $sdata['connections']['cellular_phone']['connection_value'] = escapeshellcmd($cellPhone); 
    3872  
    3873                                         $sdata['connections']['pager']['connection_name'] = lang('Pager'); 
    3874                                         $sdata['connections']['pager']['connection_value'] = escapeshellcmd($pager); 
    3875  
    3876                                         $sdata['connections']['alternative_email']['connection_name'] = lang('Alternative'); 
    3877                                         $sdata['connections']['alternative_email']['connection_value'] = escapeshellcmd($altEmail); 
    3878  
    3879                                         $sdata['addresses']['addr1']['address_value'] = escapeshellcmd($addr1); 
    3880                                         $sdata['addresses']['addr2']['address_value'] = escapeshellcmd($addr2); 
    3881                                         $sdata['addresses']['cep']['address_value'] = escapeshellcmd($cep); 
     4065                                                $sdata['connections']['default_email']['connection_name'] = lang('Main'); 
     4066                                                $sdata['connections']['default_email']['connection_value'] = $email; 
     4067                                                $sdata['connections']['aditional_email']['connection_name'] = "Alternativo"; 
     4068                                                $sdata['connections']['aditional_email']['connection_value'] = trim($row[$header[$aditionalEmail_pos]]); 
     4069 
     4070                                                $sdata['connections']['default_phone']['connection_name'] = lang('Main'); 
     4071                                                $sdata['connections']['default_phone']['connection_value'] = $phone; 
     4072 
     4073                                                $sdata['connections']['aditional_phone']['cellphone']['connection_name'] = 'Celular'; 
     4074                                                $sdata['connections']['aditional_phone']['cellphone']['connection_value'] = trim($row[$header[$personal_cell_pos]]); 
     4075                                                 
     4076                                                $sdata['connections']['aditional_phone']['corporate_phone']['connection_name'] = 'Trabalho'; 
     4077                                                $sdata['connections']['aditional_phone']['corporate_phone']['connection_value'] = trim($row[$header[$corporate_phone_pos]]); 
     4078                                                 
     4079                                                $sdata['connections']['aditional_phone']['fax']['connection_name'] = 'Fax'; 
     4080                                                $sdata['connections']['aditional_phone']['fax']['connection_value'] = trim($row[$header[$fax_pos]]); 
     4081                                                 
     4082                                                $sdata['connections']['aditional_phone']['corporate_fax']['connection_name'] = 'Fax Corporativo'; 
     4083                                                $sdata['connections']['aditional_phone']['corporate_fax']['connection_value'] = trim($row[$header[$corporate_fax_pos]]); 
     4084                                                                                                 
     4085                                                $sdata['connections']['aditional_phone']['corporate_cell']['connection_name'] = 'Celular Corporativo'; 
     4086                                                $sdata['connections']['aditional_phone']['corporate_cell']['connection_value'] = trim($row[$header[$corporate_cell_pos]]); 
     4087                                                 
     4088                                                $sdata['connections']['aditional_phone']['corporate_pager']['connection_name'] = 'Pager Corporativo'; 
     4089                                                $sdata['connections']['aditional_phone']['corporate_pager']['connection_value'] = trim($row[$header[$corporate_pager_pos]]); 
     4090                                                                                                                                 
     4091                                                 
     4092                                                $sdata['connections']['aditional_phone']['home_phone']['connection_name'] = 'Casa'; 
     4093                                                $sdata['connections']['aditional_phone']['home_phone']['connection_value'] = trim($row[$header[$home_phone_pos]]); 
     4094                                                 
     4095                                                $sdata['connections']['aditional_phone']['pager']['connection_name'] = 'Pager'; 
     4096                                                $sdata['connections']['aditional_phone']['pager']['connection_value'] = trim($row[$header[$pager_pos]]); 
     4097 
     4098                                                $sdata['addresses']['address_corporative']['address1'] = trim($row[$header[$corporate_street_pos]]); 
     4099                                                $sdata['addresses']['address_corporative']['address2'] = trim($row[$header[$corporate_street_2_pos]]); 
     4100                                                $sdata['addresses']['address_corporative']['complement'] = trim($row[$header[$corporate_comp_pos]]); 
     4101                                                $sdata['addresses']['address_corporative']['postal_code'] = trim($row[$header[$corporate_cep_pos]]);                                             
     4102                                                $sdata['addresses']['address_corporative']['id_country'] = "BR"; 
     4103                                                $sdata['addresses']['address_corporative']['id_state'] = trim($row[$header[$corporate_state_pos]]);      
     4104                                                $sdata['addresses']['address_corporative']['id_city'] = trim($row[$header[$corporate_city_pos]]); 
     4105                                                 
     4106                                                                                                         
     4107                                                $sdata['addresses']['address_personal']['address1'] = trim($row[$header[$street_pos]]); 
     4108                                                $sdata['addresses']['address_personal']['address2'] = trim($row[$header[$street_2_pos]]); 
     4109                                                $sdata['addresses']['address_personal']['complement'] = trim($row[$header[$comp_pos]]); 
     4110                                                $sdata['addresses']['address_personal']['postal_code'] = trim($row[$header[$cep_pos]]); 
     4111                                                $sdata['addresses']['address_personal']['id_country'] = "BR";                                                    
     4112                                                $sdata['addresses']['address_personal']['id_state'] = trim($row[$header[$state_pos]]);   
     4113                                                $sdata['addresses']['address_personal']['id_city'] =  trim($row[$header[$city_pos]]); 
    38824114 
    38834115                                        $array_birth = explode("/",$birth); 
    38844116 
    3885                                         $sdata['birthdate'] = escapeshellcmd(date('Y-m-d', mktime(0,0,0,$array_birth[1],$array_birth[0],$array_birth[2]))); 
    3886  
    3887                                         $sdata['notes'] = escapeshellcmd($notes); 
    3888                                         $sdata['is_quick_add'] = true; 
     4117                                        $sdata['birthdate'] = date('Y-m-d', mktime(0,0,0,$array_birth[1],$array_birth[0],$array_birth[2])); 
     4118 
     4119                                        $sdata['notes'] = $notes; 
     4120                                        //$sdata['is_quick_add'] = true; 
    38894121                                        $sdata['connections']['default_phone']['connection_value'] = $phone; 
    38904122 
    38914123                                        //      verifica se email já existe! 
    3892                                         $email = escapeshellcmd($email); 
     4124                                        $email = $email; 
    38934125                                        $contact = $boGroup->verify_contact($email); 
    38944126 
    38954127                                        if(!$sdata['given_names'] && $email){ 
    38964128                                                        $a_email = explode("@",$email); 
    3897                                                         $sdata['given_names'] = escapeshellcmd($a_email[0]); 
     4129                                                        $sdata['given_names'] = $a_email[0]; 
    38984130                                        } 
    38994131 
Note: See TracChangeset for help on using the changeset viewer.