fixes bug#6344
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@44458 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
096bc11ec1
commit
e3fe4db4c5
|
@ -330,18 +330,18 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
String cnpjEmpresaProtheus = Atributos.CNPJ_EMPRESA_PROTHEUS;
|
String cnpjEmpresaProtheus = Atributos.CNPJ_EMPRESA_PROTHEUS;
|
||||||
|
|
||||||
String nome = puntoVenta.getNombpuntoventa();
|
String nome = puntoVenta.getNombpuntoventa();
|
||||||
nome = removerAcentosCaracteresEspeciais(nome);
|
nome = removerAcentosCaracteresEspeciaisTotvs(nome);
|
||||||
|
|
||||||
String cgc = puntoVenta.getNumDoCPuntoVenta();
|
String cgc = puntoVenta.getNumDoCPuntoVenta();
|
||||||
|
|
||||||
String endereco = puntoVenta.getDireccioncalle() + "," + ((puntoVenta.getDireccionnumero() == null) ? "" : puntoVenta.getDireccionnumero());
|
String endereco = puntoVenta.getDireccioncalle() + "," + ((puntoVenta.getDireccionnumero() == null) ? "" : puntoVenta.getDireccionnumero());
|
||||||
endereco = removerAcentosCaracteresEspeciais(endereco);
|
endereco = removerAcentosCaracteresEspeciaisTotvs(endereco);
|
||||||
|
|
||||||
String complemen = puntoVenta.getCompl() == null ? "" : puntoVenta.getCompl();
|
String complemen = puntoVenta.getCompl() == null ? "" : puntoVenta.getCompl();
|
||||||
complemen = removerAcentosCaracteresEspeciais(complemen);
|
complemen = removerAcentosCaracteresEspeciaisTotvs(complemen);
|
||||||
|
|
||||||
String bairro = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getDesccolonia();
|
String bairro = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getDesccolonia();
|
||||||
bairro = removerAcentosCaracteresEspeciais(bairro);
|
bairro = removerAcentosCaracteresEspeciaisTotvs(bairro);
|
||||||
|
|
||||||
String codmun = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getCodmunicipio().toString();
|
String codmun = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getCodmunicipio().toString();
|
||||||
codmun = (codmun == null) ? "" : StringUtils.leftPad(codmun, 5, '0');
|
codmun = (codmun == null) ? "" : StringUtils.leftPad(codmun, 5, '0');
|
||||||
|
@ -362,12 +362,14 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
}
|
}
|
||||||
|
|
||||||
String email = puntoVenta.getDescCorreo() == null ? "" : puntoVenta.getDescCorreo();
|
String email = puntoVenta.getDescCorreo() == null ? "" : puntoVenta.getDescCorreo();
|
||||||
|
email = removerCaracteresInvalidosXml(email);
|
||||||
|
|
||||||
String fax = puntoVenta.getNumfax() == null ? "" : puntoVenta.getNumfax();
|
String fax = puntoVenta.getNumfax() == null ? "" : puntoVenta.getNumfax();
|
||||||
String inscr = puntoVenta.getNumIEPuntoVenta();
|
String inscr = puntoVenta.getNumIEPuntoVenta();
|
||||||
String inscrm = InscricaoMunicipal.ISENTO.name();
|
String inscrm = InscricaoMunicipal.ISENTO.name();
|
||||||
|
|
||||||
String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa();
|
String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa();
|
||||||
nreduz = removerAcentosCaracteresEspeciais(nreduz);
|
nreduz = removerAcentosCaracteresEspeciaisTotvs(nreduz);
|
||||||
|
|
||||||
String simpnac = ContribuinteSimplesNacional.NAO.getValor();
|
String simpnac = ContribuinteSimplesNacional.NAO.getValor();
|
||||||
|
|
||||||
|
@ -466,11 +468,33 @@ public class PuntoVentaServiceImpl implements PuntoVentaService {
|
||||||
vlr = somenteNumeros(vlr);
|
vlr = somenteNumeros(vlr);
|
||||||
return vlr.length() > 11;
|
return vlr.length() > 11;
|
||||||
}
|
}
|
||||||
private String removerAcentosCaracteresEspeciais(String s){
|
|
||||||
|
/**
|
||||||
|
* From xml spec valid chars:<br>
|
||||||
|
* #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]<br>
|
||||||
|
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.<br>
|
||||||
|
*
|
||||||
|
* link artigo:http://stackoverflow.com/questions/9710185/how-to-deal-with-invalid-characters-in-a-ws-output-when-using-cxf
|
||||||
|
*
|
||||||
|
* @param text The String to clean
|
||||||
|
* @param replacement The string to be substituted for each match
|
||||||
|
* @return The resulting String
|
||||||
|
*/
|
||||||
|
private String removerCaracteresInvalidosXml(String s){
|
||||||
|
if (s == null){
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
String re = "[^\\x09\\x0A\\x0D\\x20-\\xD7FF\\xE000-\\xFFFD\\x10000-x10FFFF]";
|
||||||
|
return s.replaceAll(re, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String removerAcentosCaracteresEspeciaisTotvs(String s){
|
||||||
if (StringUtils.isBlank(s)){
|
if (StringUtils.isBlank(s)){
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
s = StringUtils.trim(s);
|
s = StringUtils.trim(s);
|
||||||
|
s = removerCaracteresInvalidosXml(s);
|
||||||
return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").replaceAll("\\W", " ");
|
return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").replaceAll("\\W", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue