Changeset 4754


Ignore:
Timestamp:
07/14/11 17:14:49 (13 years ago)
Author:
roberto.santosjunior
Message:

Ticket #1820 - Incluir Contato Compartilhado duplicado. r4599

Location:
trunk/contactcenter/inc
Files:
3 edited

Legend:

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

    r4510 r4754  
    4545                 
    4646                        $result = $this-> so -> verifyContact($email, $name, $phone); 
     47                        return $result; 
     48                } 
     49 
     50                function verify_shared_contact($owner,$email){ 
     51 
     52                        $result = $this-> so -> verifySharedContact($owner,$email); 
    4753                        return $result; 
    4854                } 
  • trunk/contactcenter/inc/class.so_group.inc.php

    r4510 r4754  
    492492                        return $return; 
    493493                }                
    494                  
     494 
     495                function verifySharedContact($owner,$email) 
     496                { 
     497                        $query = 'select A.names_ordered, C.id_connection from phpgw_cc_contact A,'. 
     498                        'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 
     499                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
     500                        'and B.id_typeof_contact_connection = 1 and '. 
     501                        'A.id_owner ='.$owner.' and C.connection_value = \''.$email.'\''; 
     502 
     503                        if (!$this->db->query($query)) 
     504                        { 
     505                                exit ('Query failed! File: '.__FILE__.' on line'.__LINE__); 
     506                        } 
     507 
     508                        $return = false; 
     509 
     510                        while($this->db->next_record()) 
     511                        { 
     512                                $row = $this->db->row(); 
     513                                $return[] =  $row['names_ordered']; 
     514                                $return[] =  $row['id_connection']; 
     515                        } 
     516 
     517                        return $return; 
     518                } 
     519 
    495520                function selectContactsByGroup($idGroup) 
    496521                { 
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r4753 r4754  
    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                                { 
     
    27002746                                        case 'connections': 
    27012747                                                /* Does nothing... */ 
     2748                                                $aaaa = 1111; 
    27022749                                                break; 
    27032750 
Note: See TracChangeset for help on using the changeset viewer.