- Timestamp:
- 10/10/08 17:20:50 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.db_functions.inc.php
r502 r525 29 29 { 30 30 $result = array(); 31 $stringDropDownContacts = ''; 32 // Pesquisa no CC os nomes e email dos contatos. 33 $query = 'select A.names_ordered, C.connection_value from phpgw_cc_contact A, 34 phpgw_cc_contact_conns B, phpgw_cc_connections C where 35 A.id_contact = B.id_contact and B.id_connection = C.id_connection 36 and B.id_typeof_contact_connection = 1 and 37 (A.id_owner ='.$this -> user_id.' or 38 A.id_owner in ( 39 select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1 40 ) 41 ) 42 group by A.names_ordered,C.connection_value 43 order by A.names_ordered'; 31 $stringDropDownContacts = ''; 32 // Traz primeiro os usuarios que compartilharam com o usuario logado: 33 $query = 'select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1'; 34 // Somente do usuario logado 35 $query_related = 'A.id_owner ='.$this -> user_id; 36 if (!$this->db->query($query)) 37 return null; 38 while($this->db->next_record()){ 39 $row = $this->db->row(); 40 $result[] = $row['id_related']; 41 } 42 $ids_related = implode(",",$result); 43 44 // Se houver contatos compartilhados então altera a query. 45 if($ids_related) 46 $query_related = '(A.id_owner ='.$this -> user_id.' or A.id_owner in ('.$ids_related.'))'; 47 48 // Traz os contatos pessoais e compartilhados 49 $query = 'select A.names_ordered, C.connection_value from phpgw_cc_contact A, '. 50 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 51 'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 52 'and B.id_typeof_contact_connection = 1 and '.$query_related.' group by '. 53 'A.names_ordered,C.connection_value order by A.names_ordered'; 54 44 55 if (!$this->db->query($query)) 45 56 return null; 46 47 48 57 while($this->db->next_record()) 49 58 $result[] = $this->db->row();
Note: See TracChangeset
for help on using the changeset viewer.