addActionError("Name is required");
}
if(hasErrors()){
return INPUT;
}
PaymentTerm paymentTerm;
if(getPaymentTerm().getId() == null || "".equalsIgnoreCase(getPaymentTerm().getId())){
paymentTerm = new PaymentTerm();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
} else {
paymentTerm = (PaymentTerm) manager.getById(ProductCategory.class, getPaymentTerm().getId());
logInfo = paymentTerm.getLogInformation();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
paymentTerm.setLogInformation(logInfo);
paymentTerm.setName(getPaymentTerm().getName());
paymentTerm.setDescription(getPaymentTerm().getDescription());
paymentTerm.setFixMonthDay(getPaymentTerm().getFixMonthDay());
paymentTerm.setFixMonthOffSite(getPaymentTerm().getFixMonthCutOff());
paymentTerm.setFixMonthCutOff(getPaymentTerm().getFixMonthCutOff());
paymentTerm.setFixedDueDate(getPaymentTerm().getFixedDueDate());
paymentTerm.setNextBusinessDay(getPaymentTerm().getNextBusinessDay());
paymentTerm.setAfterDelivery(getPaymentTerm().getAfterDelivery());
paymentTerm.setNetDays(getPaymentTerm().getNetDays());
paymentTerm.setDiscountDays(getPaymentTerm().getDiscountDays());
paymentTerm.setDiscountDays2(getPaymentTerm().getDiscountDays2());
paymentTerm.setGraceDays(getPaymentTerm().getGraceDays());
paymentTerm.setNetDay(getPaymentTerm().getNetDay());
paymentTerm.setDiscount(getPaymentTerm().getDiscount());
paymentTerm.setDiscount2(getPaymentTerm().getDiscount2());
paymentTerm.setDocumentNote(getPaymentTerm().getDocumentNote());
manager.save(paymentTerm);
setPaymentTerm(getPaymentTerm());
return SUCCESS;