svn commit: r759254 [3/4] - in /ofbiz/trunk/applications/product/src: ./ org/ofbiz/product/catalog/ org/ofbiz/product/category/ org/ofbiz/product/config/ org/ofbiz/product/feature/ org/ofbiz/product/inventory/ org/ofbiz/product/price/ org/ofbiz/product...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r759254 [3/4] - in /ofbiz/trunk/applications/product/src: ./ org/ofbiz/product/catalog/ org/ofbiz/product/category/ org/ofbiz/product/config/ org/ofbiz/product/feature/ org/ofbiz/product/inventory/ org/ofbiz/product/price/ org/ofbiz/product...

doogie-3
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java Fri Mar 27 17:01:36 2009
@@ -314,7 +314,7 @@
         } catch (Exception e) {
             return ServiceUtil.returnError(e.getMessage());
         }
-
+
         result.put("variantSample", sample);
         result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
 
@@ -692,21 +692,21 @@
             java.util.StringTokenizer st = new java.util.StringTokenizer(productFeatureIds, "|");
             while (st.hasMoreTokens()) {
                 String productFeatureId = st.nextToken();
-
+
                 GenericValue productFeature = delegator.findByPrimaryKey("ProductFeature", UtilMisc.toMap("productFeatureId", productFeatureId));
-
+
                 GenericValue productFeatureAppl = delegator.makeValue("ProductFeatureAppl",
                 UtilMisc.toMap("productId", variantProductId, "productFeatureId", productFeatureId,
                 "productFeatureApplTypeId", "STANDARD_FEATURE", "fromDate", UtilDateTime.nowTimestamp()));
-
+
                 // set the default seq num if it's there...
                 if (productFeature != null) {
                     productFeatureAppl.set("sequenceNum", productFeature.get("defaultSequenceNum"));
                 }
-
+
                 productFeatureAppl.create();
             }
-
+
         } catch (GenericEntityException e) {
             Debug.logError(e, "Entity error creating quick add variant data", module);
             Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString());
