svn commit: r644956 - in /ofbiz/trunk/applications/product: entitydef/entitymodel.xml script/org/ofbiz/product/inventory/InventoryServices.xml webapp/catalog/store/ProductStoreForms.xml

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

svn commit: r644956 - in /ofbiz/trunk/applications/product: entitydef/entitymodel.xml script/org/ofbiz/product/inventory/InventoryServices.xml webapp/catalog/store/ProductStoreForms.xml

jacopoc
Author: jacopoc
Date: Fri Apr  4 15:10:47 2008
New Revision: 644956

URL: http://svn.apache.org/viewvc?rev=644956&view=rev
Log:
Added field (and logic) to product store to enable/disable the recalculation of reservations for new backorders.

Modified:
    ofbiz/trunk/applications/product/entitydef/entitymodel.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
    ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=644956&r1=644955&r2=644956&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Fri Apr  4 15:10:47 2008
@@ -3379,6 +3379,9 @@
       <field name="reserveInventory" type="indicator"></field>
       <field name="reserveOrderEnumId" type="id"></field>
       <field name="requireInventory" type="indicator"></field>
+      <field name="balanceResOnOrderCreation" type="indicator">
+          <description>If set to Y, when a new sales order is created with backordered items, then reservations on the facility/product are reassigned according to the priority given by the shipBeforeDate field.</description>
+      </field>
       <field name="requirementMethodEnumId" type="id"></field>
       <field name="orderNumberPrefix" type="id-long"></field>
       <field name="defaultLocaleString" type="very-short"></field>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml?rev=644956&r1=644955&r2=644956&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml Fri Apr  4 15:10:47 2008
@@ -943,29 +943,36 @@
     </simple-method>
 
     <simple-method method-name="balanceOrderItemsWithNegativeReservations" short-description="To balance order items with negative reservations">
-        <entity-condition entity-name="OrderItemShipGrpInvResAndItem" list-name="oisgirais">
-            <condition-list combine="and">
-                <condition-expr field-name="orderId" operator="equals" env-name="parameters.orderId"/>
-                <condition-expr field-name="quantityNotAvailable" operator="greater" value="0"/>
-                <condition-expr field-name="quantityNotAvailable" operator="not-equals" value=""/>
-                <condition-expr field-name="quantityNotAvailable" operator="not-equals" env-name="nullField"/>
-            </condition-list>
-        </entity-condition>
-        <iterate list-name="oisgirais" entry-name="oisgir">
-            <set field="orderItems.${oisgir.orderItemSeqId}" from-field="oisgir"/>
-        </iterate>
-        <now-timestamp-to-env env-name="nowTimestamp"/>
-        <iterate-map key-name="orderItemSeqId" value-name="oisgir" map-name="orderItems">
-            <set field="reassignInventoryReservationsCtx.productId" from-field="oisgir.productId"/>
-            <set field="reassignInventoryReservationsCtx.facilityId" from-field="oisgir.facilityId"/>
-            <if-not-empty field-name="oisgir.shipBeforeDate">
-                <set field="reassignInventoryReservationsCtx.fromDate" from-field="oisgir.shipBeforeDate"/>
+        <entity-one entity-name="OrderHeader" value-name="orderHeader" auto-field-map="true"/>
+        <get-related-one value-name="orderHeader" relation-name="ProductStore" to-value-name="productStore"/>
+        <if-compare field-name="productStore.balanceResOnOrderCreation" operator="equals" value="Y">
+            <entity-condition entity-name="OrderItemAndShipGrpInvResAndItem" list-name="oisgirais">
+                <condition-list combine="and">
+                    <condition-expr field-name="orderId" operator="equals" env-name="parameters.orderId"/>
+                    <condition-expr field-name="quantityNotAvailable" operator="greater" value="0"/>
+                    <condition-expr field-name="quantityNotAvailable" operator="not-equals" value=""/>
+                    <condition-expr field-name="quantityNotAvailable" operator="not-equals" env-name="nullField"/>
+                </condition-list>
+            </entity-condition>
+            <iterate list-name="oisgirais" entry-name="oisgir">
+                <set field="orderItems.${oisgir.orderItemSeqId}" from-field="oisgir"/>
+            </iterate>
+            <now-timestamp-to-env env-name="nowTimestamp"/>
+            <iterate-map key-name="orderItemSeqId" value-name="oisgir" map-name="orderItems">
+                <set field="reassignInventoryReservationsCtx.productId" from-field="oisgir.productId"/>
+                <set field="reassignInventoryReservationsCtx.facilityId" from-field="oisgir.facilityId"/>
+                <if-not-empty field-name="oisgir.shipBeforeDate">
+                    <set field="reassignInventoryReservationsCtx.fromDate" from-field="oisgir.shipBeforeDate"/>
+                <else>
+                    <set field="reassignInventoryReservationsCtx.fromDate" from-field="nowTimestamp"/>
+                </else>
+                </if-not-empty>
+                <call-service service-name="reassignInventoryReservations" in-map-name="reassignInventoryReservationsCtx"/>
+            </iterate-map>
             <else>
-                <set field="reassignInventoryReservationsCtx.fromDate" from-field="nowTimestamp"/>
+                <log level="info" message="Not reassigning the reservations because productStore.balanceResOnOrderCreation is set to N or null."/>
             </else>
-            </if-not-empty>
-            <call-service service-name="reassignInventoryReservations" in-map-name="reassignInventoryReservationsCtx"/>
-        </iterate-map>
+        </if-compare>
      </simple-method>
 
     <!-- Inventory Transfer Services -->

Modified: ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml?rev=644956&r1=644955&r2=644956&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml Fri Apr  4 15:10:47 2008
@@ -112,6 +112,9 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field name="balanceResOnOrderCreation">
+            <drop-down allow-empty="false" no-current-selected-key="N"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down>
+        </field>
         <field name="oneInventoryFacility">
             <drop-down allow-empty="true" no-current-selected-key="Y"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down>
         </field>