Author: jleroux
Date: Mon Mar 16 21:34:50 2009 New Revision: 755011 URL: http://svn.apache.org/viewvc?rev=755011&view=rev Log: A patch from Divesh Dutta " Functionality for putting in estimatedShipDate and estimatedDeliveryDate for order items." (https://issues.apache.org/jira/browse/OFBIZ-2239) - OFBIZ-2239 Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml ofbiz/trunk/applications/order/servicedef/services.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?rev=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Mon Mar 16 21:34:50 2009 @@ -805,6 +805,8 @@ <field name="isGift" type="indicator"></field> <field name="shipAfterDate" type="date-time"></field> <field name="shipByDate" type="date-time"></field> + <field name="estimatedShipDate" type="date-time"></field> + <field name="estimatedDeliveryDate" type="date-time"></field> <prim-key field="orderId"/> <prim-key field="shipGroupSeqId"/> <relation type="one" fk-name="ORDER_ITSG_ORDH" rel-entity-name="OrderHeader"> Modified: ofbiz/trunk/applications/order/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services.xml Mon Mar 16 21:34:50 2009 @@ -305,6 +305,8 @@ <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="itemAttributesMap" type="Map" mode="IN" string-map-prefix="iam_" optional="true"/> + <attribute name="itemShipDateMap" type="Map" mode="IN" string-map-prefix="isdm_" optional="true"/> + <attribute name="itemDeliveryDateMap" type="Map" mode="IN" string-map-prefix="iddm_" optional="true"/> <attribute name="shoppingCart" type="org.ofbiz.order.shoppingcart.ShoppingCart" mode="OUT" optional="false"/> </service> <service name="loadCartForUpdate" engine="java" auth="true" 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=755011&r1=755010&r2=755011&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 Mar 16 21:34:50 2009 @@ -3388,7 +3388,9 @@ Map itemReasonMap = (Map) context.get("itemReasonMap"); Map itemCommentMap = (Map) context.get("itemCommentMap"); Map itemAttributesMap = (Map) context.get("itemAttributesMap"); - + Map<String,String> itemEstimatedShipDateMap = (Map) context.get("itemShipDateMap"); + Map<String, String> itemEstimatedDeliveryDateMap = (Map) context.get("itemDeliveryDateMap"); + // obtain a shopping cart object for updating ShoppingCart cart = null; try { @@ -3497,7 +3499,29 @@ Debug.logInfo("Unable to locate shopping cart item for seqId #" + itemSeqId, module); } } - + // Create Estimated Delivery dates + for (Map.Entry<String, String> entry : itemEstimatedDeliveryDateMap.entrySet()) { + String itemSeqId = entry.getKey(); + String estimatedDeliveryDate = entry.getValue(); + Timestamp shipDate = Timestamp.valueOf(estimatedDeliveryDate); + if (estimatedDeliveryDate != null) { + ShoppingCartItem cartItem = cart.findCartItem(itemSeqId); + cartItem.setDesiredDeliveryDate(shipDate); + } + } + + // Create Estimated ship dates + for (Map.Entry<String, String> entry : itemEstimatedShipDateMap.entrySet()) { + String itemSeqId = entry.getKey(); + String estimatedShipDate = entry.getValue(); + Timestamp deliveryDate = Timestamp.valueOf(estimatedShipDate); + if (estimatedShipDate != null) { + ShoppingCartItem cartItem = cart.findCartItem(itemSeqId); + cartItem.setEstimatedShipDate(deliveryDate); + } + + } + // update the group amounts Iterator gai = itemQtyMap.keySet().iterator(); while (gai.hasNext()) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Mon Mar 16 21:34:50 2009 @@ -3446,6 +3446,7 @@ orderItem.set("shipBeforeDate", item.getShipBeforeDate()); orderItem.set("shipAfterDate", item.getShipAfterDate()); + orderItem.set("estimatedShipDate", item.getEstimatedShipDate()); String fromInventoryItemId = (String) item.getAttribute("fromInventoryItemId"); if (fromInventoryItemId != null) { @@ -4257,8 +4258,8 @@ } public static class CartShipInfo implements Serializable { - public LinkedHashMap shipItemInfo = new LinkedHashMap(); - public List shipTaxAdj = new LinkedList(); + public Map<Object, Object> shipItemInfo = FastMap.newInstance(); + public List<GenericValue> shipTaxAdj = FastList.newInstance(); public String orderTypeId = null; private String internalContactMechId = null; public String shipmentMethodTypeId = null; @@ -4337,6 +4338,36 @@ values.add(shipGroup); + //set estimated ship dates + FastList estimatedShipDates = FastList.newInstance(); + for (Map.Entry<Object, Object> entry : shipItemInfo.entrySet()) { + ShoppingCartItem item = (ShoppingCartItem) entry.getKey(); + Timestamp estimatedShipDate = item.getEstimatedShipDate(); + if (estimatedShipDate != null) { + estimatedShipDates.add(estimatedShipDate); + } + } + if (estimatedShipDates.size() > 0) { + Collections.sort(estimatedShipDates); + Timestamp estimatedShipDate = (Timestamp) estimatedShipDates.getLast(); + shipGroup.set("estimatedShipDate", estimatedShipDate); + } + + //set estimated delivery dates + FastList estimatedDeliveryDates = FastList.newInstance(); + for (Map.Entry <Object, Object> entry : shipItemInfo.entrySet()) { + ShoppingCartItem item = (ShoppingCartItem) entry.getKey(); + Timestamp estimatedDeliveryDate = item.getDesiredDeliveryDate(); + if (estimatedDeliveryDate != null) { + estimatedDeliveryDates.add(estimatedDeliveryDate); + } + } + if (UtilValidate.isNotEmpty(estimatedDeliveryDates)) { + Collections.sort(estimatedDeliveryDates); + Timestamp estimatedDeliveryDate = (Timestamp) estimatedDeliveryDates.getLast(); + shipGroup.set("estimatedDeliveryDate", estimatedDeliveryDate); + } + // create the shipping estimate adjustments if (shipEstimate.compareTo(BigDecimal.ZERO) != 0) { GenericValue shipAdj = delegator.makeValue("OrderAdjustment"); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Mon Mar 16 21:34:50 2009 @@ -131,7 +131,8 @@ private Locale locale = null; private Timestamp shipBeforeDate = null; private Timestamp shipAfterDate = null; - + private Timestamp EstimatedShipDate = null; + private Map contactMechIdsMap = FastMap.newInstance(); private List orderItemPriceInfos = null; private List itemAdjustments = new LinkedList(); @@ -1445,6 +1446,16 @@ public Timestamp getShipAfterDate() { return this.shipAfterDate; } + + /** Sets the date to EstimatedShipDate */ + public void setEstimatedShipDate(Timestamp date) { + this.EstimatedShipDate = date; + } + + /** Returns the date to EstimatedShipDate */ + public Timestamp getEstimatedShipDate() { + return this.EstimatedShipDate; + } /** Sets the item type. */ public void setItemType(String itemType) { 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=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl Mon Mar 16 21:34:50 2009 @@ -186,6 +186,12 @@ </select> <span class="label">${uiLabelMap.CommonComments}</span> <input type="text" name="icm_${orderItem.orderItemSeqId}" value="" size="30" maxlength="60"/> + <span class="label">${uiLabelMap.OrderEstimatedShipDate}</span> + <input type="text" name="isdm_${orderItem.orderItemSeqId}" value="${orderItem.estimatedShipDate?if_exists}" size="25" maxlength="30"/> + <a href="javascript:call_cal(document.updateItemInfo.isdm_${orderItem.orderItemSeqId},'${toDayDate} 00:00:00.0');"><img src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" height="16" border="0" alt="${uiLabelMap.OrderCalendarClickHereForCalendar}"/></a> + <span class="label">${uiLabelMap.OrderOrderQuoteEstimatedDeliveryDate}</span> + <input type="text" name="iddm_${orderItem.orderItemSeqId}" value="${orderItem.estimatedDeliveryDate?if_exists}" size="25" maxlength="30"/> + <a href="javascript:call_cal(document.updateItemInfo.iddm_${orderItem.orderItemSeqId},'${toDayDate} 00:00:00.0');"><img src="<@ofbizContentUrl>/images/cal.gif</@ofbizContentUrl>" width="16" height="16" border="0" alt="${uiLabelMap.OrderCalendarClickHereForCalendar}"/></a> </tr> </#if> <#-- now show adjustment details per line item --> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?rev=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Mon Mar 16 21:34:50 2009 @@ -393,10 +393,18 @@ </#if> <#-- display the ship estimated/before/after dates --> + <#if orderItem.estimatedShipDate?exists> + <tr> + <td align="right" colspan="2"> + <div><span class="label">${uiLabelMap.OrderEstimatedShipDate}</span> ${orderItem.estimatedShipDate?string.short}</div> + </td> + <td colspan="5"> </td> + </tr> + </#if> <#if orderItem.estimatedDeliveryDate?exists> <tr> <td align="right" colspan="2"> - <div><span class="label">${uiLabelMap.OrderDesiredDeliveryDate}</span> ${orderItem.estimatedDeliveryDate?string.short}</div> + <div><span class="label">${uiLabelMap.OrderOrderQuoteEstimatedDeliveryDate}</span> ${orderItem.estimatedDeliveryDate?string.short}</div> </td> <td colspan="5"> </td> </tr> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl?rev=755011&r1=755010&r2=755011&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl Mon Mar 16 21:34:50 2009 @@ -352,6 +352,8 @@ <input type="hidden" name="shipmentTypeId" value="PURCHASE_SHIPMENT"/> <input type="hidden" name="statusId" value="PURCH_SHIP_CREATED"/> <input type="hidden" name="externalLoginKey" value="${externalLoginKey}"/> + <input type="hidden" name="estimatedShipDate" value="${shipGroup.estimatedShipDate?if_exists}"/> + <input type="hidden" name="estimatedArrivalDate" value="${shipGroup.estimatedDeliveryDate?if_exists}"/> <select name="destinationFacilityId"> <#list facilities as facility> <option value="${facility.facilityId}">${facility.facilityName}</option> |
Free forum by Nabble | Edit this page |