Changeset 293


Ignore:
Timestamp:
06/03/08 17:58:40 (16 years ago)
Author:
niltonneto
Message:

Bug de exportação de contato com telefones

Location:
trunk/contactcenter/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/contactcenter/inc/class.so_group.inc.php

    r285 r293  
    116116                        'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
    117117                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection and '. 
    118                         'C.connection_is_default = true and B.id_typeof_contact_connection = 1 and '. 
    119                         'A.id_owner ='.$this->owner.' order by A.names_ordered,C.connection_value'; 
     118                        'A.id_owner ='.$this->owner.' and C.connection_is_default = true '. 
     119                        ' order by A.names_ordered,C.connection_value'; 
    120120 
    121121                                         
     
    131131                                $return[] = $this->db->row();  
    132132                        } 
    133                          
    134                         return $return; 
     133                                 
     134                        // Essa iteração transforma uma esturuta com contatos redundantes e separados por email ou tel. 
     135                        // em outra com apenas 1 elemento pra cada contato 
     136                        foreach($return as $i => $object){ 
     137                                if ($object['id_typeof_contact_connection'] == 1){ 
     138                                        $all_contacts[$object['id_contact']]['connection_value'] = $object['connection_value']; 
     139                    $all_contacts[$object['id_contact']]['names_ordered'] = $object['names_ordered']; 
     140                    $all_contacts[$object['id_contact']]['id_contact'] = $object['id_contact']; 
     141                    $all_contacts[$object['id_contact']]['id_connection'] = $object['id_connection']; 
     142                                } 
     143                                else  
     144                                        if ($object['id_typeof_contact_connection'] == 2){ 
     145                                                $all_contacts[$object['id_contact']]['phone'] = $object['connection_value']; 
     146                                                $all_contacts[$object['id_contact']]['names_ordered'] = $object['names_ordered']; 
     147                                                $all_contacts[$object['id_contact']]['id_contact'] = $object['id_contact']; 
     148                                                $all_contacts[$object['id_contact']]['id_connection'] = $object['id_connection']; 
     149                                        } 
     150                        } 
     151                         
     152                        return array_values($all_contacts); 
    135153                }                
    136154                 
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r285 r293  
    27422742                        if(!count($contacts)) 
    27432743                                echo null; 
    2744  
    2745  
    2746                         // Essa iteração transforma uma esturuta com contatos redundantes e separados por email ou tel. 
    2747                         // em outra com apenas 1 elemento pra cada contato 
    2748                         $i=0; 
    2749                         foreach($contacts as $object){ 
    2750                                 $i=($object['id_contact'] - 1); 
    2751                                 $all_contacts[$i]['name']=$object['names_ordered']; 
    2752                                 if ($object['id_typeof_contact_connection'] == 1) 
    2753                                         $all_contacts[$i]['email']=$object['connection_value']; 
    2754                                 else 
    2755                                         $all_contacts[$i]['phone']=$object['connection_value']; 
    2756                         } 
    27572744                         
    27582745                        switch($typeExport) { 
     
    27612748                                        $streamBuffer = "Name;E-mail Address;Notes;Mobile Phone;Pager;Company;". 
    27622749                                                        "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n";                                                         
    2763                                         foreach($all_contacts as $index => $object){ 
    2764                                                 $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;\r\n"; 
     2750                                        foreach($contacts as $index => $object){ 
     2751                                                $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;\r\n"; 
    27652752                                        } 
    27662753                                break; 
     
    27732760                                        "CEP do endereço comercial;Estado do endereço comercial;". 
    27742761                                        "País/região do endereço comercial;Telefone comercial;Empresa;Cargo\r\n";                                                        
    2775                                         foreach($all_contacts as $index => $object){ 
    2776                                                 $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 
     2762                                        foreach($contacts as $index => $object){ 
     2763                                                $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 
    27772764                                        } 
    27782765                                break; 
     
    27972784                                        "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissão\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretório\",". 
    27982785                                        "\"Sexo\"\r\n"; 
    2799                                         foreach($all_contacts as $index => $object){ 
    2800                                                 $streamBuffer.= ",\"".$object['name']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['email']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     2786                                        foreach($contacts as $index => $object){ 
     2787                                                $streamBuffer.= ",\"".$object['names_ordered']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['connection_value']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    28012788                                        } 
    28022789                                break; 
     
    28132800                                        "Gender,Government ID Number,Hobby,Initials,Internet Free Busy,Keywords,Language,Location,Manager's Name,Mileage,Notes,". 
    28142801                                        "Office Location,Organizational ID Number,PO Box,Priority,Private,Profession,Referred By,Sensitivity,Spouse,User 1,User 2,User 3,User 4,Web Page\r\n"; 
    2815                                         foreach($all_contacts as $index => $object){ 
    2816                                                 $streamBuffer.= ",".$object['name'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['email'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     2802                                        foreach($contacts as $index => $object){ 
     2803                                                $streamBuffer.= ",".$object['names_ordered'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['connection_value'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    28172804                                        } 
    28182805                                break; 
     
    28202807                                case 'thunderbird': 
    28212808                                        $streamBuffer = "\n";                                                    
    2822                                         foreach($all_contacts as $index => $object){ 
    2823                                                 $streamBuffer.= ",,".$object['name'].",,".$object['email'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
     2809                                        foreach($contacts as $index => $object){ 
     2810                                                $streamBuffer.= ",,".$object['names_ordered'].",,".$object['connection_value'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 
    28242811                                        } 
    28252812                                break; 
     
    28272814                                case 'expresso': 
    28282815                                        $streamBuffer = "Nome,Email,Telefone\r\n"; 
    2829                                         foreach($all_contacts as $index => $object){ 
    2830                                                 $streamBuffer.= $object['name'].",".$object['email'].",".$object['phone']."\r\n"; 
     2816                                        foreach($contacts as $index => $object){ 
     2817                                                $streamBuffer.= $object['names_ordered'].",".$object['connection_value'].",".$object['phone']."\r\n"; 
    28312818                                        } 
    28322819                                break; 
Note: See TracChangeset for help on using the changeset viewer.