@ValidationMethod(on="upload")
public void checkClientAndSupplier(ValidationErrors errors) {
try {
if (getRecipientTaxPayer().length()==0) {
errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.clientIsRequired"));
} else if (getBillerTaxPayer().length()>0) {
connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
Dms oDms = getSession().getDms();
Document r,b;
try {
r = oDms.getDocument(getRecipientTaxPayer());
try {
b = oDms.getDocument(getBillerTaxPayer());
if (r.type().name().equals(b.type().name()))
errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.incompatibleClientAndSupplier"));
} catch (NumberFormatException nfe) {
Log.out.error("NumberFormatException getting biller "+getBillerTaxPayer(), nfe);
errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.incompatibleClientAndSupplier"));
}
} catch (NumberFormatException nfe) {
Log.out.error("NumberFormatException getting recipient "+getRecipientTaxPayer(), nfe);
errors.add("items", new LocalizableError("com.zesped.action.InvoceUpload.incompatibleClientAndSupplier"));
}
disconnect();
}
} catch (StorageException e) { }