Ignore:
Timestamp:
11/03/11 11:17:35 (12 years ago)
Author:
wmerlotto
Message:

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo contactcenter.

File:
1 edited

Legend:

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

    r4754 r5131  
    9393                } 
    9494                 
     95                function touchContacts( $pContacts ) 
     96                { 
     97                    
     98                    $qSelect =  'SELECT A.id_contact from phpgw_cc_contact A,'. 
     99                                'phpgw_cc_contact_conns B WHERE '. 
     100                                'A.id_contact = B.id_contact and B.id_connection in('.implode( ',' , $pContacts ).')'; 
     101                     
     102                     
     103                    $qUpdate = 'UPDATE phpgw_cc_contact '. 
     104                               'SET last_status = \'U\', last_update = \''.time().'000\' '. 
     105                               'WHERE id_contact IN( '.$qSelect.' )';    
     106                     
     107                      if (!$this->db->query($qUpdate)) 
     108                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
     109                } 
     110                 
     111                function touchContactsByGroup ( $pIdGroup ) 
     112                { 
     113                    $qSelect = 'SELECT A.id_contact from phpgw_cc_contact A,'. 
     114                        'phpgw_cc_contact_conns B, phpgw_cc_connections C,phpgw_cc_contact_grps D where '. 
     115                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
     116                        ' and '. 
     117                        ' D.id_connection = C.id_connection and D.id_group = '.$pIdGroup; 
     118 
     119                     
     120                    $qUpdate = 'UPDATE phpgw_cc_contact '. 
     121                             'SET last_status = \'U\', last_update = \''.time().'000\' '. 
     122                             'WHERE id_contact IN( '.$qSelect.' )';    
     123    
     124 
     125                    if (!$this->db->query($qUpdate)) 
     126                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
     127                         
     128                     
     129                } 
     130                 
    95131                function delete($data) 
    96132                { 
     
    423459                } 
    424460 
    425                 function verifyContact($email, $name, $phone) 
    426                 { 
    427                         if ($email) { 
    428                          
    429                                 $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'. 
    430                                 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
    431                                 'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    432                                 'and B.id_typeof_contact_connection = 1 and '. 
    433                                 "A.id_owner ='" .$this->owner."' and C.connection_value = '".$email. "'"; 
    434  
    435                                 if (!$this->db->query($query)) 
    436                                 {        
    437                                         exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
    438                                 } 
    439                           
    440                                 $return = false; 
    441                          
    442                                 while($this->db->next_record()) 
    443                                 { 
    444                                         $row = $this->db->row(); 
    445                                         $return[] =  $row['names_ordered'];  
    446                                 } 
    447                         }  
    448                          
    449                         if (!$return && $phone) {  
    450  
    451                                 $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'. 
    452                                 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
    453                                 'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    454                                 'and B.id_typeof_contact_connection = 2 and '. 
    455                                 "A.id_owner ='" .$this->owner."' and C.connection_value = '".$phone. "'"; 
    456  
    457                                 if (!$this->db->query($query)) 
    458                                 {        
    459                                         exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
    460                                 } 
    461                           
    462                                 $return = false; 
    463                          
    464                                 while($this->db->next_record()) 
    465                                 { 
    466                                         $row = $this->db->row(); 
    467                                         $return[] =  $row['names_ordered'];  
    468                                 } 
    469  
    470                         } 
    471                          
    472                         if (!$return && $name) {  
    473  
    474                                 $query = "select names_ordered, C.id_connection from phpgw_cc_contact where id_owner = '" . $this->owner . "' and RTRIM(names_ordered) = '". $name. "'"; 
    475  
    476                                 if (!$this->db->query($query)) 
    477                                 {        
    478                                         exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
    479                                 } 
    480                           
    481                                 $return = false; 
    482                          
    483                                 while($this->db->next_record()) 
    484                                 { 
    485                                         $row = $this->db->row(); 
    486                                         $return[] =  $row['names_ordered'];  
    487                                 } 
    488  
    489                         } 
    490                     $return[] =  $row['id_connection']; 
    491  
    492                         return $return; 
    493                 }                
    494  
    495461                function verifySharedContact($owner,$email) 
    496462                { 
     
    588554                function updateContactsByGroup($id_group, $contacts) 
    589555                { 
    590                                                  
     556                        //Atualiza timestamp de status dos contatos afetados 
     557                        $this -> touchContacts($contacts); 
     558                        $this -> touchContactsByGroup($id_group); 
     559                        ///---------------------------------------------------// 
    591560                        $query = 'select C.id_connection from phpgw_cc_contact A,'. 
    592561                        'phpgw_cc_contact_conns B, phpgw_cc_connections C,phpgw_cc_contact_grps D where '. 
     
    724693                } 
    725694                 
     695                 
     696                function verifyContact($email, $name, $phone)  
     697                                {  
     698                                                                if($email && $phone && $name){ 
     699                                                                 
     700                                                                        $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'.  
     701                                                'phpgw_cc_contact_conns B, phpgw_cc_connections C where '.  
     702                                                'A.id_contact = B.id_contact and B.id_connection = C.id_connection '.  
     703                                                'and B.id_typeof_contact_connection = 1 and '.  
     704                                                "A.id_owner ='" .$this->owner."' and (C.connection_value = '".$email. "' or C.connection_value = '".$phone. "') and RTRIM(A.names_ordered) = '". $name. "'";  
     705                                                                 
     706                                                                        if (!$this->db->query($query))  
     707                                                {         
     708                                                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__);  
     709                                                }  
     710                                           
     711                                                $return = false;  
     712                                          
     713                                                while($this->db->next_record())  
     714                                                {  
     715                                                        $row = $this->db->row();  
     716                                                        $return[] =  $row['names_ordered'];   
     717                                                }  
     718                                                                } 
     719                                        if (!$return && $email) {  
     720                                          
     721                                                $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'.  
     722                                                'phpgw_cc_contact_conns B, phpgw_cc_connections C where '.  
     723                                                'A.id_contact = B.id_contact and B.id_connection = C.id_connection '.  
     724                                                'and B.id_typeof_contact_connection = 1 and '.  
     725                                                "A.id_owner ='" .$this->owner."' and C.connection_value = '".$email. "' and RTRIM(A.names_ordered) = '". $name. "'";  
     726                  
     727                                                if (!$this->db->query($query))  
     728                                                {         
     729                                                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__);  
     730                                                }  
     731                                           
     732                                                $return = false;  
     733                                          
     734                                                while($this->db->next_record())  
     735                                                {  
     736                                                        $row = $this->db->row();  
     737                                                        $return[] =  $row['names_ordered'];   
     738                                                }  
     739                                        }                       
     740                                        if (!$return && $phone) {   
     741                  
     742                                                                                $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'.  
     743                                                'phpgw_cc_contact_conns B, phpgw_cc_connections C where '.  
     744                                                'A.id_contact = B.id_contact and B.id_connection = C.id_connection '.  
     745                                                'and B.id_typeof_contact_connection = 2 and '.  
     746                                                "A.id_owner ='" .$this->owner."' and C.connection_value = '".$phone. "' and RTRIM(A.names_ordered) = '". $name. "'";  
     747                  
     748                                                if (!$this->db->query($query))  
     749                                                {         
     750                                                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__);  
     751                                                }  
     752                                           
     753                                                $return = false;  
     754                                          
     755                                                while($this->db->next_record())  
     756                                                {  
     757                                                        $row = $this->db->row();  
     758                                                        $return[] =  $row['names_ordered'];   
     759                                                }  
     760                  
     761                                        }  
     762 
     763                                        if (!$return && $name) {   
     764                  
     765                                                $query = " 
     766                                                                                select A.names_ordered, C.id_connection  
     767                                                                                 
     768                                                                                from phpgw_cc_contact A,  
     769                                                                                        phpgw_cc_contact_conns B,  
     770                                                                                        phpgw_cc_connections C 
     771                                                                                where A.id_contact = B.id_contact and B.id_connection = C.id_connection and 
     772                                                                                B.id_typeof_contact_connection = 2 and 
     773                                                                                A.id_owner = '" . $this->owner . "' and RTRIM(A.names_ordered) = '". $name. "'";  
     774                  
     775                                                if (!$this->db->query($query))  
     776                                                {         
     777                                                        exit ('Query failed! File: '.__FILE__.' on line'.__LINE__);  
     778                                                }  
     779                                           
     780                                                $return = false;  
     781                                          
     782                                                while($this->db->next_record())  
     783                                                {  
     784                                                        $row = $this->db->row();  
     785                                                        $return[] =  $row['names_ordered'];   
     786                                                }  
     787                  
     788                                        }  
     789                                    $return[] =  $row['id_connection'];  
     790 
     791                                        return $return;  
     792                                }  
     793                 
     794                 
    726795        } 
    727796?> 
Note: See TracChangeset for help on using the changeset viewer.