svn commit: r798825 - /ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml

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

svn commit: r798825 - /ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml

lektran
Author: lektran
Date: Wed Jul 29 09:46:50 2009
New Revision: 798825

URL: http://svn.apache.org/viewvc?rev=798825&view=rev
Log:
Prevent service errors if for some reason the desired PartyContactMechPurpose record is not found

Modified:
    ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?rev=798825&r1=798824&r2=798825&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml Wed Jul 29 09:46:50 2009
@@ -287,21 +287,36 @@
             <!-- get QOH, ATP quantities and find ProductFacility which has the minimum stock -->
             <call-simple-method method-name="getProductFacilityAndQuantities"/>
 
-            <if-not-empty field="productFacility.minimumStock">
+            <entity-one entity-name="OrderHeader" value-field="orderHeader" auto-field-map="true"/>
+            <entity-one entity-name="ProductStore" value-field="productStore">
+                <field-map field-name="productStoreId" from-field="orderHeader.productStoreId"/>
+            </entity-one>
+            <set field="minimumStock" from-field="productFacility.minimumStock"/>
+            <set field="reorderQuantity" from-field="productFacility.reorderQuantity"/>
+            <if-compare-field field="productStore.isSpecialPeriod" operator="equals" to-field="productFacility.specialPeriodTypeId">
+                <if-not-empty field="productFacility.specialMinimumStock">
+                    <set field="minimumStock" from-field="productFacility.specialMinimumStock"/>
+                </if-not-empty>
+                <if-not-empty field="productFacility.specialReorderQuantity">
+                   <set field="reorderQuantity" from-field="productFacility.specialReorderQuantity"/>
+                </if-not-empty>
+            </if-compare-field>
+
+            <if-not-empty field="minimumStock">
                 <!-- No requirements are created if we are not under stock -->
                 <!-- this service is supposed to be called after inventory is reserved, so inventory should have been updated already -->
-                <if-compare-field field="availableToPromiseTotal" to-field="productFacility.minimumStock" operator="less" type="BigDecimal">
+                <if-compare-field field="availableToPromiseTotal" to-field="minimumStock" operator="less" type="BigDecimal">
                     <calculate field="oldAvailableToPromise">
                         <calcop field="availableToPromiseTotal" operator="add">
                             <calcop operator="get" field="parameters.quantity"/>
                         </calcop>
                     </calculate>
                     <!-- If before this reservation the availableToPromiseTotal was over minimumStock, create a new requirement -->
-                    <if-compare-field field="oldAvailableToPromise" to-field="productFacility.minimumStock" operator="greater-equals" type="BigDecimal">
+                    <if-compare-field field="oldAvailableToPromise" to-field="minimumStock" operator="greater-equals" type="BigDecimal">
                         <set from-field="inventoryItem.productId" field="inputMap.productId"/>
                         <set from-field="productFacility.facilityId" field="inputMap.facilityId"/>
-                        <if-not-empty field="productFacility.reorderQuantity">
-                            <set from-field="productFacility.reorderQuantity" field="inputMap.quantity"/>
+                        <if-not-empty field="reorderQuantity">
+                            <set from-field="reorderQuantity" field="inputMap.quantity"/>
                         <else>
                             <set from-field="parameters.quantity" field="inputMap.quantity"/>
                         </else>
@@ -1019,9 +1034,11 @@
                         <field-map field-name="contactMechPurposeTypeId" value="BILLING_LOCATION"/>
                     </entity-and>
                     <first-from-list entry="pcmp" list="pcmpList"/>
-                    <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map="pcmp" to-map="serviceInMap"/>
-                    <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
-                    <clear-field field="serviceInMap"/>
+                    <if-not-empty field="pcmp">
+                    <set-service-fields service-name="deletePartyContactMechPurposeIfExists" map="pcmp" to-map="serviceInMap"/>
+                    <call-service service-name="deletePartyContactMechPurposeIfExists" in-map-name="serviceInMap"/>
+                    <clear-field field="serviceInMap"/>
+                    </if-not-empty>
                     <if-compare field="keepAddressBook" operator="equals" value="N">
                         <set-service-fields service-name="deletePartyContactMech" map="pcmp" to-map="serviceInMap"/>
                         <call-service service-name="deletePartyContactMech" in-map-name="serviceInMap"/>