svn commit: r882555 - in /ofbiz/trunk/applications/product: config/ProductErrorUiLabels.xml script/org/ofbiz/shipment/shipment/ShipmentServices.xml

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

svn commit: r882555 - in /ofbiz/trunk/applications/product: config/ProductErrorUiLabels.xml script/org/ofbiz/shipment/shipment/ShipmentServices.xml

mor-2
Author: mor
Date: Fri Nov 20 13:58:42 2009
New Revision: 882555

URL: http://svn.apache.org/viewvc?rev=882555&view=rev
Log:
Added user friendly error messages following scenarios:

Case 1
(a) Go to Facility -> Shipment, click on New Shipment link.
(b) Select "Status Id = Input", "Origin Facility = Web Store Warehouse" & "Shipment type Id = Sales Shipment" then depress Update button.
(c) Now depress Items tab, enter product Id & quantity then depress create button.
(d) Select "New" for Add to Package dropdown and depress Add button.
(e) Now depress Delete button for Item then it will show error message that can be understood by a warehouse manager.

Case 2

(a) Follow #a to #d process in Case 1
(b) Depress Packages tab.
(c) Depress Delete button for Package then it will show error message that can be understood by a warehouse manager.

Modified:
    ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml

Modified: ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=882555&r1=882554&r2=882555&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml Fri Nov 20 13:58:42 2009
@@ -100,6 +100,12 @@
     <property key="ProductErrorPackageWeightCannotBeNullOrZero">
         <value xml:lang="en">ERROR: Package weight cannot be null/zero, it should be greater than zero</value>
     </property>
+    <property key="ProductErrorShipmentItemCannotBeDeleted">
+        <value xml:lang="en">ERROR: Shipment Item cannot be deleted and require Shipment Package Content to be deleted first</value>
+    </property>
+    <property key="ProductErrorShipmentPackageCannotBeDeleted">
+        <value xml:lang="en">ERROR: Shipment Package cannot be deleted and require Shipment Package Content to be deleted first</value>
+    </property>
     <property key="ProductErrorVerifiedQtyDoesNotMatchTheReservedQtyForItem">
         <value xml:lang="en">ERROR: Verified quantity does not match the reserved quantity for item #${productId} [verified qty = ${verifiedQty} / reserved qty = ${reservedQty}]</value>
     </property>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?rev=882555&r1=882554&r2=882555&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Fri Nov 20 13:58:42 2009
@@ -831,11 +831,24 @@
         <set value="Delete ShipmentItem" field="operationName"/>
         <call-simple-method method-name="checkCanChangeShipmentStatusPacked"/>
         <check-errors/>
-
-        <make-value value-field="lookupPKMap" entity-name="ShipmentItem"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key entity-name="ShipmentItem" map="lookupPKMap" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
+        <!-- If there is any Shipment Package Content available for this Shipment Item then it cannot be deleted as it require
+                Shipment Package content to be deleted first -->
+        <entity-and entity-name="ShipmentPackageContent" list="shipmentPackageContents">
+            <field-map field-name="shipmentId" from-field="parameters.shipmentId"/>
+            <field-map field-name="shipmentItemSeqId" from-field="parameters.shipmentItemSeqId"/>
+        </entity-and>
+        <if-not-empty field="shipmentPackageContents">
+            <add-error>
+                <fail-property property="ProductErrorShipmentItemCannotBeDeleted" resource="ProductErrorUiLabels"/>
+            </add-error>
+            <check-errors/>
+        <else>
+            <make-value value-field="lookupPKMap" entity-name="ShipmentItem"/>
+            <set-pk-fields map="parameters" value-field="lookupPKMap"/>
+            <find-by-primary-key entity-name="ShipmentItem" map="lookupPKMap" value-field="lookedUpValue"/>
+            <remove-value value-field="lookedUpValue"/>
+        </else>
+        </if-not-empty>
     </simple-method>
 
     <simple-method method-name="splitShipmentItemByQuantity" short-description="splitShipmentItemByQuantity">
@@ -971,9 +984,22 @@
         <set value="Delete ShipmentPackage" field="operationName"/>
         <call-simple-method method-name="checkCanChangeShipmentStatusPacked"/>
         <check-errors/>
-
-        <entity-one entity-name="ShipmentPackage" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
+        <!-- If there is any Shipment Package Content available for this shipment than Shipment Package cannot be deleted as it require
+             Shipment Package Content to be deleted first -->
+        <entity-and entity-name="ShipmentPackageContent" list="shipmentPackageContents">
+            <field-map field-name="shipmentId" from-field="parameters.shipmentId"/>
+            <field-map field-name="shipmentPackageSeqId" from-field="parameters.shipmentPackageSeqId"/>
+        </entity-and>
+        <if-not-empty field="shipmentPackageContents">
+            <add-error>
+                <fail-property property="ProductErrorShipmentPackageCannotBeDeleted" resource="ProductErrorUiLabels"/>
+            </add-error>
+            <check-errors/>
+        <else>
+            <entity-one entity-name="ShipmentPackage" value-field="lookedUpValue"/>
+            <remove-value value-field="lookedUpValue"/>
+        </else>
+        </if-not-empty>
     </simple-method>
     <simple-method method-name="ensurePackageRouteSeg" short-description="Ensure ShipmentPackageRouteSeg exists for all RouteSegments for this Package">
         <entity-and entity-name="ShipmentRouteSegment" list="shipmentRouteSegments">