svn commit: r485144 - in /incubator/ofbiz/trunk/applications: manufacturing/src/org/ofbiz/manufacturing/bom/ order/config/ order/data/ order/entitydef/ order/src/org/ofbiz/order/order/ order/src/org/ofbiz/order/shoppingcart/ order/webapp/ordermgr/order...

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

svn commit: r485144 - in /incubator/ofbiz/trunk/applications: manufacturing/src/org/ofbiz/manufacturing/bom/ order/config/ order/data/ order/entitydef/ order/src/org/ofbiz/order/order/ order/src/org/ofbiz/order/shoppingcart/ order/webapp/ordermgr/order...

jacopoc
Author: jacopoc
Date: Sun Dec 10 00:19:40 2006
New Revision: 485144

URL: http://svn.apache.org/viewvc?view=rev&rev=485144
Log:
Based on a recent discussion on the dev mailing list, I've now refactored the entities and code to associate order items:
* OrderItemAssociation has been deprecated and renamed to OldOrderItemAssociation
* two new entities has been added: OrderItemAssoc and OrderItemAssocType
* all the code that was using the OrderItemAssociation entity has been modified to use the new entity
* added seed data for the OrderItemAssocType
Now the new entity can be used not only to store an association between a sales order item and a purchase order item, but also different kinds of relations, such as drop shipments, replacements, new versions of orders etc...

I'm going to commit (in my next commit) a service that can be used to migrate data from the old entity to the new ones.

Modified:
    incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml
    incubator/ofbiz/trunk/applications/order/entitydef/entitygroup.xml
    incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml
    incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_old.xml
    incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
    incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh
    incubator/ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl

