AdminBean adminBean = getAdminBean(request);
Site site = adminBean.getSite();
initSiteProfiles(form, site);
Tax tax = new Tax();
if (!insertMode) {
tax = TaxDAO.load(site.getSiteId(), Format.getLong(form.getTaxId()));
}
ActionMessages errors = validate(form);
if (errors.size() != 0) {
saveMessages(request, errors);
initListInfo(form, tax);
initSearchInfo(form, request);
if (insertMode) {
FormUtils.setFormDisplayMode(request, form, FormUtils.CREATE_MODE);
}
else {
FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
}
return mapping.findForward("error");
}
if (insertMode) {
tax.setRecCreateBy(adminBean.getUser().getUserId());
tax.setRecCreateDatetime(new Date(System.currentTimeMillis()));
tax.setSite(site);
}
if (form.isSiteProfileClassDefault()) {
saveDefault(tax, form, adminBean);
if (insertMode) {
em.persist(tax);
}
}
else {
saveLanguage(tax, form, adminBean);
}
form.setTaxId(Format.getLong(tax.getTaxId()));
form.setMode("U");
initListInfo(form, tax);
initSearchInfo(form, request);