Author: jleroux
Date: Sat Jul 7 06:26:45 2007 New Revision: 554200 URL: http://svn.apache.org/viewvc?view=rev&rev=554200 Log: A patch from Ashish Vijaywargiya "Email Notification on Shipment SHIPPED" (https://issues.apache.org/jira/browse/OFBIZ-1076) Added: ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl (with props) ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh (with props) Modified: ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml ofbiz/trunk/applications/order/servicedef/services.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/product/data/ProductTypeData.xml ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml ofbiz/trunk/applications/product/servicedef/secas_shipment.xml ofbiz/trunk/applications/product/servicedef/services_shipment.xml Modified: ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties (original) +++ ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties Sat Jul 7 06:26:45 2007 @@ -525,6 +525,7 @@ PageTitleSearchResults=Search Results PageTitleSearchSites=Search Sites PageTitleSentMessages=Sent Messages +PageTitleOrderShipmentCompleteNotice=Shipment Complete Notice PageTitleShippingInformation=Shipping Information PageTitleShippingOptions=Shipping Options PageTitleShoppingCart=Shopping Cart @@ -710,4 +711,4 @@ ProductUsuallyShipsIn=Usually ships in ProductYouSearchedFor=you searched for RequestHistory=Request History -QuoteHistory=Quote History +QuoteHistory=Quote History \ No newline at end of file Modified: ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml (original) +++ ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml Sat Jul 7 06:26:45 2007 @@ -72,6 +72,7 @@ <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_ODR_BACKORDER" bodyScreenLocation="component://ecommerce/widget/EmailOrderScreens.xml#BackorderNotice" subject="OFBiz Demo - Backorder Notification #${orderId}" fromAddress="[hidden email]"/> <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_ODR_CHANGE" bodyScreenLocation="component://ecommerce/widget/EmailOrderScreens.xml#OrderChangeNotice" subject="OFBiz Demo - Order Change Notification #${orderId}" fromAddress="[hidden email]"/> <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_ODR_PAYRETRY" bodyScreenLocation="component://ecommerce/widget/EmailOrderScreens.xml#PaymentRetryNotice" subject="OFBiz Demo - Order Payment Notification #${orderId}" fromAddress="[hidden email]"/> + <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_ODR_SHIP_COMPLT" bodyScreenLocation="component://ecommerce/widget/EmailOrderScreens.xml#ShipmentCompleteNotice" subject="OFBiz Demo - Shipment Complete Notification #${orderId}" fromAddress="[hidden email]"/> <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_RTN_ACCEPT" bodyScreenLocation="component://ecommerce/widget/EmailReturnScreens.xml#ReturnAccept" subject="OFBiz Demo - Return Accepted #${returnHeader.returnId}" fromAddress="[hidden email]"/> <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_RTN_COMPLETE" bodyScreenLocation="component://ecommerce/widget/EmailReturnScreens.xml#ReturnComplete" subject="OFBiz Demo - Return Completed #${returnHeader.returnId}" fromAddress="[hidden email]"/> Added: ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl?view=auto&rev=554200 ============================================================================== --- ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl (added) +++ ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl Sat Jul 7 06:26:45 2007 @@ -0,0 +1,64 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + + +<table cellpadding="0" cellspacing="0" width="80%" border="0" class="boxoutside"> + <tr> + <td colspan="3" class="tableheadtext"> + This email is to inform you that your shipment has been completed. + </td> + </tr> + <tr><td colspan="3"> </td></tr> + <#if orderItemShipGroups?has_content> + <tr> + <td colspan="3"> + <h3>${uiLabelMap.OrderShippingInformation}</h3> + </td> + </tr> + <#assign groupIdx = 0> + <#list orderItemShipGroups as shipGroup> + <#-- tracking number --> + <#if trackingNumber?has_content || orderShipmentInfoSummaryList?has_content> + <tr> + <td align="right" valign="top" width="15%" nowrap> + <div class="tabletext"> <b>${uiLabelMap.OrderTrackingNumber}</b></div> + </td> + <td width="5"> </td> + <td align="left" valign="top" width="80%"> + <#-- TODO: add links to UPS/FEDEX/etc based on carrier partyId --> + <#if shipGroup.trackingNumber?has_content> + <div class="tabletext">${shipGroup.trackingNumber}</div> + </#if> + <#if orderShipmentInfoSummaryList?has_content> + <#list orderShipmentInfoSummaryList as orderShipmentInfoSummary> + <div class="tabletext"> + <#if (orderShipmentInfoSummaryList?size > 1)>${orderShipmentInfoSummary.shipmentPackageSeqId}: </#if> + Code: ${orderShipmentInfoSummary.trackingCode?default("[Not Yet Known]")} + <#if orderShipmentInfoSummary.boxNumber?has_content>${uiLabelMap.OrderBoxNubmer}${orderShipmentInfoSummary.boxNumber}</#if> + <#if orderShipmentInfoSummary.carrierPartyId?has_content>(${uiLabelMap.ProductCarrier}: ${orderShipmentInfoSummary.carrierPartyId})</#if> + </div> + </#list> + </#if> + </td> + </tr> + </#if> + <#assign groupIdx = groupIdx + 1> + </#list> + </#if> +</table> \ No newline at end of file Propchange: ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/ecommerce/templates/email/ShipmentNotificationEmail.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh?view=auto&rev=554200 ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh (added) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh Sat Jul 7 06:26:45 2007 @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.*; +import org.ofbiz.entity.*; +import org.ofbiz.entity.condition.*; +import org.ofbiz.entity.util.*; +import org.ofbiz.order.order.OrderReadHelper; + + +orderId = parameters.get("orderId"); + +if(orderId != null) { + orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + orderReadHelper = new OrderReadHelper(orderHeader); + orderItemShipGroups = orderReadHelper.getOrderItemShipGroups(); + context.put("orderItemShipGroups", orderItemShipGroups); + + osisCond = new EntityFieldMap(UtilMisc.toMap("orderId", orderId), EntityOperator.AND); + osisOrder = UtilMisc.toList("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId"); + osisFields = UtilMisc.toList("shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId"); + osisFields.add("shipmentPackageSeqId"); + osisFields.add("trackingCode"); + osisFields.add("boxNumber"); + osisFindOptions = new EntityFindOptions(); osisFindOptions.setDistinct(true); + orderShipmentInfoSummaryList = delegator.findByCondition("OrderShipmentInfoSummary", osisCond, null, osisFields, osisOrder, osisFindOptions); + context.put("orderShipmentInfoSummaryList",orderShipmentInfoSummaryList); +} Propchange: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml (original) +++ ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml Sat Jul 7 06:26:45 2007 @@ -146,4 +146,16 @@ </widgets> </section> </screen> + <screen name="ShipmentCompleteNotice"> + <section> + <actions> + <set field="title" value="${uiLabelMap.PageTitleOrderShipmentCompleteNotice}"/> + <set field="baseEcommerceSecureUrl" value="${baseSecureUrl}/ecommerce/control/"/> + <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/order/shipmentstatus.bsh"/> + </actions> + <widgets> + <platform-specific><html><html-template location="component://ecommerce/templates/email/ShipmentNotificationEmail.ftl"/></html></platform-specific> + </widgets> + </section> + </screen> </screens> Modified: ofbiz/trunk/applications/order/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services.xml Sat Jul 7 06:26:45 2007 @@ -759,5 +759,10 @@ <attribute name="orderList" type="List" mode="OUT" optional="false"/> <attribute name="orderListSize" type="Integer" mode="OUT" optional="false"/> </service> - + + <service name="sendShipCompleteNotification" engine="java" require-new-transaction="true" max-retry="3" + location="org.ofbiz.order.order.OrderServices" invoke="sendShipCompleteNotification"> + <description>Send a Shipment complete notification</description> + <implements service="orderNotificationInterface"/> + </service> </services> 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?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sat Jul 7 06:26:45 2007 @@ -2080,18 +2080,20 @@ public static Map sendOrderPayRetryNotification(DispatchContext ctx, Map context) { return sendOrderNotificationScreen(ctx, context, "PRDS_ODR_PAYRETRY"); } - + + public static Map sendShipCompleteNotification(DispatchContext ctx, Map context) { + return sendOrderNotificationScreen(ctx, context, "PRDS_ODR_SHIP_COMPLT"); + } protected static Map sendOrderNotificationScreen(DispatchContext dctx, Map context, String emailType) { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); - String orderId = (String) context.get("orderId"); + String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); String sendTo = (String) context.get("sendTo"); String sendCc = (String) context.get("sendCc"); String note = (String) context.get("note"); - String screenUri = (String) context.get("screenUri"); - + String screenUri = (String) context.get("screenUri"); GenericValue temporaryAnonymousUserLogin = (GenericValue) context.get("temporaryAnonymousUserLogin"); if (userLogin == null) { // this may happen during anonymous checkout, try to the special case user Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Sat Jul 7 06:26:45 2007 @@ -100,6 +100,7 @@ <Enumeration description="Gift-Card Purchase" enumCode="GC_PURCHASE" enumId="PRDS_GC_PURCHASE" enumTypeId="PRDS_EMAIL" sequenceId="12"/> <Enumeration description="Gift-Card Reload" enumCode="GC_RELOAD" enumId="PRDS_GC_RELOAD" enumTypeId="PRDS_EMAIL" sequenceId="13"/> <Enumeration description="Quote Confirmation" enumCode="QUO_CONFIRM" enumId="PRDS_QUO_CONFIRM" enumTypeId="PRDS_EMAIL" sequenceId="14"/> + <Enumeration description="Shipment Complete" enumCode="SHP_COMPLETE" enumId="PRDS_ODR_SHIP_COMPLT" enumTypeId="PRDS_EMAIL" sequenceId="15"/> <EnumerationType description="Facility Location Type" enumTypeId="FACLOC_TYPE" hasTable="N" parentTypeId=""/> <Enumeration description="Pick/Primary" enumCode="PICKLOC" enumId="FLT_PICKLOC" enumTypeId="FACLOC_TYPE" sequenceId="01"/> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Sat Jul 7 06:26:45 2007 @@ -1323,6 +1323,7 @@ <!-- update the shipment status to shipped --> <set from-field="shipment.shipmentId" field="packedContext.shipmentId"/> <set value="SHIPMENT_SHIPPED" field="packedContext.statusId"/> + <set field="packedContext.orderId" from-field="orderHeader.orderId"/> <call-service service-name="updateShipment" in-map-name="packedContext"/> </then> <else> <!-- PURCHASE_ORDER --> Modified: ofbiz/trunk/applications/product/servicedef/secas_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/secas_shipment.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/product/servicedef/secas_shipment.xml (original) +++ ofbiz/trunk/applications/product/servicedef/secas_shipment.xml Sat Jul 7 06:26:45 2007 @@ -27,6 +27,12 @@ <condition field-name="shipmentTypeId" operator="equals" value="SALES_SHIPMENT"/> <action service="createInvoicesFromShipment" mode="sync" run-as-user="system"/> </eca> + <eca service="updateShipment" event="commit"> + <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/> + <condition field-name="statusId" operator="equals" value="SHIPMENT_SHIPPED"/> + <condition field-name="shipmentTypeId" operator="equals" value="SALES_SHIPMENT"/> + <action service="sendShipCompleteNotification" mode="async" persist="true"/> + </eca> <!-- if new statusId of a PURCHASE_SHIPMENT is PURCH_SHIP_RECEIVED, create invoice --> <eca service="updateShipment" event="commit"> Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?view=diff&rev=554200&r1=554199&r2=554200 ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Sat Jul 7 06:26:45 2007 @@ -136,6 +136,7 @@ <attribute name="oldPrimaryOrderId" type="String" mode="OUT" optional="true"/> <attribute name="oldOriginFacilityId" type="String" mode="OUT" optional="true"/> <attribute name="oldDestinationFacilityId" type="String" mode="OUT" optional="true"/> + <attribute name="orderId" type="String" mode="IN" optional="true"/> </service> <service name="deleteShipment" default-entity-name="Shipment" engine="simple" location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="deleteShipment" auth="true"> |
Free forum by Nabble | Edit this page |