Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 2594 → Rev 2595

/branches/v2.10-motoculteur/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
1492,17 → 1492,27
// Soit un numéro de département, soit un code de pays à deux lettres
String[] codeCom = localite.getText().split(" ");
if(codeCom.length > 1) {
String codeLoc = codeCom[1].replace('(', ' ');
if(codeCom.length > 1 && ressembleAUnCodePaysOuDepartement(codeCom[codeCom.length - 1])) {
String codeLoc = codeCom[codeCom.length - 1].replace('(', ' ');
codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
 
if(Util.estUnNombre(codeLoc)) {
codeLocalite = codeLoc ;
} else {
pays = codeLoc;
pays = codeLoc.toUpperCase();
}
}
}
private boolean ressembleAUnCodePaysOuDepartement(String s) {
String sP = s.replace("(", "").replace(")", "").trim();
boolean contientDesParentheses = s.contains("(") && s.contains(")");
boolean estUnCodePays = !Util.estUnNombre(sP) && (sP.length() == 2);
boolean estUnCodeDepartement = Util.estUnNombre(sP) && (sP.length() >= 1 && sP.length() <= 5);
return contientDesParentheses && (estUnCodePays || estUnCodeDepartement);
}
 
private void modifierObservationEnMasse(Champs champModifie) {