@@ -726,7 +726,7 @@
     public static Map<String, Object> quickCreateVirtualWithVariants(DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericDelegator delegator = dctx.getDelegator();
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
         // get the various IN attributes
         String variantProductIdsBag = (String) context.get("variantProductIdsBag");
         String productFeatureIdOne = (String) context.get("productFeatureIdOne");
@@ -734,11 +734,11 @@
         String productFeatureIdThree = (String) context.get("productFeatureIdThree");
 
         Map<String, Object> successResult = ServiceUtil.returnSuccess();
-
+
         try {
             // Generate new virtual productId, prefix with "VP", put in successResult
             String productId = (String) context.get("productId");
-
+
             if (UtilValidate.isEmpty(productId)) {
                 productId = "VP" + delegator.getNextSeqId("VirtualProduct");
                 // Create new virtual product...
@@ -759,7 +759,7 @@
                 product.create();
             }
             successResult.put("productId", productId);
-
+
             // separate variantProductIdsBag into a Set of variantProductIds
             //note: can be comma, tab, or white-space delimited
             Set<String> prelimVariantProductIds = FastSet.newInstance();
@@ -786,12 +786,12 @@
                         // whoops, nothing found... return error
                         return ServiceUtil.returnError("Error creating a virtual with variants: the ID [" + variantProductId + "] is not a valid Product.productId or a GoodIdentification.idValue");
                     }
-
+
                     if (goodIdentificationList.size() > 1) {
                         // what to do here? for now just log a warning and add all of them as variants; they can always be dissociated later
                         Debug.logWarning("Warning creating a virtual with variants: the ID [" + variantProductId + "] was not a productId and resulted in [" + goodIdentificationList.size() + "] GoodIdentification records: " + goodIdentificationList, module);
                     }
-
+
                     for (GenericValue goodIdentification: goodIdentificationList) {
                         GenericValue giProduct = goodIdentification.getRelatedOne("Product");
                         if (giProduct != null) {
@@ -809,7 +809,7 @@
             productFeatureIds.add(productFeatureIdOne);
             productFeatureIds.add(productFeatureIdTwo);
             productFeatureIds.add(productFeatureIdThree);
-
+
             for (String featureProductId: featureProductIds) {
                 for (String productFeatureId: productFeatureIds) {
                     if (UtilValidate.isNotEmpty(productFeatureId)) {
@@ -820,7 +820,7 @@
                     }
                 }
             }
-
+
             for (GenericValue variantProduct: variantProductsById.values()) {
                 // for each variant product set: isVirtual=N, isVariant=Y, introductionDate=now
                 variantProduct.set("isVirtual", "N");
@@ -905,22 +905,22 @@
 
         return ServiceUtil.returnSuccess();
     }
-
+
     public static Map<String, Object> addAdditionalViewForProduct(DispatchContext dctx, Map<String, ? extends Object> context)
         throws IOException, JDOMException {
-
+
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         String productId = (String) context.get("productId");
         String productContentTypeId = (String) context.get("productContentTypeId");
         ByteBuffer imageData = (ByteBuffer) context.get("uploadedFile");
-
+
         if (UtilValidate.isNotEmpty((String) context.get("_uploadedFile_fileName"))) {
             String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
             String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
             String imageUrlPrefix = UtilProperties.getPropertyValue("catalog", "image.url.prefix");
-
+
             FlexibleStringExpander filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
             String id = productId + "_View_" + productContentTypeId.charAt(productContentTypeId.length() - 1);
             String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", "additional", "id", id));
@@ -930,7 +930,7 @@
                 filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
                 filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
             }
-
+
             List<GenericValue> fileExtension = FastList.newInstance();
             try {
                 fileExtension = delegator.findByAnd("FileExtension", UtilMisc.toMap("mimeTypeId", (String) context.get("_uploadedFile_contentType")));
@@ -938,14 +938,14 @@
                 Debug.logError(e, module);
                 ServiceUtil.returnError(e.getMessage());
             }
-
+
             GenericValue extension = EntityUtil.getFirst(fileExtension);
             if (extension != null) {
                 filenameToUse += "." + extension.getString("fileExtensionId");
             }
-
+
             File file = new File(imageServerPath + "/" + filePathPrefix + filenameToUse);
-
+
             try {
                 RandomAccessFile out = new RandomAccessFile(file, "rw");
                 out.write(imageData.array());
@@ -957,7 +957,7 @@
                 Debug.logError(e, module);
                 return ServiceUtil.returnError("Unable to write binary data to: " + file.getAbsolutePath());
             }
-
+
             /* scale Image in different sizes */
             String viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
             ScaleImage imageTransform = new ScaleImage();
@@ -973,24 +973,24 @@
                 Debug.logError(e, errMsg, module);
                 return ServiceUtil.returnError(errMsg);
             }
-
+
             String imageUrl = imageUrlPrefix + "/" + filePathPrefix + filenameToUse;
-
+
             if (UtilValidate.isNotEmpty(imageUrl) && imageUrl.length() > 0) {
                 String contentId = (String) context.get("contentId");
-
+
                 Map<String, Object> dataResourceCtx = FastMap.newInstance();
                 dataResourceCtx.put("objectInfo", imageUrl);
                 dataResourceCtx.put("dataResourceName", (String) context.get("_uploadedFile_fileName"));
                 dataResourceCtx.put("userLogin", userLogin);
-
+
                 Map<String, Object> productContentCtx = FastMap.newInstance();
                 productContentCtx.put("productId", productId);
                 productContentCtx.put("productContentTypeId", productContentTypeId);
                 productContentCtx.put("fromDate", (Timestamp) context.get("fromDate"));
                 productContentCtx.put("thruDate", (Timestamp) context.get("thruDate"));
                 productContentCtx.put("userLogin", userLogin);
-
+
                 if (UtilValidate.isNotEmpty(contentId)) {
                     GenericValue content = null;
                     try {
@@ -999,7 +999,7 @@
                         Debug.logError(e, module);
                         ServiceUtil.returnError(e.getMessage());
                     }
-
+
                     if (content != null) {
                         GenericValue dataResource = null;
                         try {
@@ -1008,7 +1008,7 @@
                             Debug.logError(e, module);
                             ServiceUtil.returnError(e.getMessage());
                         }
-
+
                         if (dataResource != null) {
                             dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId"));
                             try {
@@ -1026,7 +1026,7 @@
                                 Debug.logError(e, module);
                                 ServiceUtil.returnError(e.getMessage());
                             }
-
+
                             Map<String, Object> contentCtx = FastMap.newInstance();
                             contentCtx.put("contentId", contentId);
                             contentCtx.put("dataResourceId", dataResourceResult.get("dataResourceId"));
@@ -1038,7 +1038,7 @@
                                 ServiceUtil.returnError(e.getMessage());
                             }
                         }
-
+
                         productContentCtx.put("contentId", contentId);
                         try {
                             dispatcher.runSync("updateProductContent", productContentCtx);
@@ -1068,7 +1068,7 @@
                         Debug.logError(e, module);
                         ServiceUtil.returnError(e.getMessage());
                     }
-
+
                     productContentCtx.put("contentId", contentResult.get("contentId"));
                     try {
                         dispatcher.runSync("createProductContent", productContentCtx);
@@ -1081,7 +1081,7 @@
         }
            return ServiceUtil.returnSuccess();
     }
-
+
     /**
      * Finds productId(s) corresponding to a product reference, productId or a GoodIdentification idValue
      * @param dctx
@@ -1095,10 +1095,10 @@
         String goodIdentificationTypeId = (String) context.get("goodIdentificationTypeId");
         String searchProductFirstContext = (String) context.get("searchProductFirst");
         String searchAllIdContext = (String) context.get("searchAllId");
-
+
         boolean searchProductFirst = UtilValidate.isNotEmpty(searchProductFirstContext) && "N".equals(searchProductFirstContext) ? false : true;
         boolean searchAllId = UtilValidate.isNotEmpty(searchAllIdContext)&& "Y".equals(searchAllIdContext) ? true : false;
-
+
         GenericValue product = null;
         List<GenericValue> productsFound = null;
         try {
@@ -1107,18 +1107,18 @@
             Debug.logError(e, module);
             ServiceUtil.returnError(e.getMessage());
         }
-
+
         if (UtilValidate.isNotEmpty(productsFound)) {
             // gets the first productId of the List
             product = EntityUtil.getFirst(productsFound);
             // remove this productId
             productsFound.remove(0);
         }
-
+
         Map<String, Object> result = ServiceUtil.returnSuccess();
         result.put("product", product);
         result.put("productsList", productsFound);
-
+
         return result;
     }
 }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Fri Mar 27 17:01:36 2009
@@ -53,7 +53,7 @@
  * Product Worker class to reduce code in JSPs.
  */
 public class ProductWorker {
-
+
     public static final String module = ProductWorker.class.getName();
     public static final String resource = "ProductUiLabels";
 
@@ -73,7 +73,7 @@
                 return false;
             }
             Boolean chargeShipping = product.getBoolean("chargeShipping");
-
+
             if (chargeShipping == null) {
                 return true;
             } else {
@@ -127,7 +127,7 @@
                     return true;
                 }
             }
-
+
         } else {
             throw new IllegalArgumentException("product and postalAddress cannot be null.");
         }
@@ -138,7 +138,7 @@
         String errMsg = "";
         if (product != null) {
             Boolean taxable = product.getBoolean("taxable");
-
+
             if (taxable == null) {
                 return true;
             } else {
@@ -148,7 +148,7 @@
             throw new IllegalArgumentException(errMsg);
         }
     }
-
+
     /** @deprecated */
     public static void getProduct(PageContext pageContext, String attributeName, String productId) {
         GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator");
@@ -174,7 +174,7 @@
 
     public static String getInstanceAggregatedId(GenericDelegator delegator, String instanceProductId) throws GenericEntityException {
         GenericValue instanceProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", instanceProductId));
-
+
         if (UtilValidate.isNotEmpty(instanceProduct) && "AGGREGATED_CONF".equals(instanceProduct.getString("productTypeId"))) {
             GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelatedByAnd("AssocProductAssoc",
                     UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"))));
@@ -197,10 +197,10 @@
         }
         return null;
     }
-
+
     public static List<GenericValue> getAggregatedAssocs(GenericDelegator delegator, String  aggregatedProductId) throws GenericEntityException {
         GenericValue aggregatedProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", aggregatedProductId));
-
+
         if (UtilValidate.isNotEmpty(aggregatedProduct) && "AGGREGATED".equals(aggregatedProduct.getString("productTypeId"))) {
             List<GenericValue> productAssocs = EntityUtil.filterByDate(aggregatedProduct.getRelatedByAnd("MainProductAssoc",
                     UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF")));
@@ -208,7 +208,7 @@
         }
         return null;
     }
-
+
     public static String getVariantVirtualId(GenericValue variantProduct) throws GenericEntityException {
         List<GenericValue> productAssocs = getVariantVirtualAssocs(variantProduct);
         if (productAssocs == null) {
@@ -328,7 +328,7 @@
             Debug.logWarning(e, module);
         }
     }
-
+
     /**
      * Gets ProductFeature GenericValue for all distinguishing features of a variant product.
      * Distinguishing means all features that are selectable on the corresponding virtual product and standard on the variant plus all DISTINGUISHING_FEAT assoc type features on the variant.
@@ -342,10 +342,10 @@
         }
         GenericDelegator delegator = variantProduct.getDelegator();
         String virtualProductId = getVariantVirtualId(variantProduct);
-
+
         // find all selectable features on the virtual product that are also standard features on the variant
         Set<GenericValue> distFeatures = FastSet.newInstance();
-
+
         List<GenericValue> variantDistinguishingFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "DISTINGUISHING_FEAT"));
         // Debug.logInfo("Found variantDistinguishingFeatures: " + variantDistinguishingFeatures, module);
 
@@ -362,7 +362,7 @@
         for (GenericValue virtualSelectableFeature: EntityUtil.filterByDate(virtualSelectableFeatures)) {
             virtualSelectableFeatureIds.add(virtualSelectableFeature.getString("productFeatureId"));
         }
-
+
         List<GenericValue> variantStandardFeatures = delegator.findByAndCache("ProductFeatureAndAppl", UtilMisc.toMap("productId", variantProduct.get("productId"), "productFeatureApplTypeId", "STANDARD_FEATURE"));
         // Debug.logInfo("Found variantStandardFeatures: " + variantStandardFeatures, module);
 
@@ -373,7 +373,7 @@
                 distFeatures.add(dummyFeature);
             }
         }
-
+
         return distFeatures;
     }
 
@@ -389,7 +389,7 @@
                     Set<GenericValue> distFeatures = getVariantDistinguishingFeatures(alternativeOptionProduct);
                     if (UtilValidate.isNotEmpty(distFeatures)) {
                         // Debug.logInfo("Found distinguishing features: " + distFeatures, module);
-
+
                         StringBuilder nameBuf = new StringBuilder();
                         for (GenericValue productFeature: distFeatures) {
                             if (nameBuf.length() > 0) {
@@ -479,7 +479,7 @@
             return null;
         }
     }
-
+
     /**
      *
      * @param product
@@ -567,7 +567,7 @@
     }
 
     // product calc methods
-
+
     public static BigDecimal calcOrderAdjustments(List<GenericValue> orderHeaderAdjustments, BigDecimal subTotal, boolean includeOther, boolean includeTax, boolean includeShipping) {
         BigDecimal adjTotal = BigDecimal.ZERO;
 
@@ -579,7 +579,7 @@
         }
         return adjTotal;
     }
-
+
     public static BigDecimal calcOrderAdjustment(GenericValue orderAdjustment, BigDecimal orderSubTotal) {
         BigDecimal adjustment = BigDecimal.ZERO;
 
@@ -591,7 +591,7 @@
         }
         return adjustment;
     }
-
+
     public static List<GenericValue> filterOrderAdjustments(List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) {
         List<GenericValue> newOrderAdjustmentsList = FastList.newInstance();
 
@@ -628,7 +628,7 @@
     public static BigDecimal getAverageProductRating(GenericDelegator delegator, String productId) {
         return getAverageProductRating(delegator, productId, null);
     }
-
+
     public static BigDecimal getAverageProductRating(GenericDelegator delegator, String productId, String productStoreId) {
         GenericValue product = null;
         try {
@@ -735,7 +735,7 @@
         }
         return categories;
     }
-
+
     //get parent product
     public static GenericValue getParentProduct(String productId, GenericDelegator delegator) {
         GenericValue _parentProduct = null;
@@ -804,7 +804,7 @@
 
         return false;
     }
-
+
     public static boolean isAmountRequired(GenericDelegator delegator, String productI) {
         try {
             GenericValue product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productI));
@@ -830,8 +830,8 @@
 
         return null;
     }
-
-
+
+
     /**
      * Generic service to find product by id.
      * By default return the product find by productId
@@ -848,12 +848,12 @@
     public static List<GenericValue> findProductsById( GenericDelegator delegator,
             String idToFind, String goodIdentificationTypeId,
             boolean searchProductFirst, boolean searchAllId) throws GenericEntityException {
-
+
         if (Debug.verboseOn()) Debug.logVerbose("Analyze goodIdentification: entered id = " + idToFind + ", goodIdentificationTypeId = " + goodIdentificationTypeId, module);
-
+
         GenericValue product = null;
         List<GenericValue> productsFound = null;
-
+
         // 1) look if the idToFind given is a real productId
         if (searchProductFirst) {
             product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", idToFind));
@@ -867,11 +867,11 @@
             }
             productsFound = delegator.findByAndCache("GoodIdentificationAndProduct", conditions, UtilMisc.toList("productId"));
         }
-
+
         if (! searchProductFirst) {
             product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", idToFind));
         }
-
+
         if (UtilValidate.isNotEmpty(product)) {
             if (UtilValidate.isNotEmpty(productsFound)) productsFound.add(product);
             else productsFound = UtilMisc.toList(product);
@@ -884,7 +884,7 @@
     throws GenericEntityException {
         return findProductsById(delegator, idToFind, goodIdentificationTypeId, true, false);
     }
-
+
     public static String findProductId(GenericDelegator delegator, String idToFind, String goodIdentificationTypeId) throws GenericEntityException {
         GenericValue product = findProduct(delegator, idToFind, goodIdentificationTypeId);
         if (UtilValidate.isNotEmpty(product)) {
@@ -914,7 +914,7 @@
                 if (! "Product".equals(product.getEntityName())) {
                     productToAdd = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", product.get("productId")));
                 }
-
+
                 if (UtilValidate.isEmpty(products)) {
                     products = UtilMisc.toList(productToAdd);
                 }
@@ -958,7 +958,7 @@
         }
         return false;
     }
-
+
     public static Set<String> getRefurbishedProductIdSet(String productId, GenericDelegator delegator) throws GenericEntityException {
         Set<String> productIdSet = FastSet.newInstance();
 
@@ -968,19 +968,19 @@
         for (GenericValue refubProductAssoc: refubProductAssocs) {
             productIdSet.add(refubProductAssoc.getString("productIdTo"));
         }
-
+
         // see if this is a refurb productId to, and find product(s) it is a refurb of
         List<GenericValue> refubProductToAssocs = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc",
                 UtilMisc.toMap("productIdTo", productId, "productAssocTypeId", "PRODUCT_REFURB")));
         for (GenericValue refubProductToAssoc: refubProductToAssocs) {
             productIdSet.add(refubProductToAssoc.getString("productId"));
         }
-
+
         return productIdSet;
     }
-
+
     public static String getVariantFromFeatureTree(String productId, List<String> selectedFeatures, GenericDelegator delegator) {
-
+
         //  all method code moved here from ShoppingCartEvents.addToCart event
         String variantProductId = null;
         try {
@@ -1095,21 +1095,21 @@
                 productAssoc.put("fromDate", UtilDateTime.nowTimestamp());
                 productAssoc.create();
                 Debug.log("set the productId to: " + product.getString("productId"));
-
+
                 // copy the supplier
                 List<GenericValue> supplierProducts = delegator.findByAndCache("SupplierProduct", UtilMisc.toMap("productId", productId));
                 for (GenericValue supplierProduct: supplierProducts) {
                     supplierProduct.set("productId",  product.getString("productId"));
                     supplierProduct.create();
                 }
-
+
                 // copy the content
                 List<GenericValue> productContents = delegator.findByAndCache("ProductContent", UtilMisc.toMap("productId", productId));
                 for (GenericValue productContent: productContents) {
                     productContent.set("productId",  product.getString("productId"));
                     productContent.create();
                 }
-
+
                 // finally use the new productId to be added to the cart
                 variantProductId = product.getString("productId"); // set to the new product
             }
@@ -1117,7 +1117,7 @@
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
-
+
         return variantProductId;
     }
 }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java Fri Mar 27 17:01:36 2009
@@ -80,7 +80,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         String productStoreId = (String) context.get("productStoreId");
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
         List<EntityCondition> condList = FastList.newInstance();
         if (UtilValidate.isEmpty(productStoreId)) {
             condList.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId));
@@ -89,7 +89,7 @@
         condList.add(EntityCondition.makeCondition("thruDate", EntityOperator.NOT_EQUAL, null));
         condList.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN, nowTimestamp));
         EntityCondition cond = EntityCondition.makeCondition(condList, EntityOperator.AND);
-
+
         try {
             EntityListIterator eli = delegator.find("ProductStorePromoAndAppl", cond, null, null, null, null);
             GenericValue productStorePromoAndAppl = null;
@@ -104,7 +104,7 @@
             Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
-
+
         return ServiceUtil.returnSuccess();
     }
 
@@ -186,7 +186,7 @@
         String productPromoCodeId = (String) context.get("productPromoCodeId");
         byte[] wrapper = (byte[]) context.get("uploadedFile");
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-
+
         if (wrapper == null) {
             return ServiceUtil.returnError("Uploaded file not valid or corrupted");
         }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Fri Mar 27 17:01:36 2009
@@ -89,7 +89,7 @@
         }
         return null;
     }
-
+
     public static String getStoreCurrencyUomId(HttpServletRequest request) {
         GenericValue productStore = getProductStore(request);
         return UtilHttp.getCurrencyUom(request.getSession(), productStore.getString("defaultCurrencyUomId"));
@@ -131,7 +131,7 @@
     public static String getProductStorePayToPartyId(String productStoreId, GenericDelegator delegator) {
         return getProductStorePayToPartyId(getProductStore(productStoreId, delegator));
     }
-
+
     public static String getProductStorePayToPartyId(GenericValue productStore) {
         String payToPartyId = "Company"; // default value
         if (productStore != null && productStore.get("payToPartyId") != null) {
@@ -718,13 +718,13 @@
 
         defaultProductStoreEmailScreenLocation.put("PRDS_GC_PURCHASE", "component://ecommerce/widget/EmailGiftCardScreens.xml#GiftCardPurchase");
         defaultProductStoreEmailScreenLocation.put("PRDS_GC_RELOAD", "component://ecommerce/widget/EmailGiftCardScreens.xml#GiftCardReload");
-
+
         defaultProductStoreEmailScreenLocation.put("PRDS_QUO_CONFIRM", "component://order/widget/ordermgr/QuoteScreens.xml#ViewQuoteSimple");
-
+
         defaultProductStoreEmailScreenLocation.put("PRDS_PWD_RETRIEVE", "component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail");
-
+
         defaultProductStoreEmailScreenLocation.put("PRDS_TELL_FRIEND", "component://ecommerce/widget/EmailProductScreens.xml#TellFriend");
-
+
         defaultProductStoreEmailScreenLocation.put("PRDS_CUST_REGISTER", "component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail");
     }
 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Fri Mar 27 17:01:36 2009
@@ -52,7 +52,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
         String partyId = (String) context.get("partyId");
         String subscriptionResourceId = (String) context.get("subscriptionResourceId");
         String inventoryItemId = (String) context.get("inventoryItemId");
@@ -62,7 +62,7 @@
         String useTimeUomId = (String) context.get("useTimeUomId");
         String alwaysCreateNewRecordStr = (String) context.get("alwaysCreateNewRecord");
         boolean alwaysCreateNewRecord = !"N".equals(alwaysCreateNewRecordStr);
-
+
         GenericValue lastSubscription = null;
         try {
             Map<String, String> subscriptionFindMap = UtilMisc.toMap("partyId", partyId, "subscriptionResourceId", subscriptionResourceId);
@@ -96,7 +96,7 @@
         newSubscription.set("inventoryItemId", inventoryItemId);
 
         Timestamp thruDate = lastSubscription != null ? (Timestamp) lastSubscription.get("thruDate") : null;
-
+
         // set the fromDate, one way or another
         if (thruDate == null) {
             // no thruDate? start with NOW
@@ -111,7 +111,7 @@
             }
             newSubscription.set("fromDate", thruDate);
         }
-
+
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(thruDate);
         int[] times = UomWorker.uomTimeToCalTime(useTimeUomId);
@@ -121,10 +121,10 @@
             Debug.logWarning("Don't know anything about useTimeUomId [" + useTimeUomId + "], defaulting to month", module);
             calendar.add(Calendar.MONTH, (useTime.intValue() * times[1]));
         }
-
+
         thruDate = new Timestamp(calendar.getTimeInMillis());
         newSubscription.set("thruDate", thruDate);
-
+
         Map<String, Object> result = ServiceUtil.returnSuccess();
         try {
             if (lastSubscription != null && !alwaysCreateNewRecord) {
@@ -163,7 +163,7 @@
         }
         return result;
     }
-
+
     public static Map<String, Object> processExtendSubscriptionByProduct(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
@@ -172,7 +172,7 @@
         if (qty == null) {
             qty = Integer.valueOf(1);
         }
-
+
         Timestamp orderCreatedDate = (Timestamp) context.get("orderCreatedDate");
         if (orderCreatedDate == null) {
             orderCreatedDate = UtilDateTime.nowTimestamp();
@@ -202,7 +202,7 @@
                 subContext.put("automaticExtend", productSubscriptionResource.get("automaticExtend"));
                 subContext.put("canclAutmExtTime", productSubscriptionResource.get("canclAutmExtTime"));
                 subContext.put("canclAutmExtTimeUomId", productSubscriptionResource.get("canclAutmExtTimeUomId"));
-
+
                 Map<String, Object> ctx = dctx.getModelService("processExtendSubscription").makeValid(subContext, ModelService.IN_PARAM);
                 Map<String, Object> processExtendSubscriptionResult = dispatcher.runSync("processExtendSubscription", ctx);
                 if (ServiceUtil.isError(processExtendSubscriptionResult)) {
@@ -213,18 +213,18 @@
             Debug.logError(e, e.toString(), module);
             return ServiceUtil.returnError(e.toString());
         }
-
+
         return ServiceUtil.returnSuccess();
     }
-
+
     public static Map<String, Object> processExtendSubscriptionByOrder(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Map<String, Object> subContext = UtilMisc.makeMapWritable(context);
         String orderId = (String) context.get("orderId");
-
+
         Debug.logInfo("In processExtendSubscriptionByOrder service with orderId: " + orderId, module);
-
+
         GenericValue orderHeader = null;
         try {
             List<GenericValue> orderRoleList = delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "END_USER_CUSTOMER"));

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java Fri Mar 27 17:01:36 2009
@@ -49,7 +49,7 @@
 
     public static final String module = SupplierProductServices.class.getName();
     public static final String resource = "ProductUiLabels";
-
+
     /*
      * Parameters: productId, partyId, currencyUomId, quantity
      * Result: a List of SupplierProduct entities for productId,
@@ -58,7 +58,7 @@
     public static Map<String, Object> getSuppliersForProduct(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> results = FastMap.newInstance();
         GenericDelegator delegator = dctx.getDelegator();
-
+
         GenericValue product = null;
         String productId = (String) context.get("productId");
         String partyId = (String) context.get("partyId");
@@ -73,7 +73,7 @@
                 return results;
             }
             List<GenericValue> supplierProducts = product.getRelatedCache("SupplierProduct");
-
+
             // if there were no related SupplierProduct entities and the item is a variant, then get the SupplierProducts of the virtual parent product
             if (supplierProducts.size() == 0 && product.getString("isVariant") != null && product.getString("isVariant").equals("Y")) {
                 String virtualProductId = ProductWorker.getVariantVirtualId(product);
@@ -82,17 +82,17 @@
                     supplierProducts = virtualProduct.getRelatedCache("SupplierProduct");
                 }
             }
-
+
             // filter the list down by the partyId if one is provided
             if (partyId != null) {
                 supplierProducts = EntityUtil.filterByAnd(supplierProducts, UtilMisc.toMap("partyId", partyId));
             }
-
+
             // filter the list down by the currencyUomId if one is provided
             if (currencyUomId != null) {
                 supplierProducts = EntityUtil.filterByAnd(supplierProducts, UtilMisc.toMap("currencyUomId", currencyUomId));
             }
-
+
             // filter the list down by the minimumOrderQuantity if one is provided
             if (quantity != null) {
                 //minimumOrderQuantity
@@ -106,10 +106,10 @@
 
             // filter the list down again by date before returning it
             supplierProducts = EntityUtil.filterByDate(supplierProducts, UtilDateTime.nowTimestamp(), "availableFromDate", "availableThruDate", true);
-
+
             //sort resulting list of SupplierProduct entities by price in ASCENDING order
             supplierProducts = EntityUtil.orderBy(supplierProducts, UtilMisc.toList("lastPrice ASC"));
-
+
             results = ServiceUtil.returnSuccess();
             results.put("supplierProducts", supplierProducts);
         } catch (GenericEntityException ex) {

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java Fri Mar 27 17:01:36 2009
@@ -52,7 +52,7 @@
 
     protected void tearDown() throws Exception {
     }
-
+
     public void testCreateInventoryItemsTransfer() throws Exception {
         Map<String, Object> ctx = FastMap.newInstance();
         String statusId = "IXF_REQUESTED";
@@ -68,7 +68,7 @@
         inventoryTransferId = (String) resp.get("inventoryTransferId");
         assertNotNull(inventoryTransferId);
     }
-
+
     public void testUpdateInventoryItemTransfer() throws Exception {
         Map<String, Object> ctx = FastMap.newInstance();
         String statusId = "IXF_COMPLETE";

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java Fri Mar 27 17:01:36 2009
@@ -54,26 +54,26 @@
 
     protected void tearDown() throws Exception {
     }
-
+
     public void testStockMoves() throws Exception {
         Map<String, Object> fsmnCtx = FastMap.newInstance();
         Map stockMoveHandled = null;
         List warningList = FastList.newInstance();
-
+
         fsmnCtx.put("facilityId", "WebStoreWarehouse");
         fsmnCtx.put("userLogin", userLogin);
         Map<String, Object> respMap1 = dispatcher.runSync("findStockMovesNeeded", fsmnCtx);
         stockMoveHandled = (Map) respMap1.get("stockMoveHandled");
         warningList = (List) respMap1.get("warningMessageList");
         assertNull(warningList);
-
+
         if (stockMoveHandled != null) {
             fsmnCtx.put("stockMoveHandled", stockMoveHandled);
         }
         Map<String, Object> respMap2 = dispatcher.runSync("findStockMovesRecommended", fsmnCtx);
         warningList = (List) respMap2.get("warningMessageList");
         assertNull(warningList);
-
+
         Map<String, Object> ppsmCtx = FastMap.newInstance();
         ppsmCtx.put("productId", "GZ-2644");
         ppsmCtx.put("facilityId", "WebStoreWarehouse");

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java Fri Mar 27 17:01:36 2009
@@ -54,7 +54,7 @@
         }
 
         Debug.log("OrderId [" + orderId + "] ship group [" + shipGroupSeqId + "] Pack input [" + productId + "] @ [" + quantity + "] packageSeq [" + packageSeq + "] weight [" + weight +"]", module);
-
+
         if (weight == null) {
             Debug.logWarning("OrderId [" + orderId + "] ship group [" + shipGroupSeqId + "] product [" + productId + "] being packed without a weight, assuming 0", module);
             weight = BigDecimal.ZERO;
@@ -158,7 +158,7 @@
                 } else {
                     quantities = new String[] { qtyStr };
                 }
-
+
                 // process the weight array
                 if (UtilValidate.isEmpty(wgtStr)) wgtStr = "0";
                 weights = new String[] { wgtStr };
@@ -255,7 +255,7 @@
         String carrierPartyId = (String) context.get("carrierPartyId");
         String carrierRoleTypeId = (String) context.get("carrierRoleTypeId");
         String productStoreId = (String) context.get("productStoreId");
-
+
         BigDecimal shippableWeight = setSessionPackageWeights(session, packageWeights);
         BigDecimal estimatedShipCost = session.getShipmentCostEstimate(shippingContactMechId, shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, productStoreId, null, null, shippableWeight, null);
         session.setAdditionalShippingCharge(estimatedShipCost);
@@ -301,7 +301,7 @@
         } else {
             resp = ServiceUtil.returnSuccess("Shipment #" + shipmentId + " created and marked as PACKED.");
         }
-
+
         resp.put("shipmentId", shipmentId);
         return resp;
     }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Fri Mar 27 17:01:36 2009
@@ -161,7 +161,7 @@
                 } else if (!update) {
                     resQty = resQty.subtract(resPackedQty);
                 }
-
+
                 BigDecimal thisQty = resQty.compareTo(qtyRemain) > 0 ? qtyRemain : resQty;
 
                 int thisCheck = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, thisQty, packageSeqId, update);
@@ -236,7 +236,7 @@
 
         // Add the line weight to the package weight
         if (weight.compareTo(BigDecimal.ZERO) > 0) this.addToPackageWeight(packageSeqId, weight);
-
+
         // update the package sequence
         if (packageSeqId > packageSeq) {
             this.packageSeq = packageSeqId;
@@ -566,7 +566,7 @@
             this.clear();
             return packageSeq;
         }
-
+
         List<PackingSessionLine> currentLines = UtilMisc.makeListWritable(this.packLines);
         for (PackingSessionLine line: currentLines) {
             if (line.getPackageSeq() == packageSeq) {
@@ -751,7 +751,7 @@
 
         return true;
     }
-
+
     protected void createPackages() throws GeneralException {
         for (int i = 0; i < packageSeq; i++) {
             String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5);
@@ -789,7 +789,7 @@
             getDelegator().storeAll(shipmentRouteSegments);
         }
     }
-
+
     protected void setShipmentToPacked() throws GeneralException {
         Map<String, Object> packedCtx = UtilMisc.toMap("shipmentId", shipmentId, "statusId", "SHIPMENT_PACKED", "userLogin", userLogin);
         Map<String, Object> packedResp = this.getDispatcher().runSync("updateShipment", packedCtx);
@@ -831,7 +831,7 @@
     public void setAdditionalShippingCharge(BigDecimal additionalShippingCharge) {
         this.additionalShippingCharge = additionalShippingCharge;
     }
-
+
     public BigDecimal getTotalWeight() {
         BigDecimal total = BigDecimal.ZERO;
         for (int i = 0; i < packageSeq; i++) {
@@ -848,13 +848,13 @@
                                        orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"),
                                        productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
     }
-
+
     public BigDecimal getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId) {
         return getShipmentCostEstimate(orderItemShipGroup.getString("contactMechId"), orderItemShipGroup.getString("shipmentMethodTypeId"),
                                        orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"),
                                        productStoreId, null, null, null, null);
     }
-
+
     public BigDecimal getShipmentCostEstimate(String shippingContactMechId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String productStoreId, List<GenericValue> shippableItemInfo, BigDecimal shippableTotal, BigDecimal shippableWeight, BigDecimal shippableQuantity) {
 
         BigDecimal shipmentCostEstimate = null;
@@ -866,7 +866,7 @@
             serviceContext.put("carrierPartyId", carrierPartyId);
             serviceContext.put("carrierRoleTypeId", carrierRoleTypeId);
             serviceContext.put("productStoreId", productStoreId);
-
+
             if (UtilValidate.isEmpty(shippableItemInfo)) {
                 shippableItemInfo = FastList.newInstance();
                 for (PackingSessionLine line: getLines()) {
@@ -890,22 +890,22 @@
                 shippableTotal = BigDecimal.ZERO;
             }
             serviceContext.put("shippableTotal", shippableTotal);
-
+
             serviceResult = getDispatcher().runSync("calcShipmentCostEstimate", serviceContext);
         } catch ( GenericEntityException e ) {
             Debug.logError(e, module);
         } catch ( GenericServiceException e ) {
             Debug.logError(e, module);
         }
-
+
         if (! UtilValidate.isEmpty(serviceResult.get("shippingEstimateAmount"))) {
             shipmentCostEstimate = (BigDecimal) serviceResult.get("shippingEstimateAmount");
         }
-
+
         return shipmentCostEstimate;
-
+
     }
-
+
     public String getWeightUomId() {
         return weightUomId;
     }
@@ -913,7 +913,7 @@
     public void setWeightUomId(String weightUomId) {
         this.weightUomId = weightUomId;
     }
-
+
     public List<Integer> getPackageSeqIds() {
         Set<Integer> packageSeqIds = new TreeSet<Integer>();
         if (! UtilValidate.isEmpty(this.getLines())) {
@@ -923,7 +923,7 @@
         }
         return UtilMisc.makeListWritable(packageSeqIds);
     }
-
+
     public void setPackageWeight(int packageSeqId, BigDecimal packageWeight) {
         if (UtilValidate.isEmpty(packageWeight)) {
             packageWeights.remove(Integer.valueOf(packageSeqId));
@@ -931,7 +931,7 @@
             packageWeights.put(Integer.valueOf(packageSeqId), packageWeight);
         }
     }
-
+
     public BigDecimal getPackageWeight(int packageSeqId) {
         if (this.packageWeights == null) return null;
         BigDecimal packageWeight = null;
@@ -941,7 +941,7 @@
         }
         return packageWeight;
     }
-
+
     public void addToPackageWeight(int packageSeqId, BigDecimal weight) {
         if (UtilValidate.isEmpty(weight)) return;
         BigDecimal packageWeight = getPackageWeight(packageSeqId);

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java Fri Mar 27 17:01:36 2009
@@ -38,17 +38,17 @@
  * ShippingEvents - Events used for processing shipping fees
  */
 public class ShipmentEvents {
-
+
     public static final String module = ShipmentEvents.class.getName();
 
     public static String viewShipmentPackageRouteSegLabelImage(HttpServletRequest request, HttpServletResponse response) {
-
+
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-
+
         String shipmentId = request.getParameter("shipmentId");
         String shipmentRouteSegmentId = request.getParameter("shipmentRouteSegmentId");
         String shipmentPackageSeqId = request.getParameter("shipmentPackageSeqId");
-
+
         GenericValue shipmentPackageRouteSeg = null;
         try {
             shipmentPackageRouteSeg = delegator.findByPrimaryKey("ShipmentPackageRouteSeg", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentPackageSeqId", shipmentPackageSeqId));
@@ -58,18 +58,18 @@
             request.setAttribute("_ERROR_MESSAGE_", errorMsg);
             return "error";
         }
-
+
         if (shipmentPackageRouteSeg == null) {
             request.setAttribute("_ERROR_MESSAGE_", "Could not find ShipmentPackageRouteSeg where shipmentId=[" + shipmentId + "], shipmentRouteSegmentId=[" + shipmentRouteSegmentId + "], shipmentPackageSeqId=[" + shipmentPackageSeqId + "]");
             return "error";
         }
-
+
         byte[] bytes = shipmentPackageRouteSeg.getBytes("labelImage");
         if (bytes == null || bytes.length == 0) {
             request.setAttribute("_ERROR_MESSAGE_", "The ShipmentPackageRouteSeg was found where shipmentId=[" + shipmentId + "], shipmentRouteSegmentId=[" + shipmentRouteSegmentId + "], shipmentPackageSeqId=[" + shipmentPackageSeqId + "], but there was no labelImage on the value.");
             return "error";
         }
-
+
         // TODO: record the image format somehow to make this block nicer.  Right now we're just trying GIF first as a default, then if it doesn't work, trying PNG.
         // It would be nice to store the actual type of the image alongside the image data.
         try {
@@ -84,7 +84,7 @@
                 return "error";
             }
         }
-
+
         return "success";
     }
 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Fri Mar 27 17:01:36 2009
@@ -244,13 +244,13 @@
         Map<String, String> estFields = UtilMisc.toMap("productStoreId", productStoreId, "shipmentMethodTypeId", shipmentMethodTypeId,
                 "carrierPartyId", carrierPartyId, "carrierRoleTypeId", carrierRoleTypeId);
         EntityCondition estFieldsCond = EntityCondition.makeCondition(estFields, EntityOperator.AND);
-
+
         if (UtilValidate.isNotEmpty(productStoreShipMethId)) {
             // if the productStoreShipMethId field is passed, then also get estimates that have the field set
             List<EntityCondition> condList = UtilMisc.toList(EntityCondition.makeCondition("productStoreShipMethId", EntityOperator.EQUALS, productStoreShipMethId), estFieldsCond);
             estFieldsCond = EntityCondition.makeCondition(condList, EntityOperator.OR);
         }
-
+
         Collection<GenericValue> estimates = null;
         try {
             estimates = delegator.findList("ShipmentCostEstimate", estFieldsCond, null, null, null, true);
@@ -886,7 +886,7 @@
                     return updateShipmentMap;
                 }
             }
-
+
             List<GenericValue> shipmentAndItems = delegator.findByAnd("ShipmentAndItem", UtilMisc.toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED"));
             if (shipmentAndItems.size() == 0) {
                 return ServiceUtil.returnSuccess();
@@ -934,7 +934,7 @@
 
         String shipmentId = (String) context.get("shipmentId");
         String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
-
+
         Map<String, Object> results = ServiceUtil.returnSuccess();
 
         try {
@@ -1020,7 +1020,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         Locale locale = (Locale) context.get("locale");
-
+
         String shipmentId = (String) context.get("shipmentId");
         String shipmentPackageSeqId = (String) context.get("shipmentPackageSeqId");
         String currencyUomId = (String) context.get("currencyUomId");
@@ -1037,32 +1037,32 @@
                 Debug.logError(errorMessage, module);
                 return ServiceUtil.returnError(errorMessage);
             }
-
+
             shipmentPackage = delegator.findByPrimaryKey("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId));
             if (UtilValidate.isEmpty(shipmentPackage)) {
                 String errorMessage = UtilProperties.getMessage(resource, "ProductShipmentPackageNotFound", context, locale);
                 Debug.logError(errorMessage, module);
                 return ServiceUtil.returnError(errorMessage);
             }
-
+
             List<GenericValue> packageContents = delegator.findByAnd("PackedQtyVsOrderItemQuantity", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId));
             for (GenericValue packageContent: packageContents) {
                 String orderId = packageContent.getString("orderId");
                 String orderItemSeqId = packageContent.getString("orderItemSeqId");
-
+
                 // Get the value of the orderItem by calling the getOrderItemInvoicedAmountAndQuantity service
                 Map<String, Object> getOrderItemValueResult = dispatcher.runSync("getOrderItemInvoicedAmountAndQuantity", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "userLogin", userLogin, "locale", locale));
                 if (ServiceUtil.isError(getOrderItemValueResult)) return getOrderItemValueResult;
                 BigDecimal invoicedAmount = (BigDecimal) getOrderItemValueResult.get("invoicedAmount");
                 BigDecimal invoicedQuantity = (BigDecimal) getOrderItemValueResult.get("invoicedQuantity");
-
+
                 // How much of the invoiced quantity does the issued quantity represent?
                 BigDecimal issuedQuantity = packageContent.getBigDecimal("issuedQuantity");
                 BigDecimal proportionOfInvoicedQuantity = invoicedQuantity.signum() == 0 ? ZERO : issuedQuantity.divide(invoicedQuantity, 10, rounding);
-
+
                 // Prorate the orderItem's invoiced amount by that proportion
                 BigDecimal packageContentValue = proportionOfInvoicedQuantity.multiply(invoicedAmount).setScale(decimals, rounding);
-
+
                 // Convert the value to the shipment currency, if necessary
                 GenericValue orderHeader = packageContent.getRelatedOne("OrderHeader");
                 Map<String, Object> convertUomResult = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", currencyUomId, "originalValue", packageContentValue));
@@ -1072,7 +1072,7 @@
                 if (convertUomResult.containsKey("convertedValue")) {
                     packageContentValue = ((BigDecimal) convertUomResult.get("convertedValue")).setScale(decimals, rounding);
                 }
-
+
                 // Add the value of the packed item to the package's total value
                 packageTotalValue = packageTotalValue.add(packageContentValue);
             }
@@ -1088,7 +1088,7 @@
         result.put("packageValue", packageTotalValue);
         return result;
     }
-
+
     public static Map<String, Object> sendShipmentCompleteNotification(DispatchContext dctx, Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
@@ -1127,7 +1127,7 @@
         } else {
             sendMap.put("bodyScreenUri", screenUri);
         }
-
+
         String partyId = shipment.getString("partyIdTo");
 
         // get the email address
@@ -1147,11 +1147,11 @@
         ResourceBundleMapWrapper uiLabelMap = (ResourceBundleMapWrapper) UtilProperties.getResourceBundleMap("EcommerceUiLabels", locale);
         uiLabelMap.addBottomResourceBundle("OrderUiLabels");
         uiLabelMap.addBottomResourceBundle("CommonUiLabels");
-
+
         Map<String, Object> bodyParameters = UtilMisc.<String, Object>toMap("partyId", partyId, "shipmentId", shipmentId, "orderId", shipment.getString("primaryOrderId"), "userLogin", userLogin, "uiLabelMap", uiLabelMap, "locale", locale);
         sendMap.put("bodyParameters", bodyParameters);
         sendMap.put("userLogin",userLogin);
-
+
         if (productStoreEmail != null) {
             sendMap.put("subject", productStoreEmail.getString("subject"));
             sendMap.put("contentType", productStoreEmail.get("contentType"));

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=759254&r1=759253&r2=759254&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 Fri Mar 27 17:01:36 2009
@@ -165,7 +165,7 @@
         BigDecimal shippableTotal = (BigDecimal) context.get("shippableTotal");
         BigDecimal shippableQuantity = (BigDecimal) context.get("shippableQuantity");
         BigDecimal shippableWeight = (BigDecimal) context.get("shippableWeight");
-
+
         if (shipmentMethodTypeId.equals("NO_SHIPPING")) {
             Map<String, Object> result = ServiceUtil.returnSuccess();
             result.put("shippingEstimateAmount", null);
@@ -502,7 +502,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         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");
@@ -517,16 +517,16 @@
             if (shipmentRouteSegment == null) {
                 return ServiceUtil.returnError("ShipmentRouteSegment not found with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
             }
-
+
             if (!"DHL".equals(shipmentRouteSegment.getString("carrierPartyId"))) {
                 return ServiceUtil.returnError("ERROR: The Carrier for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is not DHL.");
             }
-
+
             // add ShipmentRouteSegment carrierServiceStatusId, check before all DHL services
             if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("carrierServiceStatusId")) && !"SHRSCS_NOT_STARTED".equals(shipmentRouteSegment.getString("carrierServiceStatusId"))) {
                 return ServiceUtil.returnError("ERROR: The Carrier Service Status for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is [" + shipmentRouteSegment.getString("carrierServiceStatusId") + "], but must be not-set or [SHRSCS_NOT_STARTED] to perform the DHL Shipment Confirm operation.");
             }
-
+
             // Get Origin Info
             GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress");
             if (originPostalAddress == null) {
@@ -543,7 +543,7 @@
             }
             originPhoneNumber = StringUtil.replaceString(originPhoneNumber, "-", "");
             originPhoneNumber = StringUtil.replaceString(originPhoneNumber, " ", "");
-
+
             // lookup the two letter country code (in the geoCode field)
             GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo");
             if (originCountryGeo == null) {
@@ -574,7 +574,7 @@
             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) {
@@ -623,7 +623,7 @@
                 if (carrierShipmentBoxTypes.size() > 0) {
                     carrierShipmentBoxType = carrierShipmentBoxTypes.get(0);
                 }
-
+
                 // TODO: determine what default UoM is (assuming inches) - there should be a defaultDimensionUomId in Facility
                 if (shipmentBoxType != null) {
                     GenericValue dimensionUom = shipmentBoxType.getRelatedOne("DimensionUom");
@@ -631,7 +631,7 @@
                     width = shipmentBoxType.get("boxWidth").toString();
                     height = shipmentBoxType.get("boxHeight").toString();
                 }
-
+
                 // next step is weight determination, so skip if we have a billing weight
                 if (hasBillingWeight) continue;
 
@@ -671,7 +671,7 @@
             }
             // want the rounded weight as a string, so we use the "" + int shortcut
             String roundedWeight = weight.setScale(0, BigDecimal.ROUND_HALF_UP).toPlainString();
-
+
             // translate shipmentMethodTypeId to DHL service code
             String shipmentMethodTypeId = shipmentRouteSegment.getString("shipmentMethodTypeId");
             String dhlShipmentDetailCode = null;
@@ -690,7 +690,7 @@
             if ((shippingKey == null) || (accountNbr == null) || (shippingKey.length() == 0) || (accountNbr.length() == 0)) {
                 return ServiceUtil.returnError("DHL Shipping Credentials are not configured. (check shipment.dhl.access)");
             }
-
+
             // label image preference (PNG or GIF)
             String labelImagePreference = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.dhl.label.image.format");
             if (labelImagePreference == null) {
@@ -700,7 +700,7 @@
                 Debug.logError("Illegal shipment.dhl.label.image.format: " + labelImagePreference, module);
                 return ServiceUtil.returnError("Unknown DHL Label Image Format: " + labelImagePreference);
             }
-
+
             // create AccessRequest XML doc using FreeMarker template
             String templateName = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.template.dhl.rate.estimate");
             if ((templateName == null) || (templateName.trim().length() == 0)) {
@@ -780,7 +780,7 @@
             List<GenericValue> shipmentPackageRouteSegs) throws GenericEntityException {
         Map<String, Object> result = FastMap.newInstance();
         GenericValue shipmentPackageRouteSeg = shipmentPackageRouteSegs.get(0);
-
+
         // TODO: figure out how to handle validation on return XML, which can be mangled
         // Ideas: try again right away, let user try again, etc.
         Document rateResponseDocument = null;
@@ -799,13 +799,13 @@
             Debug.logError(e2, excErrMsg, module);
             // TODO VOID
         }
-
+
         // tracking number: Shipment/ShipmentDetail/AirbillNbr
         Element rootElement = rateResponseDocument.getDocumentElement();
         Element shipmentElement = UtilXml.firstChildElement(rootElement, "Shipment");
         Element shipmentDetailElement = UtilXml.firstChildElement(shipmentElement, "ShipmentDetail");
         String trackingNumber = UtilXml.childElementValue(shipmentDetailElement, "AirbillNbr");
-
+
         // label: Shipment/Label/Image
         Element labelElement = UtilXml.firstChildElement(shipmentElement, "Label");
         String encodedImageString = UtilXml.childElementValue(labelElement, "Image");
@@ -813,7 +813,7 @@
             Debug.logError("Cannot find response DHL shipment label.  Rate response document is: " + rateResponseString, module);
             return ServiceUtil.returnError("Cannot get response DHL shipment label for shipment package route segment " + shipmentPackageRouteSeg + ".  DHL response is: " + rateResponseString);
         }
-
+
         // TODO: this is a temporary hack to replace the newlines so that Base64 likes the input This is NOT platform independent
         int size = encodedImageString.length();
         StringBuilder sb = new StringBuilder();
@@ -823,7 +823,7 @@
             sb.append(encodedImageString.charAt(i));
         }
         byte[] labelBytes = Base64.base64Decode(sb.toString().getBytes());
-
+
         if (labelBytes != null) {
             // store in db blob
             shipmentPackageRouteSeg.setBytes("labelImage", labelBytes);
@@ -831,15 +831,15 @@
             Debug.log("Failed to either decode returned DHL label or no data found in eCommerce/Shipment/Label/Image.");
             // TODO: VOID
         }
-
+
         shipmentPackageRouteSeg.set("trackingCode", trackingNumber);
         shipmentPackageRouteSeg.set("labelHtml", sb.toString());
         shipmentPackageRouteSeg.store();
-
+
         shipmentRouteSegment.set("trackingIdNumber", trackingNumber);
         shipmentRouteSegment.put("carrierServiceStatusId", "SHRSCS_CONFIRMED");
         shipmentRouteSegment.store();
-
+
         return ServiceUtil.returnSuccess("DHL Shipment Confirmed.");
     }
 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=759254&r1=759253&r2=759254&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java Fri Mar 27 17:01:36 2009
@@ -166,7 +166,7 @@
         String faxNumber = null;
         String emailAddress = null;
         try {
-
+
             // Make sure the company exists
             GenericValue companyParty = delegator.findByPrimaryKeyCache("Party", UtilMisc.toMap("partyId", companyPartyId));
             if (companyParty == null) {
@@ -283,7 +283,7 @@
             if (UtilValidate.isEmpty(templateLocation)) {
                 return ServiceUtil.returnError("Can't find location for FDXSubscriptionRequest template - should be in " + shipmentPropertiesFile + ":shipment.template.fedex.subscription.location");
             }
-
+
             // Populate the Freemarker context
             Map<String, Object> subscriptionRequestContext = FastMap.newInstance();
             subscriptionRequestContext.put("AccountNumber", accountNumber);
@@ -348,13 +348,13 @@
 
             Element fedexSubscriptionReplyElement = fDXSubscriptionReplyDocument.getDocumentElement();
             handleErrors(fedexSubscriptionReplyElement, errorList);
-
+
             if (UtilValidate.isNotEmpty(errorList)) {
                 return ServiceUtil.returnError(errorList);
             }
-
+
             String meterNumber = UtilXml.childElementValue(fedexSubscriptionReplyElement, "MeterNumber");
-
+
             result.put("meterNumber", meterNumber);
 
         } catch ( GenericEntityException e ) {
@@ -374,7 +374,7 @@
         LocalDispatcher dispatcher = dctx.getDispatcher();
         //GenericValue userLogin = (GenericValue) context.get("userLogin");
         //Locale locale = (Locale) context.get("locale");
-
+
         String shipmentId = (String) context.get("shipmentId");
         String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
 
@@ -425,7 +425,7 @@
         if (UtilValidate.isEmpty(dropoffType)) {
             return ServiceUtil.returnError("Default dropoff type not found for Fedex ship request - should be in " + shipmentPropertiesFile + ":shipment.fedex.default.dropoffType.");
         }
-
+
         try {
 
             Map<String, Object> shipRequestContext = FastMap.newInstance();
@@ -439,18 +439,18 @@
             if (UtilValidate.isEmpty(shipmentRouteSegment)) {
                 return ServiceUtil.returnError("ShipmentRouteSegment not found with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
             }
-
+
             // Determine the Fedex carrier
             String carrierPartyId = shipmentRouteSegment.getString("carrierPartyId");
             if (! "FEDEX".equals(carrierPartyId)) {
                 return ServiceUtil.returnError("ERROR: The Carrier for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is not Fedex.");
             }
-
+
             // Check the shipmentRouteSegment's carrier status
             if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("carrierServiceStatusId")) && !"SHRSCS_NOT_STARTED".equals(shipmentRouteSegment.getString("carrierServiceStatusId"))) {
                 return ServiceUtil.returnError("ERROR: The Carrier Service Status for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is [" + shipmentRouteSegment.getString("carrierServiceStatusId") + "], but must be not-set or [SHRSCS_NOT_STARTED] to perform the Fedex Shipment Confirm operation.");
             }
-
+
             // Translate shipmentMethodTypeId to Fedex service code and carrier code
             String shipmentMethodTypeId = shipmentRouteSegment.getString("shipmentMethodTypeId");
             GenericValue carrierShipmentMethod = delegator.findByPrimaryKey("CarrierShipmentMethod", UtilMisc.toMap("shipmentMethodTypeId", shipmentMethodTypeId, "partyId", "FEDEX", "roleTypeId", "CARRIER"));
@@ -461,7 +461,7 @@
                 return ServiceUtil.returnError("No Carrier service code for carrier Fedex shipmentMethodTypeId " + shipmentMethodTypeId);
             }
             String service = carrierShipmentMethod.getString("carrierServiceCode");
-
+
             // CarrierCode is FDXG only for FEDEXGROUND and GROUNDHOMEDELIVERY services.
             boolean isGroundService = service.equals("FEDEXGROUND") || service.equals("GROUNDHOMEDELIVERY");
             String carrierCode = isGroundService ? "FDXG" : "FDXE";
@@ -475,7 +475,7 @@
             } else {
                 currencyCode = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD");
             }
-
+
             // Get and validate origin postal address
             GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress");
             if (UtilValidate.isEmpty(originPostalAddress)) {
@@ -492,7 +492,7 @@
             }
             String originAddressCountryCode = originCountryGeo.getString("geoCode");
             String originAddressStateOrProvinceCode = null;
-
+
             // Only add the StateOrProvinceCode element if the address is in USA or Canada
             if (originAddressCountryCode.equals("CA") || originAddressCountryCode.equals("US")) {
                 if (UtilValidate.isEmpty(originPostalAddress.getString("stateProvinceGeoId"))) {
@@ -501,20 +501,20 @@
                 GenericValue stateProvinceGeo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", originPostalAddress.getString("stateProvinceGeoId")));
                 originAddressStateOrProvinceCode = stateProvinceGeo.getString("geoCode");
             }
-
+
             // Get and validate origin telecom number
             GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber");
             if (UtilValidate.isEmpty(originTelecomNumber)) {
                 return ServiceUtil.returnError("OriginTelecomNumber not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
             }
             String originContactPhoneNumber = originTelecomNumber.getString("areaCode") + originTelecomNumber.getString("contactNumber");
-
+
             // Fedex doesn't want the North American country code
             if (UtilValidate.isNotEmpty(originTelecomNumber.getString("countryCode")) && !(originAddressCountryCode.equals("CA") || originAddressCountryCode.equals("US"))) {
                 originContactPhoneNumber = originTelecomNumber.getString("countryCode") + originContactPhoneNumber;
             }
             originContactPhoneNumber = originContactPhoneNumber.replaceAll("[^+\\d]", "");
-
+
             // Get the origin contact name from the owner of the origin facility
             GenericValue partyFrom = null;
             GenericValue originFacility = shipment.getRelatedOne("OriginFacility");
@@ -526,13 +526,13 @@
                     return ServiceUtil.returnError("Facility.ownerPartyId is required for Fedex shipments: shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + ", facilityId " + originFacility.getString("facilityId"));
                 }
             }
-
+
             String originContactKey = "PERSON".equals(partyFrom.getString("partyTypeId")) ? "OriginContactPersonName" : "OriginContactCompanyName";
             String originContactName = PartyHelper.getPartyName(partyFrom, false);
             if (UtilValidate.isEmpty(originContactName)) {
                 return ServiceUtil.returnError("partyIdFrom for shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + " has no name (required for Fedex shipments)" );
             }
-
+
             // Get and validate destination postal address
             GenericValue destinationPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress");
             if (UtilValidate.isEmpty(destinationPostalAddress)) {
@@ -549,7 +549,7 @@
             }
             String destinationAddressCountryCode = destinationCountryGeo.getString("geoCode");
             String destinationAddressStateOrProvinceCode = null;
-
+
             // Only add the StateOrProvinceCode element if the address is in USA or Canada
             if (destinationAddressCountryCode.equals("CA") || destinationAddressCountryCode.equals("US")) {
                 if (UtilValidate.isEmpty(destinationPostalAddress.getString("stateProvinceGeoId"))) {
@@ -558,7 +558,7 @@
                 GenericValue stateProvinceGeo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", destinationPostalAddress.getString("stateProvinceGeoId")));
                 destinationAddressStateOrProvinceCode = stateProvinceGeo.getString("geoCode");
             }
-
+
             // Get and validate destination telecom number
             GenericValue destinationTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber");
             if (UtilValidate.isEmpty(destinationTelecomNumber)) {
@@ -571,7 +571,7 @@
                 destinationContactPhoneNumber = destinationTelecomNumber.getString("countryCode") + destinationContactPhoneNumber;
             }
             destinationContactPhoneNumber = destinationContactPhoneNumber.replaceAll("[^+\\d]", "");
-
+
             // Get the destination contact name
             String destinationPartyId = shipment.getString("partyIdTo");
             if (UtilValidate.isEmpty(destinationPartyId)) {
@@ -587,7 +587,7 @@
             String homeDeliveryType = null;
             Timestamp homeDeliveryDate = null;
             if ("GROUNDHOMEDELIVERY".equals(service)) {
-
+
                 // Determine the home-delivery instructions
                 homeDeliveryType = shipmentRouteSegment.getString("homeDeliveryType");
                 if (UtilValidate.isNotEmpty(homeDeliveryType)) {
@@ -602,7 +602,7 @@
                     return ServiceUtil.returnError("homeDeliveryDate is before the current time for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
                 }
             }
-
+
             List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", UtilMisc.toList("+shipmentPackageSeqId"));
             if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) {
                 return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
@@ -610,7 +610,7 @@
             if (shipmentPackageRouteSegs.size() != 1) {
                return ServiceUtil.returnError("Cannot confirm shipment: fedexShipRequest service does not currently support more than one package per shipment.");
             }
-
+
             // TODO: Multi-piece shipments, including logic to cancel packages 1-n if FDXShipRequest n+1 fails
 
             // Populate the Freemarker context with the non-package-related information
@@ -667,13 +667,13 @@
                     Debug.logWarning("Shipment Route Segment missing billingWeightUomId in shipmentId " + shipmentId + ", assuming default shipment.fedex.weightUomId of " + weightUomId + " from " + shipmentPropertiesFile,  module);
                     billingWeightUomId = weightUomId;
                 }
-
+
                 // Convert the weight if necessary
                 if (! billingWeightUomId.equals(weightUomId)) {
                     Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", billingWeightUomId, "uomIdTo", weightUomId, "originalValue", billingWeight));
                     if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) {
                         Debug.logWarning("Unable to convert billing weights for shipmentId " + shipmentId , module);
-
+
                         // Try getting the weight from package instead
                         hasBillingWeight = false;
                     } else {
@@ -691,7 +691,7 @@
                 String packaging = null;
                 if (UtilValidate.isEmpty(shipmentBoxType)) {
                     Debug.logWarning("Package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipment " + shipmentId + " has no packaging type set - defaulting to " + shipmentPropertiesFile + ":shipment.fedex.default.packagingType", module);
-
+
                     // Try to get the default packaging type
                     packaging = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.fedex.default.packagingType");
                     if (UtilValidate.isEmpty(packaging)) {
@@ -709,7 +709,7 @@
                     return ServiceUtil.returnError("Cannot confirm shipment: Package type for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipment " + shipmentId + " is missing packagingTypeCode.");
                 }
                 packaging = carrierShipmentBoxType.getString("packagingTypeCode");
-
+
                 // Determine the dimensions of the package
                 BigDecimal dimensionsLength = null;
                 BigDecimal dimensionsWidth = null;
@@ -737,7 +737,7 @@
                                 dimensionsLength = (BigDecimal) results.get("convertedValue");
                             }
                         }
-
+
                     }
                     if (dimensionsWidth != null && dimensionsWidth.compareTo(BigDecimal.ZERO) > 0) {
                         if (! boxDimensionsUomId.equals(dimensionsUomId)) {
@@ -749,7 +749,7 @@
                                 dimensionsWidth = (BigDecimal) results.get("convertedValue");
                             }
                         }
-
+
                     }
                     if (dimensionsHeight != null && dimensionsHeight.compareTo(BigDecimal.ZERO) > 0) {
                         if (! boxDimensionsUomId.equals(dimensionsUomId)) {
@@ -761,7 +761,7 @@
                                 dimensionsHeight = (BigDecimal) results.get("convertedValue");
                             }
                         }
-
+
                     }
                 }
 
@@ -780,7 +780,7 @@
                             packageWeight = BigDecimal.ONE;
                         }
                     }
-
+
                     // Convert weight if necessary
                     String packageWeightUomId = shipmentPackage.getString("weightUomId");
                     if (UtilValidate.isEmpty(packageWeightUomId)) {
@@ -800,7 +800,7 @@
                 if (weight == null || weight.compareTo(BigDecimal.ZERO) < 0) {
                     ServiceUtil.returnError("Unable to determine weight for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId);
                 }
-
+
                 // Populate the Freemarker context with package-related information
                 shipRequestContext.put("CustomerReference", shipmentId + ":" + shipmentRouteSegmentId + ":" + shipmentPackage.getString("shipmentPackageSeqId"));
                 shipRequestContext.put("DropoffType", dropoffType);
@@ -816,7 +816,7 @@
                 }
                 shipRequestContext.put("Weight", weight.setScale(1, BigDecimal.ROUND_UP).toString());
             }
-
+
             StringWriter outWriter = new StringWriter();
             try {
                 FreeMarkerWorker.renderTemplateAtLocation(templateLocation, shipRequestContext, outWriter);
@@ -825,7 +825,7 @@
                 Debug.logError(e, errorMessage, module);
                 return ServiceUtil.returnError(errorMessage + ": " + e.getMessage());
             }
-
+
             // Pass the request string to the sending method
             String fDXShipRequestString = outWriter.toString();
             String fDXShipReplyString = null;
@@ -839,7 +839,7 @@
                 Debug.logError(e, errorMessage, module);
                 return ServiceUtil.returnError(errorMessage + e.toString());
             }
-
+
             // Pass the reply to the handler method
             return handleFedexShipReply(fDXShipReplyString, shipmentRouteSegment, shipmentPackageRouteSegs);
 
@@ -879,11 +879,11 @@
             Debug.logError(ioe, errorMessage, module);
             // TODO Cancel the package
         }
