final String sBusinessName = getTaxPayer().getBusinessName().toUpperCase();
final String sTaxId = getTaxPayer().getTaxId();
final String sFormerId = getTaxPayer().getId();
Log.out.debug("Validating TaxPayer with business name "+sBusinessName+" and tax id. "+sTaxId+" for former id "+sFormerId);
if (sBusinessName==null) {
errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.businessName.valueNotPresent"));
} else if (sBusinessName.length()==0) {
errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.businessName.valueNotPresent"));
} else {
try {
connect();
CustomerAccount oAcc = new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid"));
TaxPayer oFoundTaxPayer = oAcc.taxpayers(getSession()).seek(getSession(), sBusinessName);
if (!oFoundTaxPayer.id().equals(sFormerId))
errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.businessNameAlreadyExists"));
oFoundTaxPayer = oAcc.taxpayers(getSession()).seek(getSession(), sTaxId);
if (!oFoundTaxPayer.id().equals(sFormerId))
errors.add("business name", new LocalizableError("com.zesped.action.SaveClient.taxIdAlreadyExists"));
} catch (ElementNotFoundException clientnotfound) {
} catch (Exception e) {
Log.out.error("ActivateTaxPayer.validateBusinessName("+sBusinessName+") "+e.getClass().getName()+" "+e.getMessage(), e);
} finally {
close();