Ignore:
Timestamp:
11/17/09 16:55:28 (14 years ago)
Author:
eduardoalex
Message:

Ticket #761 - Adicao de um criterio padrao nos dois formularios

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/contactcenter/js/cc.js

    r1655 r1664  
    754754 
    755755        var comp = /^[a-zA-Z\d(-)\.@_ -]{0,200}$/; 
    756         if (CC_contact_full_info['connections']){ 
    757                 for (var type in CC_contact_full_info['connections']){ 
    758                         for (var i in CC_contact_full_info['connections'][type]){ 
    759                                 if((CC_contact_full_info['connections'][type][i]['value'].length < 4) || 
    760                                         (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 
    761                                         showMessage('Endereço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido'); 
    762                                         return false; 
    763                                 } 
    764                         } 
    765                         var _options_default = Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default"); 
    766                         if(_options_default.value == '-1') { 
    767                                 alert("É necessário escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrão!"); 
    768                                 return false; 
    769                         } 
    770                 } 
    771  
    772         } 
    773  
    774         /* Check Relations */ 
    775  
    776         return true; 
     756    haveConnections = false; 
     757    if (CC_contact_full_info['connections']){        
     758        for (var type in CC_contact_full_info['connections']){ 
     759            haveConnections = true; 
     760            for (var i in CC_contact_full_info['connections'][type]){ 
     761                if((CC_contact_full_info['connections'][type][i]['value'].length < 4) || 
     762                    (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 
     763                    showMessage('Endereço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido'); 
     764                    return false; 
     765                } 
     766            } 
     767            var _options_default = Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default"); 
     768            if(_options_default.value == '-1') { 
     769                alert("É necessário escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrão!"); 
     770                return false; 
     771            } 
     772        } 
     773    } 
     774    if(!haveConnections){ 
     775        showMessage('É nescessário informar o nome ou telefone!'); 
     776        return false; 
     777    } 
     778 
     779    /* Check Relations */ 
     780 
     781    return true; 
     782 
    777783} 
    778784 
Note: See TracChangeset for help on using the changeset viewer.