fixes bug#20923
dev:wilian qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@104529 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
3be393ff1b
commit
f92f05501c
|
@ -7,6 +7,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.brazilutils.br.cpfcnpj.Cpf;
|
||||
|
@ -35,11 +36,13 @@ import org.zkoss.zul.Radiogroup;
|
|||
import org.zkoss.zul.Tab;
|
||||
import org.zkoss.zul.Textbox;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||
import com.rjconsultores.ventaboletos.entidad.Cliente;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteCurso;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteDescuento;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteDireccion;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClienteFidelidad;
|
||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||
import com.rjconsultores.ventaboletos.entidad.Curso;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Escola;
|
||||
|
@ -52,6 +55,7 @@ import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion;
|
|||
import com.rjconsultores.ventaboletos.entidad.TipoOcupacion;
|
||||
import com.rjconsultores.ventaboletos.service.ClienteCursoService;
|
||||
import com.rjconsultores.ventaboletos.service.ClienteService;
|
||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.EscolaService;
|
||||
import com.rjconsultores.ventaboletos.service.MotivoViajeService;
|
||||
|
@ -96,6 +100,9 @@ public class EditarClienteController extends MyGenericForwardComposer {
|
|||
|
||||
@Autowired
|
||||
TipoIdentificacionService tipoIdentificacionService;
|
||||
|
||||
@Autowired
|
||||
ConstanteService constanteService;
|
||||
|
||||
private Cliente cliente;
|
||||
private MyListbox clienteList;
|
||||
|
@ -853,67 +860,9 @@ public class EditarClienteController extends MyGenericForwardComposer {
|
|||
cmbMotivacionViaje.getValue();
|
||||
cmbOcupacion.getValue();
|
||||
|
||||
if (txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) {
|
||||
if ( cmbTipoIdentificacion != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion.getSelectedItem().getValue().toString())) {
|
||||
String numDoc = txtNumRfc.getText();
|
||||
if(!validarCPF(numDoc)) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.validacaoCPFInvalido"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty()) {
|
||||
if ( cmbTipoIdentificacion2 != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion2.getSelectedItem().getValue().toString())) {
|
||||
String numDoc = txtNumRfc2.getText();
|
||||
if(!validarCPF(numDoc)) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.validacaoCPFInvalido"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc2.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Cliente> lsCliente = new ArrayList<Cliente>();
|
||||
if ((txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) && cmbTipoIdentificacion != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion.getSelectedItem().getValue().toString())){
|
||||
lsCliente = clienteService.buscarPorDocumento(txtNumRfc.getValue());
|
||||
if (lsCliente.size() > 1
|
||||
|| (lsCliente.size() == 1 && !lsCliente.get(0).getClienteId().equals(cliente.getClienteId()))) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.documentoexiste"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty() && cmbTipoIdentificacion2 != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion2.getSelectedItem().getValue().toString())) {
|
||||
lsCliente = clienteService.buscarPorDocumento(txtNumRfc2.getValue());
|
||||
if (lsCliente.size() > 1
|
||||
|| (lsCliente.size() == 1 && !lsCliente.get(0).getClienteId().equals(cliente.getClienteId()))) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.documentoexiste"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc2.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!validarCampos()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(this.replaceTextbox(txtNumFax))) {
|
||||
|
@ -990,6 +939,94 @@ public class EditarClienteController extends MyGenericForwardComposer {
|
|||
}
|
||||
|
||||
|
||||
private boolean validarCampos() throws InterruptedException {
|
||||
if (txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) {
|
||||
if ( cmbTipoIdentificacion != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion.getSelectedItem().getValue().toString())) {
|
||||
String numDoc = txtNumRfc.getText();
|
||||
if(!validarCPF(numDoc)) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.validacaoCPFInvalido"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty()) {
|
||||
if ( cmbTipoIdentificacion2 != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion2.getSelectedItem().getValue().toString())) {
|
||||
String numDoc = txtNumRfc2.getText();
|
||||
if(!validarCPF(numDoc)) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.validacaoCPFInvalido"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc2.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Cliente> lsCliente = new ArrayList<Cliente>();
|
||||
if ((txtNumRfc.getText() != null && !txtNumRfc.getText().isEmpty()) && cmbTipoIdentificacion != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion.getSelectedItem().getValue().toString())){
|
||||
lsCliente = clienteService.buscarPorDocumento(txtNumRfc.getValue());
|
||||
if (lsCliente.size() > 1
|
||||
|| (lsCliente.size() == 1 && !lsCliente.get(0).getClienteId().equals(cliente.getClienteId()))) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.documentoexiste"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (txtNumRfc2.getText() != null && !txtNumRfc2.getText().isEmpty() && cmbTipoIdentificacion2 != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem() != null
|
||||
&& cmbTipoIdentificacion2.getSelectedItem().getValue() != null
|
||||
&& CPF.equals(cmbTipoIdentificacion2.getSelectedItem().getValue().toString())) {
|
||||
lsCliente = clienteService.buscarPorDocumento(txtNumRfc2.getValue());
|
||||
if (lsCliente.size() > 1
|
||||
|| (lsCliente.size() == 1 && !lsCliente.get(0).getClienteId().equals(cliente.getClienteId()))) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.documentoexiste"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
txtNumRfc2.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Constante exigeEmailOuTelefone = constanteService.buscarPorNomeConstante(Constantes.EXIGE_EMAIL_OU_TEL_CAD_CLIENTE);
|
||||
if(exigeEmailOuTelefone != null && BooleanUtils.toBoolean(exigeEmailOuTelefone.getValorconstante())) {
|
||||
|
||||
boolean isTelefoneNaoInformado = StringUtils.isBlank(this.replaceTextbox(txtNumFax)) &&
|
||||
StringUtils.isBlank(this.replaceTextbox(numtelefonouno)) &&
|
||||
StringUtils.isBlank(this.replaceTextbox(numtelefonodos));
|
||||
|
||||
boolean isEmailNaoInformado = StringUtils.isBlank(txtDescorreo.getValue());
|
||||
|
||||
if(isTelefoneNaoInformado && isEmailNaoInformado) {
|
||||
Messagebox.show(Labels.getLabel("editarClienteController.MSG.exigeEmailOuTelefone"),
|
||||
Labels.getLabel("editarClienteController.window.title"), Messagebox.OK,
|
||||
Messagebox.EXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param numDoc
|
||||
* @throws InterruptedException
|
||||
|
|
|
@ -4520,6 +4520,7 @@ editarEstacionController.lbNumEmpresa.value = Código de la empresa/Identificado
|
|||
editarEstacionController.lbNumFilial.value = Código de la filial
|
||||
editarEstacionController.lbNumPdv.value = No do PDV/Ponto de Captura
|
||||
editarEstacionController.tab.label.impresora = Impresoras
|
||||
editarEstacionController.MSG.numEmpresa= El campo {0} solo permite números
|
||||
|
||||
# Búsqueda Excepción ida y regreso
|
||||
busquedaExceptionRedondoController.window.title = Excepción viaje ida y regreso
|
||||
|
@ -6471,6 +6472,7 @@ busquedaClienteController.nombmaterno.label = Apellido Materno
|
|||
busquedaClienteController.numtelefono.label = Teléfono
|
||||
busquedaClienteController.numtelefonodos.label = Celular
|
||||
busquedaClienteController.lbDescorreo.value = E-mail
|
||||
editarClienteController.MSG.exigeEmailOuTelefone = Ingrese correo electrónico o teléfono
|
||||
|
||||
#Editar Cliente
|
||||
editarClienteController.window.title = Cliente
|
||||
|
|
|
@ -4758,6 +4758,7 @@ editarEstacionController.lbNumEmpresa.value = Código da Empresa/Identificador d
|
|||
editarEstacionController.lbNumFilial.value = Código da Filial
|
||||
editarEstacionController.lbNumPdv.value = Número PDV/Ponto de Captura
|
||||
editarEstacionController.tab.label.impresora = Impressoras
|
||||
editarEstacionController.MSG.numEmpresa= O campo {0} permite somente números
|
||||
|
||||
# Pesquisa Exceção Ida e Volta
|
||||
busquedaExceptionRedondoController.window.title = Exceção Viagem Ida e Volta
|
||||
|
@ -6759,7 +6760,7 @@ busquedaClienteController.nombmaterno.label = Sobrenome Materno
|
|||
busquedaClienteController.numtelefono.label = Telefone
|
||||
busquedaClienteController.numtelefonodos.label = Celular
|
||||
busquedaClienteController.lbDescorreo.value = E-mail
|
||||
|
||||
editarClienteController.MSG.exigeEmailOuTelefone = Informe o E-mail ou Telefone
|
||||
|
||||
#Editar Cliente
|
||||
editarClienteController.window.title = Cliente
|
||||
|
|
Loading…
Reference in New Issue