Changeset 4477


Ignore:
Timestamp:
05/20/11 17:03:00 (13 years ago)
Author:
airton
Message:

Ticket #1912 - Permitir a criação de contatos sem email

Location:
sandbox/2.2.0.2/contactcenter
Files:
8 edited

Legend:

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

    r3826 r4477  
    524524                        { 
    525525                                $connection = CreateObject('contactcenter.so_connection', $id); 
    526  
    527                                 if ($extra === 'default' and $connection->is_default()) 
    528                                 { 
    529                                         $connection_type = CreateObject('contactcenter.so_contact_connection_type', $type); 
    530                                         $return['connection'.$count]['id_connection'] = $id; 
    531                                         $return['connection'.$count]['id_type'] = $type; 
    532                                         $return['connection'.$count]['type'] = $connection_type->get_type_name();  
    533                                         $return['connection'.$count]['connection_name'] = $connection->get_name(); 
    534                                         $return['connection'.$count]['connection_value'] = $connection->get_value(); 
    535                                         $return['connection'.$count]['connection_is_default'] = $connection->is_default(); 
    536                                         $count++; 
    537                                 } 
    538                                 else if ($extra !== 'default') 
    539                                 { 
    540                                         $connection_type = CreateObject('contactcenter.so_contact_connection_type', $type); 
    541                                         $return['connection'.$count]['id_connection'] = $id; 
    542                                         $return['connection'.$count]['id_type'] = $type; 
    543                                         $return['connection'.$count]['type'] = $connection_type->get_type_name();  
    544                                         $return['connection'.$count]['connection_name'] = $connection->get_name(); 
    545                                         $return['connection'.$count]['connection_value'] = $connection->get_value(); 
    546                                         $return['connection'.$count]['connection_is_default'] = $connection->is_default(); 
    547                                         $count++; 
     526                                if ($getDummy || $connection->get_name() !== 'no_conns') 
     527                                { 
     528                                        if ($extra === 'default' and $connection->is_default()) 
     529                                        { 
     530                                                $connection_type = CreateObject('contactcenter.so_contact_connection_type', $type); 
     531                                                $return['connection'.$count]['id_connection'] = $id; 
     532                                                $return['connection'.$count]['id_type'] = $type; 
     533                                                $return['connection'.$count]['type'] = $connection_type->get_type_name(); 
     534                                                $return['connection'.$count]['connection_name'] = $connection->get_name(); 
     535                                                $return['connection'.$count]['connection_value'] = $connection->get_value(); 
     536                                                $return['connection'.$count]['connection_is_default'] = $connection->is_default(); 
     537                                                $count++; 
     538                                        } 
     539                                        else if ($extra !== 'default') 
     540                                        { 
     541                                                $connection_type = CreateObject('contactcenter.so_contact_connection_type', $type); 
     542                                                $return['connection'.$count]['id_connection'] = $id; 
     543                                                $return['connection'.$count]['id_type'] = $type; 
     544                                                $return['connection'.$count]['type'] = $connection_type->get_type_name(); 
     545                                                $return['connection'.$count]['connection_name'] = $connection->get_name(); 
     546                                                $return['connection'.$count]['connection_value'] = $connection->get_value(); 
     547                                                $return['connection'.$count]['connection_is_default'] = $connection->is_default(); 
     548                                                $count++; 
     549                                        } 
    548550                                } 
    549551                        } 
     
    902904                        $permissions = $this->security->get_permissions(); 
    903905                         
     906                        $exist_connections = false; 
     907                         
    904908                        if (!$permissions['create']) 
    905909                        { 
     
    913917                        foreach($data as $field => $value) 
    914918                        { 
    915                                 if ($value === false) 
     919                                if ($value === false && $field != 'connections') 
    916920                                { 
    917921                                        continue; 
     
    10011005                                                foreach($value as $connection_name => $connection_fields) 
    10021006                                                { 
     1007                                                        $exist_connections = true; 
    10031008                                                        $connection = CreateObject('contactcenter.so_connection'); 
    10041009                                                        $connection->reset_values(); 
     
    10261031                        { 
    10271032                                $contact->set_field('id_owner',$GLOBALS['phpgw_info']['user']['account_id']); 
     1033                                //insert a dummy connection if the contact dont have an email and telephone 
     1034                                if (!$exist_connections)  
     1035                                { 
     1036                                        $this->add_dummy($contact); 
     1037                                } 
    10281038                                return $contact->commit(); 
    10291039                        } 
     
    15191529                                         
    15201530                                        case 'connections': 
     1531                                                //alteracao para permitir a exibicao de contatos sem email ou telefone 
     1532                                                $all_removed = true; 
     1533                                                $added_connection = false; 
    15211534                                                foreach($value as $connection_name => $connection_fields) 
    15221535                                                { 
     
    15371550                                                        } 
    15381551                                                         
     1552                                                        $all_removed = false; 
     1553                                                        // removes the dummy if there is at least one connection 
     1554                                                        if (!$added_connection) 
     1555                                                        { 
     1556                                                                $this->remove_dummy($contact); //remove the dummy 
     1557                                                        } 
     1558                                                        $added_connection = true; 
    15391559                                                        $id_connection = $connection_fields['id_connection']; 
    15401560                                                        if ($id_connection === '_NEW_' or 
     
    15641584                                                        $contact->set_connection($id_connection, $connection_fields['id_typeof_connection']); 
    15651585                                                } 
     1586                                                // add the dummy if there is no other connection 
     1587                                                if ($all_removed) 
     1588                                                        $this->add_dummy($contact); 
    15661589                                                break; 
    15671590                                                 
     
    15831606         
    15841607                /*! 
     1608                        @function remove_dummy 
     1609                        @abstract Remove the dummy connection entry. 
     1610                        @author Luiz Carlos Viana Melo - Prognus 
     1611                 */ 
     1612                function remove_dummy($so_contact) 
     1613                { 
     1614                        //$so_contact = CreateObject('contactcenter.so_contact', $id_contact); 
     1615                        $connections = $so_contact->get_connections(); 
     1616                        foreach ($connections as $id_connection => $type_connection) 
     1617                        { 
     1618                                $so_connection = CreateObject('contactcenter.so_connection', $id_connection); 
     1619                                if ($so_connection->get_field('connection_name') === 'no_conns') //if connection is the dummy one 
     1620                                { 
     1621                                        if (!$so_connection->remove()) 
     1622                                        { 
     1623                                                return false; 
     1624                                        } 
     1625                                        $so_contact->remove_connection($id_connection); 
     1626                                        //$so_connection->commit(); 
     1627                                        break; 
     1628                                } 
     1629                        } 
     1630                 
     1631                } 
     1632                 
     1633                /*! 
     1634                        @function add_dummy 
     1635                        @abstract Add a dummy connection entry on a contact. This is necessary for 
     1636                                possibility on adding a contact that dont have an email or telephone. 
     1637                        @return The dummy's connection ID. 
     1638                        @author Luiz Carlos Viana Melo - Prognus 
     1639                 */ 
     1640                function add_dummy($so_contact) 
     1641                { 
     1642                        $so_connection = CreateObject('contactcenter.so_connection'); 
     1643                        $so_connection->reset_values(); 
     1644                         
     1645                        $so_connection->set_field('connection_name', 'no_conns'); //defined code for the dummy connection 
     1646                        $so_connection->set_field('connection_value', ''); 
     1647                        $so_connection->set_field('connection_is_default', true); 
     1648                         
     1649                        if (!$so_connection->commit()) 
     1650                        { 
     1651                                return false; 
     1652                        } 
     1653                        $id_connection = $so_connection->get_id(); 
     1654                        $so_contact->set_connection($id_connection, 2); 
     1655                        return $id_connection; 
     1656                } 
     1657                                         
     1658                /*! 
    15851659                 
    15861660                        @function update_prefix 
  • sandbox/2.2.0.2/contactcenter/inc/class.so_group.inc.php

    r4470 r4477  
    376376                        'phpgw_cc_contact_conns B, phpgw_cc_connections C,phpgw_cc_contact_grps D where '. 
    377377                        'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 
    378                         'and B.id_typeof_contact_connection = 1 and '. 
     378                        'and '. 
    379379                        //'A.id_owner ='.$this->owner.' and'. 
    380380                        ' D.id_connection = C.id_connection and D.id_group = '.$idGroup. 
  • sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php

    r4289 r4477  
    16821682                         
    16831683                        $boGroup = CreateObject('contactcenter.bo_group'); 
    1684  
    1685                         $all_contacts = $boGroup->get_all_contacts('only_email',$shared_from); 
     1684                         
     1685                        $all_contacts = $boGroup->get_all_contacts(false,$shared_from); 
     1686                         
    16861687                         
    16871688                        $contact_options = ""; 
    16881689                        if(count($all_contacts)) {                                       
    16891690                                foreach($all_contacts as $idx => $contact) {                             
    1690                                         $contact_options .= "<OPTION value='".$contact['id_connection']."'>".$contact['names_ordered']." (".$contact['connection_value'].")</OPTION>"; 
     1691                                        $contact_options .= "<OPTION value='".$contact['id_connection']."'>".$contact['names_ordered']; 
     1692                                        if (isset($contact['connection_value'])) 
     1693                                                $contact_options .= " (".$contact['connection_value'].")</OPTION>"; 
     1694                                        else 
     1695                                                $contact_options .= " (". $contact['phone'].")</OPTION>"; 
    16911696                                } 
    16921697                        } 
     
    19871992                        $data['contact_in_list'] = $new_tdata[1]; 
    19881993                        $data['id_group'] = $new_tdata[2]; 
     1994                         
     1995                        $contactWOemail = false;  
     1996                                  
     1997                        foreach ($data['contact_in_list'] as $id_connection)  
     1998                        {  
     1999                                $boConn = CreateObject('contactcenter.bo_connection');  
     2000                                $type = $boConn->get_connection_type_by_conn_id($id_connection);  
     2001                                if ($type != 1)  
     2002                                {  
     2003                                        $contactWOemail = true;  
     2004                                        break;  
     2005                                }  
     2006                        } 
     2007 
     2008 
    19892009                        $acumulatedErrors = ''; 
    19902010 
     
    20382058                        { 
    20392059                                $this->page_info['changed'] = true; 
    2040  
     2060                                 
     2061                                if (!$contactWOemail) 
     2062                                        echo serialize(array( 
     2063                                                'msg'    => lang('Entry added with success!'), 
     2064                                                'status' => 'ok' 
     2065                                                )); 
     2066                                else 
     2067                                        echo serialize(array( 
     2068                                                'msg'    => lang('Entry added with success. But some contacts will not receive or send messages.'), 
     2069                                                'status' => 'warning' 
     2070                                                )); 
     2071                        } 
     2072                        else 
     2073                        { 
    20412074                                echo serialize(array( 
    2042                                         'msg'    => lang('Entry added with success!'), 
    2043                                         'status' => 'ok' 
    2044                                 )); 
    2045                         } 
    2046                         else 
    2047                         { 
    2048                                 echo serialize(array( 
    2049                                         'msg'    => lang('Problems on adding your Contact. No Contact added!'). 
    2050                                             "\n".$acumulatedErrors, 
     2075                                        'msg'    => lang('Problems on adding your Contact. No Contact added!'), 
    20512076                                        'status' => 'error' 
    20522077                                )); 
  • sandbox/2.2.0.2/contactcenter/js/ccAddGroup.js

    r4470 r4477  
    124124                        //showMessage(data['msg']); 
    125125 
    126                         if (data['status'] != 'ok') 
     126                        if (data['status'] != 'ok' && data['status'] != 'warning') 
    127127                        { 
    128                                 showMessage(data['msg']); 
    129128                                return; 
    130129                        } 
     130                         
     131                        if(data['status'] == 'warning') 
     132                                showMessage(data['msg']); 
    131133 
    132134                        _this.clear(); 
  • sandbox/2.2.0.2/contactcenter/setup/phpgw_es-es.lang

    r3665 r4477  
    7777Empty   contactcenter   es-es   Vacío 
    7878Entry added with success!       contactcenter   es-es   ¡Contacto añadido con suceso! 
     79Entry added with success. But some contacts will not receive or send messages.  contactcenter   es-es   Entrada añadido con éxito. Pero algunos contactos no recibir ni enviar mensajes. 
    7980Export as Expresso (default) CSV.       contactcenter   es-es   Exportar como Expresso (standar) CSV 
    8081Export as Mozilla Thunderbird CSV.      contactcenter   es-es   Exportar como Mozilla Thunderbird CSV. 
Note: See TracChangeset for help on using the changeset viewer.