You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/10/31 19:24:32 UTC
svn commit: r590775 - in /ofbiz/trunk/applications/product:
data/ApiSchemaDhl.xml src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
Author: sichen
Date: Wed Oct 31 11:24:31 2007
New Revision: 590775
URL: http://svn.apache.org/viewvc?rev=590775&view=rev
Log:
add support for email address on dhl shipping labels
Modified:
ofbiz/trunk/applications/product/data/ApiSchemaDhl.xml
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
Modified: ofbiz/trunk/applications/product/data/ApiSchemaDhl.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ApiSchemaDhl.xml?rev=590775&r1=590774&r2=590775&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ApiSchemaDhl.xml (original)
+++ ofbiz/trunk/applications/product/data/ApiSchemaDhl.xml Wed Oct 31 11:24:31 2007
@@ -81,13 +81,16 @@
<#if overrideCode?exists>
<Overrides><Override><Code>${overrideCode}</Code></Override></Overrides>
</#if>
- <#if notifyEmailMessage?exists>
+ <#if notifyEmailAddress?exists>
<Notification>
<Notify>
<!-- TODO: up to 42 of these -->
<EmailAddress>${notifyEmailAddress?if_exists}</EmailAddress>
</Notify>
- <Message>${notifyEmailMessage?if_exists}</Message> <!-- CDATA -->
+ <#if notifyEmailMessage?has_content>
+ <!-- CDATA here -->
+ <Message>${notifyEmailMessage}</Message>
+ </#if>
</Notification>
</#if>
</ShipmentProcessingInstructions>
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=590775&r1=590774&r2=590775&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Wed Oct 31 11:24:31 2007
@@ -499,6 +499,7 @@
LocalDispatcher dispatcher = dctx.getDispatcher();
Locale locale = (Locale) context.get("locale");
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
String shipmentId = (String) context.get("shipmentId");
String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
Map result = new HashMap();
@@ -564,6 +565,12 @@
destPhoneNumber = StringUtil.replaceString(destPhoneNumber, " ", "");
}
+ String recipientEmail = null;
+ Map results = dispatcher.runSync("getPartyEmail", UtilMisc.toMap("partyId", shipment.get("partyIdTo"), "userLogin", userLogin));
+ if (results.get("emailAddress") != null) {
+ recipientEmail = (String) results.get("emailAddress");
+ }
+
// lookup the two letter country code (in the geoCode field)
GenericValue destCountryGeo = destPostalAddress.getRelatedOne("CountryGeo");
if (destCountryGeo == null) {
@@ -723,7 +730,8 @@
inContext.put("phoneNbr", destPhoneNumber);
inContext.put("labelImageType", labelImagePreference);
inContext.put("shipperReference", shipment.getString("primaryOrderId") + "-" + shipment.getString("primaryShipGroupSeqId"));
-
+ inContext.put("notifyEmailAddress", recipientEmail);
+
try {
ContentWorker.renderContentAsText(dispatcher, delegator, templateName, outWriter, inContext, locale, "text/plain", false);
} catch (Exception e) {
@@ -749,7 +757,6 @@
}
// pass to handler method
return handleDhlShipmentConfirmResponse(responseString, shipmentRouteSegment, shipmentPackageRouteSegs);
-
} catch (GenericEntityException e) {
Debug.logError(e, module);
if (shipmentConfirmResponseString != null) {