/** * 保存修改的PurchaseOrderItem * * @param mapping * @param form * @param request * @param response * @return ActionForward * @throws Exception */ public ActionForward update( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BeanForm itemForm = (BeanForm) form; itemForm.setBeanLoader(ServiceLocator.getBeanLoader(request)); PurchaseOrderItem poi = this.getPurchaseOrderItemFromSession(request); if (itemForm.getString("isRecharge").equals(YesNo.YES.getEnumCode().toString())) itemForm.populateToBean(poi, request, new String[] {"buyForDepartment.id", "buyForUser.id"}); else itemForm.populateToBean(poi, request); poi.setRecharges(this.getRechargeInfoFromRequest(poi, request)); poi.setAttachments(this.getPurchaseOrderItemAttachmentListFromRequest(request)); request.setAttribute("X_OBJECT", poi); request.setAttribute("X_ROWPAGE", "purchaseOrder/itemRow.jsp"); // make itemRow.jsp edit version this.setEditing(true, request); return mapping.findForward("success"); }
/** * action method for editing PurchaseOrderItemReceipt * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward edit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchaseOrderItemReceipt poir = getPurchaseOrderItemReceiptFromRequest(request); this.checkEditPower(poir, request); this.putReceiverNoToRequest(poir.getPurchaseOrderItem(), request); this.putMaxQtyToRequest(poir.getPurchaseOrderItem(), poir, request); if (!isBack(request)) { BeanForm purchaseOrderItemReceiptForm = (BeanForm) getForm("/updatePurchaseOrderItemReceipt", request); purchaseOrderItemReceiptForm.populateToForm(poir); } this.setAdding(false, request); if (this.isRequestor(poir.getPurchaseOrderItem(), request)) { if (poir.getReceiveDate1() != null) request.setAttribute("x_receiveDate", poir.getReceiveDate1()); else request.setAttribute("x_receiveDate", new Date()); } else { if (poir.getReceiveDate2() != null) request.setAttribute("x_receiveDate", poir.getReceiveDate2()); else request.setAttribute("x_receiveDate", new Date()); } return mapping.findForward("page"); }
/** * the action method for inserting new hotel contract to db * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward insert( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Hotel hotel = this.getHotelFromRequest(request); this.checkHotel(hotel, request); BeanForm hotelContractForm = (BeanForm) form; HotelContract hotelContract = new HotelContract(); hotelContractForm.populate(hotelContract, BeanForm.TO_BEAN); hotelContract.setHotel(hotel); FormFile file = (FormFile) hotelContractForm.get("fileContent"); hotelContract.setFileName(file.getFileName()); HotelContractManager hotelContractManager = ServiceLocator.getHotelContractManager(request); HotelContract newHc = null; if (file.getFileSize() > 0) { hotelContract.setFileSize(file.getFileSize()); newHc = hotelContractManager.insertHotelContract(hotelContract, file.getInputStream()); } else { throw new ActionException("hotelContract.error.fileSize.zero"); } request.setAttribute("X_OBJECT", newHc); request.setAttribute("X_ROWPAGE", "hotelContract/row.jsp"); return mapping.findForward("success"); }
/** * action method for inserting PurchaseOrderItemReceipt * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward insert( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchaseOrderItem poi = this.getPurchaseOrderItemFromRequest(request); this.checkEditPower(poi, request); BeanForm purchaseOrderItemReceiptForm = (BeanForm) form; PurchaseOrderItemReceipt poir = new PurchaseOrderItemReceipt(); purchaseOrderItemReceiptForm.populate(poir, BeanForm.TO_BEAN); poir.setPurchaseOrderItem(poi); PurchaseOrderItemReceiptManager pm = ServiceLocator.getPurchaseOrderItemReceiptManager(request); if (!pm.checkQty(poir)) throw new BackToInputActionException("purchaseOrderItemReceipt.qtyExceeds"); poir = pm.insertPurchaseOrderItemReceipt(poir, this.getCurrentUser(request)); request.setAttribute("X_OBJECT", poir); request.setAttribute("X_ROWPAGE", "purchaseOrderItemReceipt/row.jsp"); EmailManager em = ServiceLocator.getEmailManager(request); Map context = new HashMap(); User emailToUser = null; if (this.getCurrentUser(request).equals(poir.getReceiver1())) { emailToUser = poir.getReceiver2(); context.put("x_receiveQty", poir.getReceiveQty1()); context.put("x_receiveDate", poir.getReceiveDate1()); } else { emailToUser = poir.getReceiver1(); context.put("x_receiveQty", poir.getReceiveQty2()); context.put("x_receiveDate", poir.getReceiveDate2()); } context.put("x_emailToUser", emailToUser); context.put("x_receiver", this.getCurrentUser(request)); context.put("x_poir", poir); context.put("role", EmailManager.EMAIL_ROLE_RECEIVER); em.insertEmail(poir.getLogSite(), emailToUser.getEmail(), "POItemReceive.vm", context); return mapping.findForward("success"); }
/** * the action method for creating hotel contract * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward newObject( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Hotel hotel = this.getHotelFromRequest(request); this.checkHotel(hotel, request); if (!isBack(request)) { HotelContract hotelContract = new HotelContract(); hotelContract.setHotel(hotel); BeanForm hotelContractForm = (BeanForm) getForm("/insertHotelContract", request); hotelContractForm.populate(hotelContract, BeanForm.TO_FORM); } putEnumListToRequest(request); return mapping.findForward("page"); }
/** * the action method for updating hotel contract * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward update( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Hotel hotel = this.getHotelFromRequest(request); this.checkHotel(hotel, request); BeanForm hotelContractForm = (BeanForm) form; HotelContract hotelContract = new HotelContract(); hotelContractForm.populate(hotelContract, BeanForm.TO_BEAN); HotelContractManager hotelContractManager = ServiceLocator.getHotelContractManager(request); request.setAttribute("X_OBJECT", hotelContractManager.updateHotelContract(hotelContract)); request.setAttribute("X_ROWPAGE", "hotelContract/row.jsp"); return mapping.findForward("success"); }
/** * the action method for editing hotel contract * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward edit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HotelContract hotelContract = getHotelContractFromRequest(request); Hotel hotel = hotelContract.getHotel(); this.checkHotel(hotel, request); request.setAttribute("x_hotelContract", hotelContract); if (!isBack(request)) { BeanForm hotelContractForm = (BeanForm) getForm("/updateHotelContract", request); hotelContractForm.populate(hotelContract, BeanForm.TO_FORM); } putEnumListToRequest(request); return mapping.findForward("page"); }
/** * 修改PurchaseOrderItem * * @param mapping * @param form * @param request * @param response * @return ActionForward * @throws Exception */ public ActionForward edit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchaseOrderItem poi = this.getPurchaseOrderItemFromSession(request); // this.checkPurchaseOrderEditPower(poi.getPurchaseOrder(),request); PurchaseRequest pr = poi.getPurchaseRequestItem().getPurchaseRequest(); request.setAttribute("x_poi", poi); BeanForm itemForm = (BeanForm) this.getForm("/updatePurchaseOrderItem", request); if (!this.isBack(request)) { itemForm.populateToForm(poi); } // recharge this.setRechargeInfoToRequest( poi, poi.getRecharges(), pr.getDepartment().getSite(), itemForm, request); request.setAttribute("X_FORMNAME", "purchaseOrderItemForm"); // combo list SupplierManager sm = ServiceLocator.getSupplierManager(request); request.setAttribute( "x_supplierItemList", sm.getSuitableSupplierItemListForPurchase( poi.getSupplier(), poi.getPurchaseOrder().getSubCategory(), poi.getExchangeRate().getCurrency())); this.putPurchaseTypeListToRequest(pr.getDepartment().getSite(), request); this.putProjectCodeToRequest(pr.getDepartment().getSite(), request); // make itemAttacmentRow.jsp edit version this.setEditing(true, request); return mapping.findForward("page"); }
/** * action method for creating PurchaseOrderItemReceipt * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward newObject( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchaseOrderItem poi = this.getPurchaseOrderItemFromRequest(request); this.checkEditPower(poi, request); this.putReceiverNoToRequest(poi, request); this.putMaxQtyToRequest(poi, null, request); if (!isBack(request)) { PurchaseOrderItemReceipt purchaseOrderItemReceipt = new PurchaseOrderItemReceipt(); purchaseOrderItemReceipt.setPurchaseOrderItem(poi); BeanForm purchaseOrderItemReceiptForm = (BeanForm) getForm("/insertPurchaseOrderItemReceipt", request); purchaseOrderItemReceiptForm.populateToForm(purchaseOrderItemReceipt); } this.setAdding(true, request); request.setAttribute("x_receiveDate", new Date()); return mapping.findForward("page"); }
/** * action method for updating PurchaseOrderItemReceipt * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */ public ActionForward update( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchaseOrderItemReceipt poir = this.getPurchaseOrderItemReceiptFromRequest(request); this.checkEditPower(poir, request); BeanForm purchaseOrderItemReceiptForm = (BeanForm) form; purchaseOrderItemReceiptForm.populateToBean(poir, request); PurchaseOrderItemReceiptManager pm = ServiceLocator.getPurchaseOrderItemReceiptManager(request); if (!pm.checkQty(poir)) throw new BackToInputActionException("purchaseOrderItemReceipt.qtyExceeds"); PurchaseOrderItemReceipt oldPoir = this.getPurchaseOrderItemReceiptFromRequest(request); request.setAttribute( "X_OBJECT", pm.updatePurchaseOrderItemReceipt(oldPoir, poir, this.getCurrentUser(request))); request.setAttribute("X_ROWPAGE", "purchaseOrderItemReceipt/row.jsp"); return mapping.findForward("success"); }
protected void processHotelPrice(TravelApplication ta, BeanForm taForm) { if (ta.getHotel() == null) taForm.set("hotel_id", "-1"); if (ta.getPrice() == null) taForm.set("price_id", "-1"); }