-
+
         if (UtilValidate.isEmpty(fdxShipReplyDocument)) {
             return ServiceUtil.returnError("Error parsing the FDXShipReply.");
         }
-
+
         // Tracking number: Tracking/TrackingNumber
         Element rootElement = fdxShipReplyDocument.getDocumentElement();
 
@@ -895,7 +895,7 @@
 
         Element trackingElement = UtilXml.firstChildElement(rootElement, "Tracking");
         String trackingNumber = UtilXml.childElementValue(trackingElement, "TrackingNumber");
-
+
         // Label: Labels/OutboundLabel
         Element labelElement = UtilXml.firstChildElement(rootElement, "Labels");
         String encodedImageString = UtilXml.childElementValue(labelElement, "OutboundLabel");
@@ -903,30 +903,30 @@
             Debug.logError("Cannot find FDXShipReply label. FDXShipReply document is: " + fDXShipReplyString, module);
             return ServiceUtil.returnError("Cannot get FDXShipReply label for shipment package route segment " + shipmentPackageRouteSeg + ".  FedEx response is: " + fDXShipReplyString);
         }
-
+
         byte[] labelBytes = Base64.base64Decode(encodedImageString.getBytes());
-
+
         if (labelBytes != null) {
-
+
             // Store in db blob
             shipmentPackageRouteSeg.setBytes("labelImage", labelBytes);
         } else {
             Debug.log("Failed to either decode returned FedEx label or no data found in Labels/OutboundLabel.");
             // TODO: Cancel the package
         }
-
+
         shipmentPackageRouteSeg.set("trackingCode", trackingNumber);
         shipmentPackageRouteSeg.set("labelHtml", encodedImageString);
         shipmentPackageRouteSeg.store();
-
+
         shipmentRouteSegment.set("trackingIdNumber", trackingNumber);
         shipmentRouteSegment.put("carrierServiceStatusId", "SHRSCS_CONFIRMED");
         shipmentRouteSegment.store();
-
+
         return ServiceUtil.returnSuccess("FedEx Shipment Confirmed.");
 
     }
-
+
     public static void handleErrors(Element rootElement, List<Object> errorList) {
         Element errorElement = null;
         if ("Error".equalsIgnoreCase(rootElement.getNodeName())) {