svn commit: r671906 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java

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

svn commit: r671906 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java

jacopoc
Author: jacopoc
Date: Thu Jun 26 07:03:10 2008
New Revision: 671906

URL: http://svn.apache.org/viewvc?rev=671906&view=rev
Log:
Weight/Quantity/PriceQuantityBreak records may be used by other ShipmentCostEstimate records; if the service is unable to delete them it should not throw an error message.

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java

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=671906&r1=671905&r2=671906&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 Thu Jun 26 07:03:10 2008
@@ -132,15 +132,30 @@
         try {
             estimate = delegator.findByPrimaryKey("ShipmentCostEstimate", UtilMisc.toMap("shipmentCostEstimateId", shipmentCostEstimateId));
             estimate.remove();
-            if (estimate.get("weightBreakId") != null)
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+            return ServiceUtil.returnError("Problem removing entity or related entities (" + e.toString() + ")");
+        }
+        try {
+            if (estimate.get("weightBreakId") != null) {
                 delegator.removeRelated("WeightQuantityBreak", estimate);
-            if (estimate.get("quantityBreakId") != null)
+            }
+        } catch (GenericEntityException e) {
+            Debug.logInfo("Not removing WeightQuantityBreak records related to ShipmentCostEstimate [" + shipmentCostEstimateId + "] because they are used by other entities.", module);
+        }
+        try {
+            if (estimate.get("quantityBreakId") != null) {
                 delegator.removeRelated("QuantityQuantityBreak", estimate);
-            if (estimate.get("priceBreakId") != null)
+            }
+        } catch (GenericEntityException e) {
+            Debug.logInfo("Not removing QuantityQuantityBreak records related to ShipmentCostEstimate [" + shipmentCostEstimateId + "] because they are used by other entities.", module);
+        }
+        try {
+            if (estimate.get("priceBreakId") != null) {
                 delegator.removeRelated("PriceQuantityBreak", estimate);
+            }
         } catch (GenericEntityException e) {
-            Debug.logError(e, module);
-            return ServiceUtil.returnError("Problem removing entity or related entities (" + e.toString() + ")");
+            Debug.logInfo("Not removing PriceQuantityBreak records related to ShipmentCostEstimate [" + shipmentCostEstimateId + "] because they are used by other entities.", module);
         }
         return ServiceUtil.returnSuccess();
     }