}
if(hasErrors()){
return INPUT;
}
Currency currency;
if(getCurrency().getId() == null || "".equalsIgnoreCase(getCurrency().getId())) {
currency = new Currency();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
msg = "Successfully Add "+getCurrency().getISOCurrencyCode();
} else {
currency = (Currency) manager.getById(Currency.class, getCurrency().getId());
logInfo = currency.getLogInformation();
msg = "Successfully Edit "+getCurrency().getISOCurrencyCode();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
currency.setLogInformation(logInfo);
currency.setISOCurrencyCode(getCurrency().getISOCurrencyCode());
currency.setSymbol(getCurrency().getSymbol());
currency.setDescription(getCurrency().getDescription());
currency.setStandardPrecision(getCurrency().getStandardPrecision());
currency.setCostingPrecision(getCurrency().getCostingPrecision());
manager.save(currency);
setCurrency(currency);
return SUCCESS;
}