Ignore:
Timestamp:
05/24/11 17:58:15 (13 years ago)
Author:
airton
Message:

Ticket #1925 - Permitir associar um contato com um grupo na tela de criação do contato

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/contactcenter/inc/class.so_group.inc.php

    r4477 r4498  
    104104                        return True;             
    105105                }                
     106                 
     107                /*! 
     108                 * @function select_owner_groups 
     109                 * @abstract Busca todos os grupos do usuário atual. 
     110                 * @author Luiz Carlos Viana Melo - Prognus 
     111                 * @param (integer) $id_owner O ID do usuário. 
     112                 * @return Retorna uma estrutura contendo: 
     113                 * array( 
     114                 *              array( 
     115                 *                      id_group => O ID do grupo; 
     116                 *                      title => O nome do grupo; 
     117                 *                      short_name => O nome abreviado do grupo. 
     118                 *              ) 
     119                 * ) 
     120                 */ 
     121                function select_owner_groups($id_owner = false) 
     122                { 
     123                        $query = 'SELECT id_group, title, short_name FROM phpgw_cc_groups '; 
     124                        if ($id_owner) 
     125                                $query .= 'WHERE owner = ' . $id_owner. ' ORDER BY title;'; 
     126                        else 
     127                                $query .= 'WHERE owner = ' . $this->owner . ' ORDER BY title;'; 
     128                                 
     129                        if (!$this->db->query($query)) 
     130                        { 
     131                                exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
     132                        } 
     133                         
     134                        $return = false; 
     135                         
     136                        while($this->db->next_record()) 
     137                        { 
     138                                $return[] = $this->db->row();  
     139                        } 
     140                         
     141                        return $return; 
     142                } 
     143                 
     144                /*! 
     145                 * @function select_contact_groups 
     146                 * @abstract Seleciona os grupos do contato. 
     147                 * @author Luiz Carlos Viana Melo - Prognus 
     148                 * @param (integer) $id_contact O ID do contato. 
     149                 * @return Retorna uma estrutura contendo: 
     150                 * array( 
     151                 *              array( 
     152                 *                      id_contact => O ID do contato; 
     153                 *                      id_group => O ID do grupo; 
     154                 *                      title => O nome do grupo; 
     155                 *                      short_name => O nome abreviado do grupo. 
     156                 *              ) 
     157                 * ) 
     158                 */ 
     159                function select_contact_groups($id_contact) 
     160                { 
     161                        $query = 'SELECT Contato.id_contact, ContatoGprs.id_connection, Grupos.id_group, Grupos.title, ' . 
     162                                'Grupos.short_name FROM phpgw_cc_contact_conns Contato, ' .  
     163                                'phpgw_cc_connections Conexao, phpgw_cc_contact_grps ContatoGprs, ' .  
     164                                'phpgw_cc_groups Grupos WHERE Contato.id_contact = ' . $id_contact .  
     165                                ' AND Contato.id_connection = Conexao.id_connection AND ' .  
     166                                'Conexao.id_connection = ContatoGprs.id_connection AND ' .  
     167                                'ContatoGprs.id_group = Grupos.id_group ORDER BY title'; 
     168                         
     169                        if (!$this->db->query($query)) 
     170                        { 
     171                                exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
     172                        } 
     173                         
     174                        $return = false; 
     175                         
     176                        while($this->db->next_record()) 
     177                        { 
     178                                $return[] = $this->db->row();  
     179                        } 
     180                         
     181                        return $return; 
     182                } 
    106183                 
    107184                function deleteContactFromGroups($id) 
     
    402479                        "phpgw_cc_contact_conns B, phpgw_cc_connections C,phpgw_cc_contact_grps D,phpgw_cc_groups E where ". 
    403480                        "A.id_contact = B.id_contact and B.id_connection = C.id_connection ". 
    404                         "and B.id_typeof_contact_connection = 1 and ". 
     481                        " and ". 
    405482                        "A.id_owner =".$this->owner." and ".                     
    406483                        "D.id_group = E.id_group and ". 
     
    445522                        'phpgw_cc_contact_conns B, phpgw_cc_connections C,phpgw_cc_contact_grps D where '. 
    446523                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    447                         'and B.id_typeof_contact_connection = 1 and '. 
     524                        ' and '. 
    448525                        //'A.id_owner ='.$this->owner.' and D.id_connection = C.id_connection and D.id_group = '.$id_group. 
    449526                        ' D.id_connection = C.id_connection and D.id_group = '.$id_group. //If I have the group ID, why ask about owner? 
Note: See TracChangeset for help on using the changeset viewer.