if(getCustomer().getCreditLimit() == 0 || "".equals(getCustomer().getCreditLimit())){
addActionError("Credit Limit is required");
}
Customer customer;
if(getCustomer().getId() == null && "".equalsIgnoreCase(getCustomer().getId())){
customer = new Customer();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
} else {
customer = (Customer) manager.getById(Customer.class, getCustomer().getId());
logInfo = customer.getLogInformation();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
customer.setLogInformation(logInfo);
customer.setIsCustomer(getCustomer().getIsCustomer());
customer.setDocumentCopies(getCustomer().getDocumentCopies());
customer.setInvoiceRule(getCustomer().getInvoiceRule());
customer.setInvoiceSchedule(getInvoiceSchedule());
customer.setDeliveryRule(getCustomer().getDeliveryRule());
customer.setDeliveryVia(getCustomer().getDeliveryVia());
customer.setPriceList(getPriceList());
customer.setDiscountSchema(getDiscountSchema());
customer.setFlatDiscount(getCustomer().getFlatDiscount());
customer.setPaymentRule(getCustomer().getPaymentRule());
customer.setPaymentTerm(getPaymentTerm());
customer.setSalesRepresentative(getContact());
customer.setDunning(getDunning());
customer.setOrderReference(getCustomer().getOrderReference());
customer.setOrderDescription(getCustomer().getOrderDescription());
customer.setDiscountPrinted(getCustomer().getDiscountPrinted());
customer.setOrderDescription(getCustomer().getOrderDescription());
customer.setMinShelfLife(getCustomer().getMinShelfLife());
customer.setCreditLimit(getCustomer().getCreditLimit());
customer.setCreditUsed(getCustomer().getCreditUsed());
customer.setDunningGrace(getCustomer().getDunningGrace());
manager.save(customer);
setCustomer(customer);
return SUCCESS;