Author: bibryam
Date: Mon May 19 16:13:02 2008 New Revision: 658036 URL: http://svn.apache.org/viewvc?rev=658036&view=rev Log: Added UI for entering Order Item Change reason and comments during Order Item update/cancel/append. Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/checkoutreview.ftl ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl ofbiz/trunk/applications/order/data/OrderTypeData.xml ofbiz/trunk/applications/order/servicedef/services.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh ofbiz/trunk/applications/order/webapp/ordermgr/order/appendorderitem.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/orderstatus.bsh Mon May 19 16:13:02 2008 @@ -194,4 +194,7 @@ context.put("orderShipmentInfoSummaryList", orderShipmentInfoSummaryList); context.put("customerPoNumberSet", customerPoNumberSet); + + orderItemChangeReasons = delegator.findByAnd("Enumeration", UtilMisc.toMap("enumTypeId", "ODR_ITM_CH_REASON"), UtilMisc.toList("sequenceId")); + context.put("orderItemChangeReasons", orderItemChangeReasons); } Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/checkoutreview.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/checkoutreview.ftl?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/checkoutreview.ftl (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/checkoutreview.ftl Mon May 19 16:13:02 2008 @@ -35,7 +35,7 @@ </script> <h1>${uiLabelMap.OrderFinalCheckoutReview}</h1> -<#if !isDemoStore?exists || isDemoStore><p>${uiLabelMap.OrderDemoFrontNote}.</p></#if> +<#if !isDemoStore?exists && isDemoStore><p>${uiLabelMap.OrderDemoFrontNote}.</p></#if> <#if cart?exists && 0 < cart.size()> ${screens.render("component://ecommerce/widget/OrderScreens.xml#orderheader")} Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl Mon May 19 16:13:02 2008 @@ -168,17 +168,27 @@ </td> <#if maySelectItems?default("N") == "Y" && roleTypeId?if_exists == "PLACING_CUSTOMER"> <td> </td> - <#if (orderHeader.statusId != "ORDER_SENT" && orderItem.statusId != "ITEM_COMPLETED" && orderItem.statusId != "ITEM_CANCELLED" && pickedQty == 0)> - <td><a href="<@ofbizUrl>cancelOrderItem?orderId=${orderItem.orderId}&orderItemSeqId=${orderItem.orderItemSeqId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonCancel}</a></td> - <#else> - <td> </td> - </#if> <td> <input name="item_id" value="${orderItem.orderItemSeqId}" type="checkbox"/> </td> + <td> </td> </#if> </#if> </tr> + <#-- now cancel reason and comment field --> + <#if maySelectItems?default("N") == "Y" && (orderHeader.statusId != "ORDER_SENT" && orderItem.statusId != "ITEM_COMPLETED" && orderItem.statusId != "ITEM_CANCELLED" && pickedQty == 0)> + <tr align="right"><td colspan="7"><div class="tabletext"><b>${uiLabelMap.OrderReturnReason}</b> + <select name="irm_${orderItem.orderItemSeqId}" class="selectBox"> + <option value=""> </option> + <#list orderItemChangeReasons as reason> + <option value="${reason.enumId}">${reason.get("description",locale)?default(reason.enumId)}</option> + </#list> + </select> + <b>${uiLabelMap.CommonComments}</b> + <input class="inputBox" type="text" name="icm_${orderItem.orderItemSeqId}" value="" size="30" maxlength="60"/></div></td> + <td colspan="4" align="right"><a href="javascript:document.addCommonToCartForm.method='post';document.addCommonToCartForm.action='<@ofbizUrl>cancelOrderItem?orderItemSeqId=${orderItem.orderItemSeqId}</@ofbizUrl>';document.addCommonToCartForm.submit()" class="buttontext">${uiLabelMap.CommonCancel}</a></td> + </tr> + </#if> <#-- show info from workeffort if it was a rental item --> <#if orderItem.orderItemTypeId == "RENTAL_ORDER_ITEM"> <#if workEffortSave?exists> Modified: ofbiz/trunk/applications/order/data/OrderTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original) +++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Mon May 19 16:13:02 2008 @@ -82,9 +82,10 @@ <EnumerationType description="Order Item Change Type" enumTypeId="ODR_ITM_CHANGE_TYPE" hasTable="N" parentTypeId=""/> <Enumeration description="Order Item Update" enumCode="ITM_UPDATE" enumId="ODR_ITM_UPDATE" sequenceId="01" enumTypeId="ODR_ITM_CHANGE_TYPE"/> <Enumeration description="Order Item Cancel" enumCode="ITM_CANCEL" enumId="ODR_ITM_CANCEL" sequenceId="02" enumTypeId="ODR_ITM_CHANGE_TYPE"/> + <Enumeration description="Order Item Append" enumCode="ITM_APPEND" enumId="ODR_ITM_APPEND" sequenceId="03" enumTypeId="ODR_ITM_CHANGE_TYPE"/> <EnumerationType description="Order Item Change Reason" enumTypeId="ODR_ITM_CH_REASON" hasTable="N" parentTypeId=""/> <Enumeration description="Mis-Ordered Item" enumCode="MISORDER" enumId="OICR_MISORDER_ITEM" sequenceId="01" enumTypeId="ODR_ITM_CH_REASON"/> - <Enumeration description="Customer Changed Mind" enumCode="CHANGE_MIND" enumId="OICR_CUST_CHMIND" sequenceId="02" enumTypeId="ODR_ITM_CH_REASON"/> + <Enumeration description="Changed Mind" enumCode="CHANGE_MIND" enumId="OICR_CHANGE_MIND" sequenceId="02" enumTypeId="ODR_ITM_CH_REASON"/> <QuoteType description="Other" hasTable="N" parentTypeId="" quoteTypeId="OTHER_QUOTE"/> <QuoteType description="Product" hasTable="N" parentTypeId="" quoteTypeId="PRODUCT_QUOTE"/> Modified: ofbiz/trunk/applications/order/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services.xml Mon May 19 16:13:02 2008 @@ -279,6 +279,8 @@ <attribute name="orderItemSeqId" type="String" mode="IN" optional="true"/> <attribute name="shipGroupSeqId" type="String" mode="IN" optional="true"/> <attribute name="cancelQuantity" type="Double" mode="IN" optional="true"/> + <attribute name="itemReasonMap" type="Map" mode="IN" string-map-prefix="irm_" optional="true"/> + <attribute name="itemCommentMap" type="Map" mode="IN" string-map-prefix="icm_" optional="true"/> </service> <service name="cancelOrderItemNoActions" engine="java" auth="true" location="org.ofbiz.order.order.OrderServices" invoke="cancelOrderItem"> @@ -297,6 +299,8 @@ <attribute name="itemQtyMap" type="Map" mode="IN" string-map-prefix="iqm_" optional="false"/> <attribute name="itemPriceMap" type="Map" mode="IN" string-map-prefix="ipm_" optional="false"/> <attribute name="overridePriceMap" type="Map" mode="IN" string-map-prefix="opm_" optional="false"/> + <attribute name="itemReasonMap" type="Map" mode="IN" string-map-prefix="irm_" optional="true"/> + <attribute name="itemCommentMap" type="Map" mode="IN" string-map-prefix="icm_" optional="true"/> <attribute name="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart" mode="OUT" optional="false"/> </service> @@ -311,6 +315,8 @@ <attribute name="quantity" type="Double" mode="IN" optional="false"/> <attribute name="amount" type="Double" mode="IN" optional="true"/> <attribute name="overridePrice" type="String" mode="IN" optional="true"/> + <attribute name="reasonEnumId" type="String" mode="IN" optional="true"/> + <attribute name="changeComments" type="String" mode="IN" optional="true"/> <attribute name="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart" mode="OUT" optional="false"/> </service> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Mon May 19 16:13:02 2008 @@ -1793,6 +1793,8 @@ String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); + Map itemReasonMap = (Map) context.get("itemReasonMap"); + Map itemCommentMap = (Map) context.get("itemCommentMap"); // debugging message info String itemMsgInfo = orderId + " / " + orderItemSeqId + " / " + shipGroupSeqId; @@ -1859,7 +1861,7 @@ if (availableQuantity.doubleValue() >= thisCancelQty.doubleValue()) { if (availableQuantity.doubleValue() == 0) { - return ServiceUtil.returnSuccess(); //item already canceled + continue; //OrderItemShipGroupAssoc already cancelled } orderItem.set("cancelQuantity", Double.valueOf(itemCancelQuantity.doubleValue() + thisCancelQty.doubleValue())); orderItemShipGroupAssoc.set("cancelQuantity", Double.valueOf(aisgaCancelQuantity.doubleValue() + thisCancelQty.doubleValue())); @@ -1873,26 +1875,39 @@ } // create order item change record - Map serviceCtx = FastMap.newInstance(); - serviceCtx.put("orderId", orderItem.getString("orderId")); - serviceCtx.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); - serviceCtx.put("cancelQuantity", thisCancelQty); - serviceCtx.put("changeTypeEnumId", "ODR_ITM_CANCEL"); - serviceCtx.put("userLogin", userLogin); - Map resp = null; - try { - resp = dispatcher.runSync("createOrderItemChange", serviceCtx); - } catch (GenericServiceException e) { - Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); - } - if (ServiceUtil.isError(resp)) { - return ServiceUtil.returnError((String)resp.get(ModelService.ERROR_MESSAGE)); - } + if (!"Y".equals(orderItem.getString("isPromo"))) { + String reasonEnumId = null; + String changeComments = null; + if (UtilValidate.isNotEmpty(itemReasonMap)) { + reasonEnumId = (String) itemReasonMap.get(orderItem.getString("orderItemSeqId")); + } + if (UtilValidate.isNotEmpty(itemCommentMap)) { + changeComments = (String) itemCommentMap.get(orderItem.getString("orderItemSeqId")); + } + + Map serviceCtx = FastMap.newInstance(); + serviceCtx.put("orderId", orderItem.getString("orderId")); + serviceCtx.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); + serviceCtx.put("cancelQuantity", thisCancelQty); + serviceCtx.put("changeTypeEnumId", "ODR_ITM_CANCEL"); + serviceCtx.put("reasonEnumId", reasonEnumId); + serviceCtx.put("changeComments", changeComments); + serviceCtx.put("userLogin", userLogin); + Map resp = null; + try { + resp = dispatcher.runSync("createOrderItemChange", serviceCtx); + } catch (GenericServiceException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); + } + if (ServiceUtil.isError(resp)) { + return ServiceUtil.returnError((String)resp.get(ModelService.ERROR_MESSAGE)); + } + } if (thisCancelQty.doubleValue() >= itemQuantity.doubleValue()) { // all items are cancelled -- mark the item as cancelled - Map statusCtx = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "statusId", "ITEM_CANCELLED", "userLogin", userLogin); + Map statusCtx = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.getString("orderItemSeqId"), "statusId", "ITEM_CANCELLED", "userLogin", userLogin); try { dispatcher.runSyncIgnore("changeOrderItemStatus", statusCtx); } catch (GenericServiceException e) { @@ -1901,7 +1916,7 @@ } } else { // reverse the inventory reservation - Map invCtx = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "shipGroupSeqId", + Map invCtx = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.getString("orderItemSeqId"), "shipGroupSeqId", shipGroupSeqId, "cancelQuantity", thisCancelQty, "userLogin", userLogin); try { dispatcher.runSyncIgnore("cancelOrderItemInvResQty", invCtx); @@ -3117,6 +3132,8 @@ Double quantity = (Double) context.get("quantity"); Double amount = (Double) context.get("amount"); String overridePrice = (String) context.get("overridePrice"); + String reasonEnumId = (String) context.get("reasonEnumId"); + String changeComments = (String) context.get("changeComments"); if (amount == null) { amount = new Double(0.00); @@ -3168,9 +3185,11 @@ return ServiceUtil.returnError(e.getMessage()); } + Map changeMap = UtilMisc.toMap("itemReasonMap", UtilMisc.toMap("reasonEnumId", reasonEnumId), + "itemCommentMap", UtilMisc.toMap("changeComments", changeComments)); // save all the updated information try { - saveUpdatedCartToOrder(dispatcher, delegator, cart, locale, userLogin, orderId); + saveUpdatedCartToOrder(dispatcher, delegator, cart, locale, userLogin, orderId, changeMap); } catch (GeneralException e) { return ServiceUtil.returnError(e.getMessage()); } @@ -3200,6 +3219,8 @@ Map itemDescriptionMap = (Map) context.get("itemDescriptionMap"); Map itemPriceMap = (Map) context.get("itemPriceMap"); Map itemQtyMap = (Map) context.get("itemQtyMap"); + Map itemReasonMap = (Map) context.get("itemReasonMap"); + Map itemCommentMap = (Map) context.get("itemCommentMap"); // obtain a shopping cart object for updating ShoppingCart cart = null; @@ -3335,7 +3356,7 @@ // save all the updated information try { - saveUpdatedCartToOrder(dispatcher, delegator, cart, locale, userLogin, orderId); + saveUpdatedCartToOrder(dispatcher, delegator, cart, locale, userLogin, orderId, UtilMisc.toMap("itemReasonMap", itemReasonMap, "itemCommentMap", itemCommentMap)); } catch (GeneralException e) { return ServiceUtil.returnError(e.getMessage()); } @@ -3519,7 +3540,7 @@ return cart; } - private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, GenericDelegator delegator, ShoppingCart cart, Locale locale, GenericValue userLogin, String orderId) throws GeneralException { + private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, GenericDelegator delegator, ShoppingCart cart, Locale locale, GenericValue userLogin, String orderId, Map changeMap) throws GeneralException { // get/set the shipping estimates. if it's a SALES ORDER, then return an error if there are no ship estimates int shipGroups = cart.getShipGroupSize(); for (int gi = 0; gi < shipGroups; gi++) { @@ -3555,7 +3576,7 @@ } // get the new orderItems, adjustments, shipping info and payments from the cart - List<GenericValue> modifiedItems = FastList.newInstance(); + List<Map> modifiedItems = FastList.newInstance(); List toStore = new LinkedList(); toStore.addAll(cart.makeOrderItems()); toStore.addAll(cart.makeAllAdjustments()); @@ -3594,6 +3615,11 @@ valueObj.set("statusId", "PAYMENT_NOT_RECEIVED"); } } else if ("OrderItem".equals(valueObj.getEntityName())) { + + // ignore promotion items. They are added/canceled automatically + if ("Y".equals(valueObj.getString("isPromo"))) { + continue; + } GenericValue oldOrderItem = null; try { oldOrderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", valueObj.getString("orderId"), "orderItemSeqId", valueObj.getString("orderItemSeqId"))); @@ -3609,30 +3635,62 @@ Double oldUnitPrice = oldOrderItem.getDouble("unitPrice") != null ? oldOrderItem.getDouble("unitPrice") : Double.valueOf(0.00); boolean changeFound = false; - if (oldItemDescription.equals(valueObj.getString("itemDescription"))) { - oldOrderItem.remove("itemDescription"); - } else { + Map modifiedItem = FastMap.newInstance(); + if (!oldItemDescription.equals(valueObj.getString("itemDescription"))) { + modifiedItem.put("itemDescription", oldItemDescription); changeFound = true; } Double quantityDif = Double.valueOf(valueObj.getDouble("quantity").doubleValue() - oldQuantity.doubleValue()); Double unitPriceDif = Double.valueOf(valueObj.getDouble("unitPrice").doubleValue() - oldUnitPrice.doubleValue()); - if (quantityDif.doubleValue() == 0) { - oldOrderItem.remove("quantity"); - } else { - oldOrderItem.set("quantity", quantityDif); + if (quantityDif.doubleValue() != 0) { + modifiedItem.put("quantity", quantityDif); changeFound = true; } - if (unitPriceDif.doubleValue() == 0) { - oldOrderItem.remove("unitPrice"); - } else { - oldOrderItem.set("unitPrice", unitPriceDif); + if (unitPriceDif.doubleValue() != 0) { + modifiedItem.put("unitPrice", unitPriceDif); changeFound = true; } if (changeFound) { - modifiedItems.add(oldOrderItem); + + // found changes to store + Map itemReasonMap = (Map) changeMap.get("itemReasonMap"); + Map itemCommentMap = (Map) changeMap.get("itemCommentMap"); + if (UtilValidate.isNotEmpty(itemReasonMap)) { + String changeReasonId = (String) itemReasonMap.get(valueObj.getString("orderItemSeqId")); + modifiedItem.put("reasonEnumId", changeReasonId); + } + if (UtilValidate.isNotEmpty(itemCommentMap)) { + String changeComments = (String) itemCommentMap.get(valueObj.getString("orderItemSeqId")); + modifiedItem.put("changeComments", changeComments); + } + + modifiedItem.put("orderId", valueObj.getString("orderId")); + modifiedItem.put("orderItemSeqId", valueObj.getString("orderItemSeqId")); + modifiedItem.put("changeTypeEnumId", "ODR_ITM_UPDATE"); + modifiedItems.add(modifiedItem); } - } + } else { + + // this is a new item appended to the order + Map itemReasonMap = (Map) changeMap.get("itemReasonMap"); + Map itemCommentMap = (Map) changeMap.get("itemCommentMap"); + Map appendedItem = FastMap.newInstance(); + if (UtilValidate.isNotEmpty(itemReasonMap)) { + String changeReasonId = (String) itemReasonMap.get("reasonEnumId"); + appendedItem.put("reasonEnumId", changeReasonId); + } + if (UtilValidate.isNotEmpty(itemCommentMap)) { + String changeComments = (String) itemCommentMap.get("changeComments"); + appendedItem.put("changeComments", changeComments); + } + + appendedItem.put("orderId", valueObj.getString("orderId")); + appendedItem.put("orderItemSeqId", valueObj.getString("orderItemSeqId")); + appendedItem.put("quantity", valueObj.getDouble("quantity")); + appendedItem.put("changeTypeEnumId", "ODR_ITM_APPEND"); + modifiedItems.add(appendedItem); + } } } Debug.log("To Store Contains: " + toStore, module); @@ -3645,16 +3703,18 @@ throw new GeneralException(e.getMessage()); } - //store the orderItem changes + // store the OrderItemChange if (UtilValidate.isNotEmpty(modifiedItems)) { - for (GenericValue oldItemValues : modifiedItems) { + for (Map modifiendItem: modifiedItems) { Map serviceCtx = FastMap.newInstance(); - serviceCtx.put("orderId", oldItemValues.getString("orderId")); - serviceCtx.put("orderItemSeqId", oldItemValues.getString("orderItemSeqId")); - serviceCtx.put("itemDescription", oldItemValues.getString("itemDescription")); - serviceCtx.put("quantity", oldItemValues.getDouble("quantity")); - serviceCtx.put("unitPrice", oldItemValues.getDouble("unitPrice")); - serviceCtx.put("changeTypeEnumId", "ODR_ITM_UPDATE"); + serviceCtx.put("orderId", modifiendItem.get("orderId")); + serviceCtx.put("orderItemSeqId", modifiendItem.get("orderItemSeqId")); + serviceCtx.put("itemDescription", modifiendItem.get("itemDescription")); + serviceCtx.put("quantity", modifiendItem.get("quantity")); + serviceCtx.put("unitPrice", modifiendItem.get("unitPrice")); + serviceCtx.put("changeTypeEnumId", modifiendItem.get("changeTypeEnumId")); + serviceCtx.put("reasonEnumId", modifiendItem.get("reasonEnumId")); + serviceCtx.put("changeComments", modifiendItem.get("changeComments")); serviceCtx.put("userLogin", userLogin); Map resp = null; try { Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Mon May 19 16:13:02 2008 @@ -212,6 +212,9 @@ cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId); context.put("orderContactMechValueMaps", cmvm); + + orderItemChangeReasons = delegator.findByAnd("Enumeration", UtilMisc.toMap("enumTypeId", "ODR_ITM_CH_REASON"), UtilMisc.toList("sequenceId")); + context.put("orderItemChangeReasons", orderItemChangeReasons); if ("PURCHASE_ORDER".equals(orderType)) { // for purchase orders, we need also the supplier's postal address Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/appendorderitem.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/appendorderitem.ftl?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/appendorderitem.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/appendorderitem.ftl Mon May 19 16:13:02 2008 @@ -27,7 +27,14 @@ </div> <div class="screenlet-body"> <form method="post" action="<@ofbizUrl>appendItemToOrder?${paramString}</@ofbizUrl>" name="appendItemForm"> + <#if catalogCol?size == 1> + <input type="hidden" name="prodCatalogId" value="${catalogCol.first}"/> + </#if> + <#if shipGroups?size == 1> + <input type="hidden" name="shipGroupSeqId" value="${shipGroups.first.shipGroupSeqId}"/> + </#if> <table class="basic-table" cellspacing="0"> + <#if (catalogCol?size > 1)> <tr> <td class="label">${uiLabelMap.ProductChooseCatalog}</td> <td><select name='prodCatalogId'> @@ -38,6 +45,7 @@ </select> </td> </tr> + </#if> <tr> <td class="label">${uiLabelMap.ProductProductId}</td> <td><input type="text" size="25" name="productId" value="${requestParameters.productId?if_exists}"/> @@ -57,13 +65,17 @@ <td class="label">${uiLabelMap.OrderQuantity}</td> <td><input type="text" size="6" name="quantity" value="${requestParameters.quantity?default("1")}"/></td> </tr> + <#if (shipGroups?size > 1)> <tr> <td class="label">${uiLabelMap.OrderShipGroup}</td> - <td><input type="text" size="6" name="shipGroupSeqId" value="00001"/></td> - </tr> - <tr> - <td colspan="2"> </td> - </tr> + <td><select name="shipGroupSeqId"> + <#list shipGroups as shipGroup> + <option value="${shipGroup.shipGroupSeqId}">${shipGroup.shipGroupSeqId}</option> + </#list> + </select> + </td> + </tr> + </#if> <tr> <td class="label">${uiLabelMap.OrderDesiredDeliveryDate}</td> <td> @@ -72,9 +84,20 @@ </td> </tr> <tr> + <td class="label">${uiLabelMap.OrderReturnReason}</td> + <td> + <select name="reasonEnumId"> + <option value=""> </option> + <#list orderItemChangeReasons as reason> + <option value="${reason.enumId}">${reason.get("description",locale)?default(reason.enumId)}</option> + </#list> + </select> + </td> + </tr> + <tr> <td class="label">${uiLabelMap.CommonComment}</td> <td> - <input type="text" size="25" name="itemComment"/> + <input type="text" size="25" name="changeComments"/> </td> </tr> <tr> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=658036&r1=658035&r2=658036&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl Mon May 19 16:13:02 2008 @@ -41,7 +41,7 @@ <li class="h3"> ${uiLabelMap.OrderOrderItems}</li> <#if security.hasEntityPermission("ORDERMGR", "_UPDATE", session) || security.hasRolePermission("ORDERMGR", "_UPDATE", "", "", session)> <#if orderHeader?has_content && orderHeader.statusId != "ORDER_CANCELLED" && orderHeader.statusId != "ORDER_COMPLETED"> - <li><a href="<@ofbizUrl>cancelOrderItem?${paramString}</@ofbizUrl>">${uiLabelMap.OrderCancelAllItems}</a></li> + <li><a href="javascript:document.updateItemInfo.action='<@ofbizUrl>cancelOrderItem?${paramString}</@ofbizUrl>';document.updateItemInfo.submit()">${uiLabelMap.OrderCancelAllItems}</a></li> <li><a href="<@ofbizUrl>orderview?${paramString}</@ofbizUrl>">${uiLabelMap.OrderViewOrder}</a></li> </#if> </#if> @@ -161,15 +161,28 @@ </td> <td> </td> <td> - <#if (security.hasEntityPermission("ORDERMGR", "_ADMIN", session) && orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED") || (security.hasEntityPermission("ORDERMGR", "_UPDATE", session) && orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED" && orderHeader.statusId != "ORDER_SENT")> - <a href="<@ofbizUrl>cancelOrderItem?orderItemSeqId=${orderItem.orderItemSeqId}&${paramString}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonCancelAll}</a> - <#else> + <#if ("Y" != orderItem.isPromo?if_exists) && ((security.hasEntityPermission("ORDERMGR", "_ADMIN", session) && orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED") || (security.hasEntityPermission("ORDERMGR", "_UPDATE", session) && orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED" && orderHeader.statusId != "ORDER_SENT"))> + <a href="javascript:document.updateItemInfo.action='<@ofbizUrl>cancelOrderItem?orderItemSeqId=${orderItem.orderItemSeqId}&${paramString}</@ofbizUrl>';document.updateItemInfo.submit()" class="buttontext">${uiLabelMap.CommonCancelAll}</a> + <#else> </#if> </td> </#if> </tr> + <#-- now update/cancel reason and comment field --> + <#if orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED" && ("Y" != orderItem.isPromo?if_exists)> + <tr><td colspan="8"><span class="label">${uiLabelMap.OrderReturnReason}</span> + <select name="irm_${orderItem.orderItemSeqId}"> + <option value=""> </option> + <#list orderItemChangeReasons as reason> + <option value="${reason.enumId}">${reason.get("description",locale)?default(reason.enumId)}</option> + </#list> + </select> + <span class="label">${uiLabelMap.CommonComments}</span> + <input type="text" name="icm_${orderItem.orderItemSeqId}" value="" size="30" maxlength="60"/> + </tr> + </#if> <#-- now show adjustment details per line item --> <#assign orderItemAdjustments = Static["org.ofbiz.order.order.OrderReadHelper"].getOrderItemAdjustmentList(orderItem, orderAdjustments)> <#if orderItemAdjustments?exists && orderItemAdjustments?has_content> @@ -220,10 +233,10 @@ </td> <td colspan="4"> </td> <td> - <#assign itemStatusOkay = (orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED" && (shipGroupAssoc.cancelQuantity?default(0) < shipGroupAssoc.quantity?default(0)))> + <#assign itemStatusOkay = (orderItem.statusId != "ITEM_CANCELLED" && orderItem.statusId != "ITEM_COMPLETED" && (shipGroupAssoc.cancelQuantity?default(0) < shipGroupAssoc.quantity?default(0)) && ("Y" != orderItem.isPromo?if_exists))> <#if (security.hasEntityPermission("ORDERMGR", "_ADMIN", session) && itemStatusOkay) || (security.hasEntityPermission("ORDERMGR", "_UPDATE", session) && itemStatusOkay && orderHeader.statusId != "ORDER_SENT")> - <a href="<@ofbizUrl>cancelOrderItem?orderItemSeqId=${orderItem.orderItemSeqId}&shipGroupSeqId=${shipGroup.shipGroupSeqId}&${paramString}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonCancel}</a> - <#else> + <a href="javascript:document.updateItemInfo.action='<@ofbizUrl>cancelOrderItem?orderItemSeqId=${orderItem.orderItemSeqId}&shipGroupSeqId=${shipGroup.shipGroupSeqId}&${paramString}</@ofbizUrl>';document.updateItemInfo.submit()" class="buttontext">${uiLabelMap.CommonCancel}</a> + <#else> </#if> </td> |
Free forum by Nabble | Edit this page |