String timeZone = userPref.getTimeZone();
if (timeZone == null)
timeZone = "EST";
GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
dForm.setCalendar(gCal);
String typeOfSave = null;
if (request.getParameter("typeOfSave") != null)
typeOfSave = request.getParameter("typeOfSave");
// Convert all strings to int
invenForm.convertFormbeanToValueObject();
InventoryHome hm = (InventoryHome)CVUtility.getHomeObject(
"com.centraview.account.inventory.InventoryHome", "Inventory");
Inventory remote = hm.create();
remote.setDataSource(dataSource);
InventoryVO inventoryVO = new InventoryVO();
ItemVO itemVO = new ItemVO();
itemVO.setItemId(invenForm.getItemIDValue());
inventoryVO.setItemVO(itemVO);
inventoryVO.setQty(invenForm.getQty());
inventoryVO.setStrIdentifier(invenForm.getIdentifier());
inventoryVO.setStrDescription(invenForm.getDescription());
inventoryVO.setIntLocationID(invenForm.getLocationIDValue());
EntityVO entityVO = new EntityVO();
entityVO.setContactID(invenForm.getManufactureIDValue());
inventoryVO.setManufacturerVO(entityVO);
entityVO = new EntityVO();
entityVO.setContactID(invenForm.getVendorIDValue());
inventoryVO.setVendorVO(entityVO);
inventoryVO.setIntStatusID(invenForm.getStatusIDValue());
entityVO = new EntityVO();
entityVO.setContactID(invenForm.getSoldToIDValue());
inventoryVO.setSoldToVO(entityVO);
// for custom fields
Vector customFieldVec = getCustomFieldVO(request, response);
invenForm.setCustomFieldsVec(customFieldVec);
inventoryVO.setCustomFieldsVec(customFieldVec);
// for custom fields ends here
if (invID > 0) {
inventoryVO.setInventoryID(invID);
remote.updateInventory(individualID, inventoryVO);
}
if (invID == 0) {
inventoryVO = remote.insertInventory(individualID, inventoryVO);
invenForm.setInventoryID(inventoryVO.getInventoryID());
Timestamp timeStamp = inventoryVO.getModified();
Date date = inventoryVO.getCreated();
if (inventoryVO.getCreated() != null)
invenForm.setCreated(dForm.format(date));
if (inventoryVO.getModified() != null)
invenForm.setModified(dForm.format(timeStamp));
}
if (typeOfSave != null) {
if (typeOfSave.equals("savenew")) {