Modified: incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java (original)
+++ incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMTree.java Sun Dec 10 00:19:40 2006
@@ -317,7 +317,7 @@
     /** It visits the in-memory tree that represents a bill of materials
      * and it creates a manufacturing order for each of the nodes that needs
      * to be manufactured.
-     * @param orderId The (sales) order id for which the manufacturing orders are created. If specified (together with orderItemSeqId) a link between the two order lines is created in the OrderItemAssociation entity. If null, no link is created.
+     * @param orderId The (sales) order id for which the manufacturing orders are created. If specified (together with orderItemSeqId) a link between the two order lines is created. If null, no link is created.
      * @param orderItemSeqId
      * @param delegator The delegator used.
      * @throws GenericEntityException If a db problem occurs.

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties Sun Dec 10 00:19:40 2006
@@ -233,6 +233,7 @@
 OrderItemsSubTotal=Items SubTotal
 OrderJurisdiction=Jurisdiction
 OrderLinkedToOrderItem=Linked to order item
+OrderLinkedFromOrderItem=Linked from order item
 OrderLinkedToQuote=Linked to quote
 OrderLinkedToRequirement=Linked to requirement
 OrderLookupOrder=Lookup Order(s)

Modified: incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml (original)
+++ incubator/ofbiz/trunk/applications/order/data/OrderTypeData.xml Sun Dec 10 00:19:40 2006
@@ -62,6 +62,11 @@
     <OrderType description="Purchase" hasTable="N" orderTypeId="PURCHASE_ORDER" parentTypeId=""/>
     <OrderType description="Sales" hasTable="N" orderTypeId="SALES_ORDER" parentTypeId=""/>
 
+    <OrderItemAssocType description="Purchase Order" hasTable="N" orderItemAssocTypeId="PURCHASE_ORDER" parentTypeId=""/>
+    <OrderItemAssocType description="Drop Shipment" hasTable="N" orderItemAssocTypeId="DROP_SHIPMENT" parentTypeId=""/>
+    <OrderItemAssocType description="Return Replacement" hasTable="N" orderItemAssocTypeId="REPLACEMENT" parentTypeId=""/>
+    <OrderItemAssocType description="New Version" hasTable="N" orderItemAssocTypeId="NEW_VERSION" parentTypeId=""/>
+
     <EnumerationType description="Order Sales Channel" enumTypeId="ORDER_SALES_CHANNEL" hasTable="N" parentTypeId=""/>
     <Enumeration description="Web Channel" enumCode="WEB_CHANNEL" enumId="WEB_SALES_CHANNEL" sequenceId="01" enumTypeId="ORDER_SALES_CHANNEL"/>
     <Enumeration description="POS Channel" enumCode="POS_CHANNEL" enumId="POS_SALES_CHANNEL" sequenceId="02" enumTypeId="ORDER_SALES_CHANNEL"/>

Modified: incubator/ofbiz/trunk/applications/order/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/entitydef/entitygroup.xml?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/entitydef/entitygroup.xml (original)
+++ incubator/ofbiz/trunk/applications/order/entitydef/entitygroup.xml Sun Dec 10 00:19:40 2006
@@ -55,7 +55,9 @@
     <entity-group group="org.ofbiz" entity="OrderItemAndProductContentInfo" />
     <entity-group group="org.ofbiz" entity="OrderItemAndShipGroupAssoc" />
     <entity-group group="org.ofbiz" entity="OrderItemAndShipGrpInvResAndItem" />
-    <entity-group group="org.ofbiz" entity="OrderItemAssociation" />
+    <entity-group group="org.ofbiz" entity="OldOrderItemAssociation" />
+    <entity-group group="org.ofbiz" entity="OrderItemAssoc" />
+    <entity-group group="org.ofbiz" entity="OrderItemAssocType" />
     <entity-group group="org.ofbiz" entity="OrderItemAttribute" />
     <entity-group group="org.ofbiz" entity="OrderItemBilling" />
     <entity-group group="org.ofbiz" entity="OrderItemContactMech" />

Modified: incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
+++ incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml Sun Dec 10 00:19:40 2006
@@ -518,33 +518,74 @@
         <index-field name="externalId"/>
       </index>
     </entity>
-    <entity entity-name="OrderItemAssociation"
+    <entity entity-name="OrderItemAssoc"
             package-name="org.ofbiz.order.order"
             never-cache="true"
-            title="Order Item Association Entity">
-      <field name="salesOrderId" type="id-ne"></field>
-      <field name="soItemSeqId" type="id-ne"></field>
-      <field name="purchaseOrderId" type="id-ne"></field>
-      <field name="poItemSeqId" type="id-ne"></field>
-      <prim-key field="salesOrderId"/>
-      <prim-key field="soItemSeqId"/>
-      <prim-key field="purchaseOrderId"/>
-      <prim-key field="poItemSeqId"/>
-      <relation type="one" fk-name="ORDER_ITASSC_SOHD" title="Sales" rel-entity-name="OrderHeader">
-        <key-map field-name="salesOrderId" rel-field-name="orderId"/>
-      </relation>
-      <relation type="one-nofk" title="Sales" rel-entity-name="OrderItem">
-        <key-map field-name="salesOrderId" rel-field-name="orderId"/>
-        <key-map field-name="soItemSeqId" rel-field-name="orderItemSeqId"/>
-      </relation>
-      <relation type="one" fk-name="ORDER_ITASSC_POHD" title="Purchase" rel-entity-name="OrderHeader">
-        <key-map field-name="purchaseOrderId" rel-field-name="orderId"/>
-      </relation>
-      <relation type="one-nofk" title="Purchase" rel-entity-name="OrderItem">
-        <key-map field-name="purchaseOrderId" rel-field-name="orderId"/>
-        <key-map field-name="poItemSeqId" rel-field-name="orderItemSeqId"/>
+            title="Order Item Assoc Entity">
+      <field name="orderId" type="id-ne"></field>
+      <field name="orderItemSeqId" type="id-ne"></field>
+      <field name="shipGroupSeqId" type="id-ne"></field>
+      <field name="toOrderId" type="id-ne"></field>
+      <field name="toOrderItemSeqId" type="id-ne"></field>
+      <field name="toShipGroupSeqId" type="id-ne"></field>
+      <field name="orderItemAssocTypeId" type="id-ne"></field>
+      <field name="quantity" type="floating-point"></field>
+      <prim-key field="orderId"/>
+      <prim-key field="orderItemSeqId"/>
+      <prim-key field="shipGroupSeqId"/>
+      <prim-key field="toOrderId"/>
+      <prim-key field="toOrderItemSeqId"/>
+      <prim-key field="toShipGroupSeqId"/>
+      <prim-key field="orderItemAssocTypeId"/>
+      <relation type="one" fk-name="ORDER_ITASS_TYPE" rel-entity-name="OrderItemAssocType">
+        <key-map field-name="orderItemAssocTypeId"/>
+      </relation>
+      <relation type="one" fk-name="ORDER_ITASS_FRHD" title="From" rel-entity-name="OrderHeader">
+        <key-map field-name="orderId" rel-field-name="orderId"/>
+      </relation>
+      <relation type="one-nofk" title="From" rel-entity-name="OrderItem">
+        <key-map field-name="orderId"/>
+        <key-map field-name="orderItemSeqId"/>
+      </relation>
+      <relation type="one-nofk" title="From" rel-entity-name="OrderItemShipGroupAssoc">
+        <key-map field-name="orderId"/>
+        <key-map field-name="orderItemSeqId"/>
+        <key-map field-name="shipGroupSeqId"/>
+      </relation>
+      <relation type="one-nofk" title="From" rel-entity-name="OrderItemShipGroup">
+        <key-map field-name="orderId"/>
+        <key-map field-name="shipGroupSeqId"/>
+      </relation>
+      <relation type="one" fk-name="ORDER_ITASS_TOHD" title="To" rel-entity-name="OrderHeader">
+        <key-map field-name="toOrderId" rel-field-name="orderId"/>
+      </relation>
+      <relation type="one-nofk" title="To" rel-entity-name="OrderItem">
+        <key-map field-name="toOrderId" rel-field-name="orderId"/>
+        <key-map field-name="toOrderItemSeqId" rel-field-name="orderItemSeqId"/>
+      </relation>
+      <relation type="one-nofk" title="To" rel-entity-name="OrderItemShipGroupAssoc">
+        <key-map field-name="toOrderId" rel-field-name="orderId"/>
+        <key-map field-name="toOrderItemSeqId" rel-field-name="orderItemSeqId"/>
+        <key-map field-name="toShipGroupSeqId" rel-field-name="shipGroupSeqId"/>
+      </relation>
+      <relation type="one-nofk" title="To" rel-entity-name="OrderItemShipGroup">
+        <key-map field-name="toOrderId" rel-field-name="orderId"/>
+        <key-map field-name="toShipGroupSeqId" rel-field-name="shipGroupSeqId"/>
+      </relation>
+    </entity>
+    <entity entity-name="OrderItemAssocType"
+            package-name="org.ofbiz.order.order"
+            title="Order Item Assoc Type Entity">
+      <field name="orderItemAssocTypeId" type="id-ne"></field>
+      <field name="parentTypeId" type="id-ne"></field>
+      <field name="hasTable" type="indicator"></field>
+      <field name="description" type="description"></field>
+      <prim-key field="orderItemAssocTypeId"/>
+      <relation type="one" fk-name="ORDER_ITAS_TYPPAR" title="Parent" rel-entity-name="OrderItemAssocType">
+        <key-map field-name="parentTypeId" rel-field-name="orderItemAssocTypeId"/>
       </relation>
     </entity>
+
     <entity entity-name="OrderItemAttribute"
             package-name="org.ofbiz.order.order"
             title="Order Item Attribute Entity">

Modified: incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_old.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_old.xml?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_old.xml (original)
+++ incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_old.xml Sun Dec 10 00:19:40 2006
@@ -37,6 +37,34 @@
     <!-- org.ofbiz.order.order -->
     <!-- ========================================================= -->
 
+    <entity entity-name="OldOrderItemAssociation" table-name="ORDER_ITEM_ASSOCIATION"
+            package-name="org.ofbiz.order.order"
+            never-cache="true"
+            title="The OLD Order Item Association Entity (replaced by OrderItemAssoc)">
+      <field name="salesOrderId" type="id-ne"></field>
+      <field name="soItemSeqId" type="id-ne"></field>
+      <field name="purchaseOrderId" type="id-ne"></field>
+      <field name="poItemSeqId" type="id-ne"></field>
+      <prim-key field="salesOrderId"/>
+      <prim-key field="soItemSeqId"/>
+      <prim-key field="purchaseOrderId"/>
+      <prim-key field="poItemSeqId"/>
+      <relation type="one" fk-name="ORDER_ITASSC_SOHD" title="Sales" rel-entity-name="OrderHeader">
+        <key-map field-name="salesOrderId" rel-field-name="orderId"/>
+      </relation>
+      <relation type="one-nofk" title="Sales" rel-entity-name="OrderItem">
+        <key-map field-name="salesOrderId" rel-field-name="orderId"/>
+        <key-map field-name="soItemSeqId" rel-field-name="orderItemSeqId"/>
+      </relation>
+      <relation type="one" fk-name="ORDER_ITASSC_POHD" title="Purchase" rel-entity-name="OrderHeader">
+        <key-map field-name="purchaseOrderId" rel-field-name="orderId"/>
+      </relation>
+      <relation type="one-nofk" title="Purchase" rel-entity-name="OrderItem">
+        <key-map field-name="purchaseOrderId" rel-field-name="orderId"/>
+        <key-map field-name="poItemSeqId" rel-field-name="orderItemSeqId"/>
+      </relation>
+    </entity>
+
     <entity entity-name="OldOrderItemInventoryRes" table-name="ORDER_ITEM_INVENTORY_RES"
             package-name="org.ofbiz.order.order"
             never-cache="true"

Modified: incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml (original)
+++ incubator/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml Sun Dec 10 00:19:40 2006
@@ -147,12 +147,6 @@
       <relation type="many" rel-entity-name="OrderContactMech">
         <key-map field-name="orderId"/>
       </relation>
-      <relation type="many" title="Sales" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="salesOrderId"/>
-      </relation>
-      <relation type="many" title="Purchase" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="purchaseOrderId"/>
-      </relation>
       <relation type="many" rel-entity-name="OrderItemBilling">
         <key-map field-name="orderId"/>
       </relation>
@@ -264,12 +258,6 @@
       <relation type="many" rel-entity-name="OrderContactMech">
         <key-map field-name="orderId"/>
       </relation>
-      <relation type="many" title="Sales" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="salesOrderId"/>
-      </relation>
-      <relation type="many" title="Purchase" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="purchaseOrderId"/>
-      </relation>
       <relation type="many" rel-entity-name="OrderItemBilling">
         <key-map field-name="orderId"/>
       </relation>
@@ -387,12 +375,6 @@
       <relation type="many" rel-entity-name="OrderContactMech">
         <key-map field-name="orderId"/>
       </relation>
-      <relation type="many" title="Sales" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="salesOrderId"/>
-      </relation>
-      <relation type="many" title="Purchase" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="purchaseOrderId"/>
-      </relation>
       <relation type="many" rel-entity-name="OrderItemBilling">
         <key-map field-name="orderId"/>
       </relation>
@@ -503,12 +485,6 @@
       </relation>
       <relation type="many" rel-entity-name="OrderContactMech">
         <key-map field-name="orderId"/>
-      </relation>
-      <relation type="many" title="Sales" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="salesOrderId"/>
-      </relation>
-      <relation type="many" title="Purchase" rel-entity-name="OrderItemAssociation">
-        <key-map field-name="orderId" rel-field-name="purchaseOrderId"/>
       </relation>
       <relation type="many" rel-entity-name="OrderItemBilling">
         <key-map field-name="orderId"/>

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sun Dec 10 00:19:40 2006
@@ -804,7 +804,7 @@
             Iterator oia = orderItemAssociations.iterator();
             while (oia.hasNext()) {
                 GenericValue orderItemAssociation = (GenericValue) oia.next();
-                orderItemAssociation.set("purchaseOrderId", orderId);
+                orderItemAssociation.set("toOrderId", orderId);
                 toBeStored.add(orderItemAssociation);
             }
         }

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sun Dec 10 00:19:40 2006
@@ -3459,10 +3459,13 @@
                         // TODO: multiple commitments for the same requirement are still not supported
                         GenericValue commitment = EntityUtil.getFirst(commitments);
                         if (commitment != null) {
-                            GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssociation", null);
-                            orderItemAssociation.set("salesOrderId", commitment.getString("orderId"));
-                            orderItemAssociation.set("soItemSeqId", commitment.getString("orderItemSeqId"));
-                            orderItemAssociation.set("poItemSeqId", item.getOrderItemSeqId());
+                            GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc", null);
+                            orderItemAssociation.set("orderId", commitment.getString("orderId"));
+                            orderItemAssociation.set("orderItemSeqId", commitment.getString("orderItemSeqId"));
+                            orderItemAssociation.set("shipGroupSeqId", "_NA_");
+                            orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId());
+                            orderItemAssociation.set("toShipGroupSeqId", "_NA_");
+                            orderItemAssociation.set("orderItemAssocTypeId", "PURCHASE_ORDER");
                             allOrderItemAssociations.add(orderItemAssociation);
                         }
                     } catch (GenericEntityException e) {
@@ -3470,10 +3473,13 @@
                     }
                 }
                 if (item.getAssociatedOrderId() != null && item.getAssociatedOrderItemSeqId() != null) {
-                    GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssociation", null);
-                    orderItemAssociation.set("salesOrderId", item.getAssociatedOrderId());
-                    orderItemAssociation.set("soItemSeqId", item.getAssociatedOrderItemSeqId());
-                    orderItemAssociation.set("poItemSeqId", item.getOrderItemSeqId());
+                    GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc", null);
+                    orderItemAssociation.set("orderId", item.getAssociatedOrderId());
+                    orderItemAssociation.set("orderItemSeqId", item.getAssociatedOrderItemSeqId());
+                    orderItemAssociation.set("shipGroupSeqId", "_NA_");
+                    orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId());
+                    orderItemAssociation.set("toShipGroupSeqId", "_NA_");
+                    orderItemAssociation.set("orderItemAssocTypeId", "PURCHASE_ORDER");
                     allOrderItemAssociations.add(orderItemAssociation);
                 }
             }

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Sun Dec 10 00:19:40 2006
@@ -218,26 +218,34 @@
                   </#list>
               </#if>
               <#-- show linked order lines -->
-              <#if orderHeader?has_content && orderHeader.orderTypeId = "SALES_ORDER">
-                <#assign linkedOrderItems = orderItem.getRelated("SalesOrderItemAssociation")?if_exists>
-              <#else>
-                <#assign linkedOrderItems = orderItem.getRelated("PurchaseOrderItemAssociation")?if_exists>
+              <#assign linkedOrderItemsTo = delegator.findByAnd("OrderItemAssoc", Static["org.ofbiz.base.util.UtilMisc"].toMap("orderId", orderItem.getString("orderId"),
+                                                                                                                               "orderItemSeqId", orderItem.getString("orderItemSeqId")))>
+              <#assign linkedOrderItemsFrom = delegator.findByAnd("OrderItemAssoc", Static["org.ofbiz.base.util.UtilMisc"].toMap("toOrderId", orderItem.getString("orderId"),
+                                                                                                                                 "toOrderItemSeqId", orderItem.getString("orderItemSeqId")))>
+              <#if linkedOrderItemsTo?has_content>
+                <#list linkedOrderItemsTo as linkedOrderItem>
+                  <#assign linkedOrderId = linkedOrderItem.toOrderId>
+                  <#assign linkedOrderItemSeqId = linkedOrderItem.toOrderItemSeqId>
+                  <tr>
+                    <td>&nbsp;</td>
+                    <td colspan="9">
+                      <div class="tabletext">
+                        <b><i>${uiLabelMap.OrderLinkedToOrderItem} (${linkedOrderItem.orderItemAssocTypeId})</i>:</b>
+                        <a href="/ordermgr/control/orderview?orderId=${linkedOrderId}" class="buttontext" style="font-size: xx-small;">${linkedOrderId}/${linkedOrderItemSeqId}</a>&nbsp;
+                      </div>
+                    </td>
+                  </tr>
+                </#list>
               </#if>
-
-              <#if linkedOrderItems?has_content>
-                <#list linkedOrderItems as linkedOrderItem>
-                  <#if orderHeader?has_content && orderHeader.orderTypeId = "SALES_ORDER">
-                    <#assign linkedOrderId = linkedOrderItem.purchaseOrderId>
-                    <#assign linkedOrderItemSeqId = linkedOrderItem.poItemSeqId>
-                  <#else>
-                    <#assign linkedOrderId = linkedOrderItem.salesOrderId>
-                    <#assign linkedOrderItemSeqId = linkedOrderItem.soItemSeqId>
-                  </#if>
+              <#if linkedOrderItemsFrom?has_content>
+                <#list linkedOrderItemsFrom as linkedOrderItem>
+                  <#assign linkedOrderId = linkedOrderItem.orderId>
+                  <#assign linkedOrderItemSeqId = linkedOrderItem.orderItemSeqId>
                   <tr>
                     <td>&nbsp;</td>
                     <td colspan="9">
                       <div class="tabletext">
-                        <b><i>${uiLabelMap.OrderLinkedToOrderItem}</i>:</b>
+                        <b><i>${uiLabelMap.OrderLinkedFromOrderItem} (${linkedOrderItem.orderItemAssocTypeId})</i>:</b>
                         <a href="/ordermgr/control/orderview?orderId=${linkedOrderId}" class="buttontext" style="font-size: xx-small;">${linkedOrderId}/${linkedOrderItemSeqId}</a>&nbsp;
                       </div>
                     </td>

Modified: incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh (original)
+++ incubator/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh Sun Dec 10 00:19:40 2006
@@ -157,7 +157,9 @@
         }
         receivedQuantities.put(thisItem.getString("orderItemSeqId"), new Double(totalReceived));
         //----------------------
-        salesOrderItemAssocs = thisItem.getRelated("PurchaseOrderItemAssociation");
+        salesOrderItemAssocs = delegator.findByAnd("OrderItemAssoc", UtilMisc.toMap("orderItemAssocTypeId", "PURCHASE_ORDER",
+                                                                                    "toOrderId", thisItem.getString("orderId"),
+                                                                                    "toOrderItemSeqId", thisItem.getString("orderItemSeqId")));
         if (salesOrderItemAssocs != null && salesOrderItemAssocs.size() > 0) {
             salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs);
             salesOrderItems.put(thisItem.getString("orderItemSeqId"), salesOrderItem);        

Modified: incubator/ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl?view=diff&rev=485144&r1=485143&r2=485144
==============================================================================
--- incubator/ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl (original)
+++ incubator/ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl Sun Dec 10 00:19:40 2006
@@ -332,8 +332,8 @@
             <input type="hidden" name="shipmentId_o_${rowCount}" value="${shipment.shipmentId}"/>
           </#if>
           <#if salesOrderItem?has_content>
-            <input type="hidden" name="priorityOrderId_o_${rowCount}" value="${salesOrderItem.salesOrderId}"/>
-            <input type="hidden" name="priorityOrderItemSeqId_o_${rowCount}" value="${salesOrderItem.soItemSeqId}"/>
+            <input type="hidden" name="priorityOrderId_o_${rowCount}" value="${salesOrderItem.orderId}"/>
+            <input type="hidden" name="priorityOrderItemSeqId_o_${rowCount}" value="${salesOrderItem.orderItemSeqId}"/>
           </#if>
 
           <tr>