Changeset 4599


Ignore:
Timestamp:
06/11/11 16:42:10 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #2006 - Incluir Contato Compartilhado duplicado

Location:
branches/2.2.0.1/contactcenter/inc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.0.1/contactcenter/inc/class.bo_group.inc.php

    r1280 r4599  
    4747                        return $result; 
    4848                } 
     49 
     50                function verify_shared_contact($owner,$email){ 
     51 
     52                        $result = $this-> so -> verifySharedContact($owner,$email); 
     53                        return $result; 
     54                } 
    4955                 
    5056                function get_contacts_by_group($id){ 
  • branches/2.2.0.1/contactcenter/inc/class.so_group.inc.php

    r4444 r4599  
    370370                        return $return; 
    371371                }                
    372                  
     372 
     373                function verifySharedContact($owner,$email) 
     374                { 
     375                        $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'. 
     376                        'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
     377                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
     378                        'and B.id_typeof_contact_connection = 1 and '. 
     379                        'A.id_owner ='.$owner.' and C.connection_value = \''.$email.'\''; 
     380 
     381                        if (!$this->db->query($query)) 
     382                        { 
     383                                exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
     384                        } 
     385 
     386                        $return = false; 
     387 
     388                        while($this->db->next_record()) 
     389                        { 
     390                                $row = $this->db->row(); 
     391                                $return[] =  $row['names_ordered']; 
     392                                $return[] =  $row['id_connection']; 
     393                        } 
     394 
     395                        return $return; 
     396                } 
     397 
    373398                function selectContactsByGroup($idGroup) 
    374399                { 
  • branches/2.2.0.1/contactcenter/inc/class.ui_data.inc.php

    r4598 r4599  
    22892289                        foreach($data as $field => $value) 
    22902290                        { 
     2291                                $dataConn = $data['connections']; 
     2292                                $aa = count($dataConn); 
     2293 
     2294                                for($i = 0; $i < $aa; $i++ ) 
     2295                                { 
     2296                                    if($dataConn['connection'.$i]['connection_is_default'] == "TRUE") 
     2297                                    { 
     2298                                        $email = $dataConn['connection'.$i]['connection_value']; 
     2299                                    } 
     2300                                } 
     2301                                // verifica se email já existe! 
     2302                                $boGroup = CreateObject('contactcenter.bo_group'); 
     2303                                $contact = $boGroup->verify_contact($email); 
     2304                                if($contact) 
     2305                                { 
     2306                                    $str_contact = "\r\n - ".implode("\r\n - ",$contact); 
     2307                                    echo serialize(array( 
     2308                                    'msg'    => lang('Problems on adding your Contact. The email "%1" already exists in: %2',$tdata[4], $str_contact), 
     2309                                    'status' => 'alreadyExists' 
     2310                                    )); 
     2311                                    return; 
     2312                                } 
    22912313 
    22922314                                switch($field) 
     
    25782600                        foreach($data as $field => &$value) 
    25792601                        { 
     2602 
     2603                                $dataConn = $data['connections']; 
     2604                                $aa = count($dataConn); 
     2605 
     2606                                for($i = 0; $i < $aa; $i++ ) 
     2607                                { 
     2608                                    if($dataConn['connection'.$i]['connection_is_default'] == "TRUE") 
     2609                                    { 
     2610                                        $email = $dataConn['connection'.$i]['connection_value']; 
     2611                                    } 
     2612                                } 
     2613                                // verifica se email já existe! 
     2614                                $boGroup = CreateObject('contactcenter.bo_group'); 
     2615                                $contact = $boGroup->verify_shared_contact($owner,$email); 
     2616                                if($contact) 
     2617                                { 
     2618                                    $str_contact = "\r\n - ".implode("\r\n - ",$contact); 
     2619                                    echo serialize(array( 
     2620                                    'msg'    => lang('Problems on adding your Contact. The email "%1" already exists in: %2',$tdata[4], $str_contact), 
     2621                                    'status' => 'alreadyExists' 
     2622                                    )); 
     2623                                    return; 
     2624                                } 
     2625 
    25802626                                if ($value == '' or is_null($value)) 
    25812627                                { 
     
    26962742                                        case 'connections': 
    26972743                                                /* Does nothing... */ 
     2744                                                $aaaa = 1111; 
    26982745                                                break; 
    26992746 
Note: See TracChangeset for help on using the changeset viewer.