fixed bug #7903 - validação email empresa e punto venta
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@66128 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
a659335b01
commit
681d0708d7
|
@ -9,6 +9,8 @@ import java.util.Calendar;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -167,6 +169,12 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
private Checkbox chkIndocd;
|
||||
private Textbox txtEmail;
|
||||
|
||||
private static final String EMAIL_PATTERN =
|
||||
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
|
||||
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
|
||||
|
||||
private static final Pattern pattern = Pattern.compile(EMAIL_PATTERN, Pattern.CASE_INSENSITIVE);
|
||||
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
}
|
||||
|
@ -383,6 +391,15 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
chkIndcarboletosdevolvidosconf.getValue();
|
||||
chkIndBoletoAgrupado.getValue();
|
||||
chkIndgennumfoliovtaintimpost.getValue();
|
||||
|
||||
|
||||
if (!validarEmail()) {
|
||||
Messagebox.show(Labels.getLabel("editarTipoPuntoVentaController.MSG.emailInvalido"),
|
||||
Labels.getLabel("editarEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
txtEmail.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
Comboitem cbiCidade = cmbCidade.getSelectedItem();
|
||||
if (cbiCidade != null) {
|
||||
|
@ -421,7 +438,20 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
Labels.getLabel("editarEmpresaController.window.title"), Messagebox.OK, Messagebox.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean validarEmail() {
|
||||
if(txtEmail.getText() == null){
|
||||
return true;
|
||||
}
|
||||
for(String email : txtEmail.getText().split(";")){
|
||||
Matcher matcher = pattern.matcher(email);
|
||||
if(!matcher.matches()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void carregarComEmpConferencia() {
|
||||
getComEmpConferencia().setIndbilhetemanual(chkIndbilhetemanual.isChecked());
|
||||
getComEmpConferencia().setIndbilhetevendido(chkIndbilhetevendido.isChecked());
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
|
@ -383,7 +385,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private Checkbox checkDom;
|
||||
private Row rowDateFechamento;
|
||||
private String logFileSelected;
|
||||
private Textbox descCorreo;
|
||||
|
||||
private static final String EMAIL_PATTERN =
|
||||
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
|
||||
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
|
||||
|
||||
private static final Pattern pattern = Pattern.compile(EMAIL_PATTERN, Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private static final int TAMANHO_BUFFER = 4096; // 4kb
|
||||
|
||||
PtovtaEmpresa ptovtaEmpresa;
|
||||
|
@ -1320,6 +1329,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
cmbBanco.getValue();
|
||||
cmbPessoa.getValue();
|
||||
cmbTipoConta.getValue();
|
||||
|
||||
if(!validarEmail()){
|
||||
Messagebox.show(Labels.getLabel("editarTipoPuntoVentaController.MSG.emailInvalido"),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
descCorreo.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!txtTitularNome.getValue().isEmpty()
|
||||
|| !txtTitularNome.getValue().isEmpty()
|
||||
|
@ -1560,6 +1577,19 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean validarEmail() {
|
||||
if(descCorreo.getText() == null){
|
||||
return true;
|
||||
}
|
||||
for(String email : descCorreo.getText().split(";")){
|
||||
Matcher matcher = pattern.matcher(email);
|
||||
if(!matcher.matches()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void gravaFechamentoCtaCorrente() {
|
||||
List<FechamentoParamptovta> paramsFechamento = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
|
||||
gravarCC(paramsFechamento);
|
||||
|
|
|
@ -691,6 +691,7 @@ editarTipoPuntoVentaController.lbNome.value = Canal de venta
|
|||
editarTipoPuntoVentaController.MSG.suscribirOK = Canal de venta se registró exitosamente
|
||||
editarTipoPuntoVentaController.MSG.borrarPergunta = Desea eliminar o canal de venta?
|
||||
editarTipoPuntoVentaController.MSG.borrarOK = Canal de venta se eliminó exitosamente
|
||||
editarTipoPuntoVentaController.MSG.emailInvalido = Email em formato inválido. Favor Verificar.
|
||||
lbEquivalencia.value = Equivalencia
|
||||
|
||||
# Muestra o formulario de Búsqueda Restricción de Pago
|
||||
|
|
|
@ -733,6 +733,7 @@ editarTipoPuntoVentaController.lbNome.value = Canal de Venda
|
|||
editarTipoPuntoVentaController.MSG.suscribirOK = Canal de Venda Registrado com Sucesso.
|
||||
editarTipoPuntoVentaController.MSG.borrarPergunta = Deseja Eliminar o canal de Venda?
|
||||
editarTipoPuntoVentaController.MSG.borrarOK = Canal de Venda Excluido com Sucesso.
|
||||
editarTipoPuntoVentaController.MSG.emailInvalido = Email em formato inválido. Favor Verificar.
|
||||
lbEquivalencia.value = Equivalencia
|
||||
|
||||
# Muestra o formulario de Pesquisa Restrição de Pago
|
||||
|
|
Loading…
Reference in New Issue