Changeset 3215
- Timestamp:
- 09/06/10 16:19:03 (14 years ago)
- Location:
- branches/2.2/contactcenter/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/contactcenter/inc/class.so_group.inc.php
r1280 r3215 110 110 function selectAllContacts( $field = false ,$shared_from=null) 111 111 { 112 if($shared_from==null) { 113 $query = 'select C.id_connection, A.id_contact, A.names_ordered, C.connection_value , B.id_typeof_contact_connection from phpgw_cc_contact A,'. 114 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 115 'A.id_contact = B.id_contact and B.id_connection = C.id_connection and '. 116 'A.id_owner ='.$this->owner.' and C.connection_is_default = true '; 112 if ( $shared_from == NULL ) 113 { 114 $query = "select" 115 . " phpgw_cc_connections.id_connection," 116 . " phpgw_cc_contact.id_contact," 117 . " phpgw_cc_contact.names_ordered," 118 . " phpgw_cc_contact.alias," 119 . " phpgw_cc_connections.connection_value ," 120 . " phpgw_cc_contact_conns.id_typeof_contact_connection," 121 . " phpgw_cc_addresses.address1," 122 . " phpgw_cc_addresses.complement," 123 . " phpgw_cc_addresses.postal_code," 124 . " phpgw_cc_city.city_name," 125 . " phpgw_cc_state.state_name," 126 . " phpgw_cc_addresses.id_country"; 127 128 $query .= " from" 129 . " phpgw_cc_contact" 130 . " inner join phpgw_cc_contact_conns on ( phpgw_cc_contact.id_contact = phpgw_cc_contact_conns.id_contact )" 131 . " inner join phpgw_cc_connections on ( phpgw_cc_contact_conns.id_connection = phpgw_cc_connections.id_connection )" 132 . " left join phpgw_cc_contact_addrs on ( phpgw_cc_contact.id_contact = phpgw_cc_contact_addrs.id_contact )" 133 . " left join phpgw_cc_addresses on ( phpgw_cc_contact_addrs.id_address = phpgw_cc_addresses.id_address )" 134 . " left join phpgw_cc_city on ( phpgw_cc_addresses.id_city = phpgw_cc_city.id_city )" 135 . " left join phpgw_cc_state on ( phpgw_cc_addresses.id_state = phpgw_cc_state.id_state)"; 136 137 $query .= " where" 138 . " phpgw_cc_contact.id_owner = {$this->owner}" 139 . " and phpgw_cc_connections.connection_is_default = true"; 140 117 141 } 118 142 else { … … 121 145 B.acl_appname = \'contactcenter\' and B.acl_rights & 1 <> 0 122 146 and A.id_typeof_contact_relation=1 and A.id_contact = '.$shared_from.' and A.id_related='.$this->owner; 123 147 124 148 $query = 'select C.id_connection, A.id_contact, A.names_ordered, C.connection_value , B.id_typeof_contact_connection from phpgw_cc_contact A,'. 125 149 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. … … 130 154 131 155 if ( $field == 'only_email' ) 132 $query .= 'and B.id_typeof_contact_connection = 1 '; 133 134 $query .= ' order by A.names_ordered,C.connection_value'; 135 136 137 if (!$this->db->query($query)) 138 { 139 exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 140 } 141 156 $query .= 'and phpgw_cc_contact_conns.id_typeof_contact_connection = 1 '; 157 158 $query .= ' order by phpgw_cc_contact.names_ordered, phpgw_cc_connections.connection_value'; 159 160 if (!$this->db->query($query)) 161 { 162 exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 163 } 164 142 165 $return = array(); 143 166 144 167 while($this->db->next_record()) 145 168 { 146 169 $return[] = $this->db->row(); 147 170 } 148 149 if(!count($return)) 150 return $return; 151 // Essa iteração transforma uma esturuta com contatos redundantes e separados por email ou tel. 152 // em outra com apenas 1 elemento pra cada contato 153 foreach($return as $i => $object){ 154 if ($object['id_typeof_contact_connection'] == 1){ 155 $all_contacts[$object['id_contact']]['connection_value'] = $object['connection_value']; 156 $all_contacts[$object['id_contact']]['names_ordered'] = $object['names_ordered']; 157 $all_contacts[$object['id_contact']]['id_contact'] = $object['id_contact']; 158 $all_contacts[$object['id_contact']]['id_connection'] = $object['id_connection']; 171 172 if( ! count( $return ) ) 173 return $return; 174 175 foreach( $return as $i => $object ) 176 { 177 switch( $object[ 'id_typeof_contact_connection' ] ) 178 { 179 case 1 : 180 $all_contacts[ $object[ 'id_contact' ] ][ 'connection_value' ] = $object[ 'connection_value' ]; 181 break; 182 case 2 : 183 $all_contacts[ $object[ 'id_contact' ] ][ 'phone' ] = $object[ 'connection_value' ]; 184 break; 159 185 } 160 else 161 if ($object['id_typeof_contact_connection'] == 2){ 162 $all_contacts[$object['id_contact']]['phone'] = $object['connection_value']; 163 $all_contacts[$object['id_contact']]['names_ordered'] = $object['names_ordered']; 164 $all_contacts[$object['id_contact']]['id_contact'] = $object['id_contact']; 165 $all_contacts[$object['id_contact']]['id_connection'] = $object['id_connection']; 166 } 167 } 168 186 187 $all_contacts[ $object[ 'id_contact' ] ][ 'names_ordered' ] = $object[ 'names_ordered' ]; 188 $all_contacts[ $object[ 'id_contact' ] ][ 'id_contact' ] = $object[ 'id_contact' ]; 189 $all_contacts[ $object[ 'id_contact' ] ][ 'id_connection' ] = $object[ 'id_connection' ]; 190 $all_contacts[ $object[ 'id_contact' ] ][ 'alias' ] = $object[ 'alias' ]; 191 $all_contacts[ $object[ 'id_contact' ] ][ 'address1' ] = $object[ 'address1' ]; 192 $all_contacts[ $object[ 'id_contact' ] ][ 'complement' ] = $object[ 'complement' ]; 193 $all_contacts[ $object[ 'id_contact' ] ][ 'postal_code' ] = $object[ 'postal_code' ]; 194 $all_contacts[ $object[ 'id_contact' ] ][ 'city_name' ] = $object[ 'city_name' ]; 195 $all_contacts[ $object[ 'id_contact' ] ][ 'state_name' ] = $object[ 'state_name' ]; 196 $all_contacts[ $object[ 'id_contact' ] ][ 'id_country' ] = $object[ 'id_country' ]; 197 } 198 169 199 return array_values($all_contacts); 170 } 171 200 } 201 172 202 function verifyContact($email) 173 203 { -
branches/2.2/contactcenter/inc/class.ui_data.inc.php
r3211 r3215 3404 3404 echo null; 3405 3405 3406 /**rev 104**/3407 // Essa iteraᅵᅵo transforma uma esturuta com contatos redundantes e separados por email ou tel.3408 // em outra com apenas 1 elemento pra cada contato3409 /* $i=0;3410 foreach($contacts as $object){3411 $i=($object['id_contact'] - 1);3412 $all_contacts[$i]['name']=$object['names_ordered'];3413 if ($object['id_typeof_contact_connection'] == 1)3414 $all_contacts[$i]['email']=$object['connection_value'];3415 else3416 $all_contacts[$i]['phone']=$object['connection_value'];3417 }3418 */3419 /*****/3420 3421 3406 switch($typeExport) { 3422 3407 3423 3408 case 'outlook_en': 3424 3409 $streamBuffer = "Name;E-mail Address;Notes;Mobile Phone;Pager;Company;". 3425 /**rev 104**/ 3426 /* "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 3427 foreach($all_contacts as $index => $object){ 3428 $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;\r\n"; 3429 } 3430 */ 3431 "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 3410 "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 3411 3432 3412 foreach($contacts as $index => $object){ 3433 3413 $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;\r\n"; 3434 3414 } 3435 /*****/ 3436 break; 3415 break; 3437 3416 3438 3417 case 'outlook_pt-BR': … … 3443 3422 "CEP do endereï¿œo comercial;Estado do endereï¿œo comercial;". 3444 3423 "Paï¿œs/regiï¿œo do endereï¿œo comercial;Telefone comercial;Empresa;Cargo\r\n"; 3445 /**rev 104**/ 3446 // foreach($all_contacts as $index => $object){ 3447 // $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 3424 3448 3425 foreach($contacts as $index => $object){ 3449 3426 $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 3450 /******/3451 3427 } 3452 3428 break; … … 3472 3448 "\"Sexo\"\r\n"; 3473 3449 3474 /**rev 104**/3475 //foreach($all_contacts as $index => $object){3476 // $streamBuffer.= ",\"".$object['name']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['email']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n";3477 3450 foreach($contacts as $index => $object){ 3478 3451 $streamBuffer.= ",\"".$object['names_ordered']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['connection_value']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3479 /******/3480 3452 } 3481 3453 break; … … 3493 3465 "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"; 3494 3466 3495 /**rev 104**/3496 //foreach($all_contacts as $index => $object){3497 // $streamBuffer.= ",".$object['name'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['email'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n";3498 3467 foreach($contacts as $index => $object){ 3499 3468 $streamBuffer.= ",".$object['names_ordered'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['connection_value'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3500 /*******/3501 3469 } 3502 3470 break; … … 3505 3473 $streamBuffer = "\n"; 3506 3474 3507 /**rev 104**/3508 //foreach($all_contacts as $index => $object){3509 // $streamBuffer.= ",,".$object['name'].",,".$object['email'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n";3510 3475 foreach($contacts as $index => $object){ 3511 3476 $streamBuffer.= ",,".$object['names_ordered'].",,".$object['connection_value'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3512 3513 /******/3514 3477 } 3515 3478 break; 3516 3479 3517 3480 case 'expresso': 3518 $streamBuffer = "Nome,Email,Telefone\r\n"; 3519 3520 /**rev 104**/ 3521 //foreach($all_contacts as $index => $object){ 3522 // $streamBuffer.= $object['name'].",".$object['email'].",".$object['phone']."\r\n"; 3481 $streamBuffer = "Nome,Apelido,Email,Telefone,Endereço,Complemento,CEP,Cidade,Estado,País\r\n"; 3482 3523 3483 foreach($contacts as $index => $object){ 3524 $streamBuffer.= $object['names_ordered'].",".$object['connection_value'].",".$object['phone']."\r\n"; 3525 3526 /******/ 3484 $streamBuffer .= $object[ 'names_ordered'] . "," 3485 . $object[ 'alias' ] . "," 3486 . $object[ 'connection_value' ] . "," 3487 . $object[ 'phone' ] . "," 3488 . $object[ 'address1' ] . "," 3489 . $object[ 'complement' ] . "," 3490 . $object[ 'postal_code' ] . "," 3491 . $object[ 'city_name' ] . "," 3492 . $object[ 'state_name' ] . "," 3493 . $object[ 'id_country' ] . "\r\n"; 3527 3494 } 3528 3495 break;
Note: See TracChangeset
for help on using the changeset viewer.