Changeset 1664


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

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

Location:
trunk/contactcenter/js
Files:
2 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 
  • trunk/contactcenter/js/ccQuickAdd-plugin.js

    r1612 r1664  
    193193 
    194194                //Utiliza expressão regular para validar email 
    195                 var reEmail = /^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/; 
    196  
    197                 if(!reEmail.test(this._fields[4].value)){ 
    198                         alert("O endereço de email '" + this._fields[4].value + "' não é válido!\n" + 
    199                         "Por favor informe um endereço válido."); 
     195                if (this._fields[4].value != '') { 
     196                        var reEmail = /^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/; 
     197                         
     198                        if (!reEmail.test(this._fields[4].value)) { 
     199                                alert("O endereço de email '" + this._fields[4].value + "' não é válido!\n" + 
     200                                "Por favor informe um endereço válido."); 
     201                                return false; 
     202                        } 
     203                } 
     204                else if(this._fields[3].value=='') { 
     205                        alert("Você precisa informar ou o e-mail ou o telefone"); 
    200206                        return false; 
    201207                } 
    202                                                  
    203208                var sdata = 'add='+escape(serialize(sdata)); 
    204209 
Note: See TracChangeset for help on using the changeset viewer.