Changeset 63 for trunk/expressoAdmin1_2/js
- Timestamp:
- 08/29/07 08:55:50 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/js/jscode/users.js
r62 r63 41 41 return; 42 42 } 43 43 44 // Corporative Information 45 if (document.forms[0].corporative_information_employeenumber.value != "") 46 { 47 var re_employeenumber = /^([0-9])+$/; 48 49 if(!re_employeenumber.test(document.forms[0].corporative_information_employeenumber.value)) 50 { 51 alert('Campo matrícula contém caracteres não permitidos. Somente números são permitidos.'); 52 document.forms[0].corporative_information_employeenumber.focus(); 53 return; 54 } 55 } 56 57 if (document.forms[0].corporative_information_cpf.value != "") 58 { 59 var re_cpf = /^([0-9])+$/; 60 61 if(!re_cpf.test(document.forms[0].corporative_information_cpf.value)) 62 { 63 alert('Campo cpf contém caracteres não permitidos. Somente números são permitidos'); 64 document.forms[0].corporative_information_employeenumber.focus(); 65 return; 66 } 67 68 if (! validarCPF(document.forms[0].corporative_information_cpf.value) ) 69 { 70 alert("Campo CPF invalido."); 71 document.forms[0].corporative_information_cpf.focus(); 72 return; 73 } 74 } 75 44 76 //MAIL 45 77 document.forms[0].mail.value = document.forms[0].mail.value.toLowerCase(); … … 606 638 } 607 639 } 640 641 function empty_inbox(uid) 642 { 643 var action = "Limpado INBOX do usuario"; 644 var handler_write_log = function(){} 645 var handler_empty_inbox = function(data) 646 { 647 if (!data.status) 648 alert(data.msg); 649 else{ 650 cExecute ('$this.user.write_log_from_ajax&_action='+action+'&userinfo='+uid, handler_write_log); 651 alert("Esvaziados '" + data.inbox_size + "' MB da caixa postal do usuário"); 652 document.getElementById('mailquota_used').value = data.mailquota_used; 653 } 654 } 655 cExecute ('$this.imap_functions.empty_inbox&uid='+uid, handler_empty_inbox); 656 } 657 658 function validarCPF(cpf) 659 { 660 if(cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" || 661 cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || 662 cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || 663 cpf == "88888888888" || cpf == "99999999999"){ 664 return false; 665 } 666 667 soma = 0; 668 for(i = 0; i < 9; i++) 669 soma += parseInt(cpf.charAt(i)) * (10 - i); 670 resto = 11 - (soma % 11); 671 if(resto == 10 || resto == 11) 672 resto = 0; 673 if(resto != parseInt(cpf.charAt(9))) 674 { 675 return false; 676 } 677 678 soma = 0; 679 for(i = 0; i < 10; i ++) 680 soma += parseInt(cpf.charAt(i)) * (11 - i); 681 resto = 11 - (soma % 11); 682 if(resto == 10 || resto == 11) 683 resto = 0; 684 if(resto != parseInt(cpf.charAt(10))){ 685 return false; 686 } 687 return true; 688 }
Note: See TracChangeset
for help on using the changeset viewer.