Author: jacopoc
Date: Wed Jan 20 11:27:30 2010
New Revision: 901140
URL: http://svn.apache.org/viewvc?rev=901140&view=rev
Log:
Improved migration service for ItemIssuance -> OrderShipment entity for
purchase orders.
Modified:
ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml
Modified:
ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml?rev=901140&r1=901139&r2=901140&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml
(original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/UpgradeServices.xml
Wed Jan 20 11:27:30 2010
@@ -58,18 +58,41 @@
</condition-list>
</entity-condition>
<iterate list="itemIssuances" entry="itemIssuance">
- <make-value entity-name="OrderShipment"
value-field="orderShipment"/>
- <set field="orderShipment.orderId"
from-field="itemIssuance.orderId"/>
- <set field="orderShipment.orderItemSeqId"
from-field="itemIssuance.orderItemSeqId"/>
- <set field="orderShipment.shipGroupSeqId"
from-field="itemIssuance.shipGroupSeqId"/>
- <set field="orderShipment.shipmentId"
from-field="itemIssuance.shipmentId"/>
- <set field="orderShipment.shipmentItemSeqId"
from-field="itemIssuance.shipmentItemSeqId"/>
- <set field="orderShipment.quantity"
from-field="itemIssuance.quantity"/>
- <create-value value-field="orderShipment"/>
+ <entity-one entity-name="OrderShipment"
value-field="orderShipment">
+ <field-map field-name="orderId"
from-field="itemIssuance.orderId"/>
+ <field-map field-name="orderItemSeqId"
from-field="itemIssuance.orderItemSeqId"/>
+ <field-map field-name="shipGroupSeqId"
from-field="itemIssuance.shipGroupSeqId"/>
+ <field-map field-name="shipmentId"
from-field="itemIssuance.shipmentId"/>
+ <field-map field-name="shipmentItemSeqId"
from-field="itemIssuance.shipmentItemSeqId"/>
+ </entity-one>
+ <if-empty field="orderShipment">
+ <make-value entity-name="OrderShipment"
value-field="orderShipment"/>
+ <set field="orderShipment.orderId"
from-field="itemIssuance.orderId"/>
+ <set field="orderShipment.orderItemSeqId"
from-field="itemIssuance.orderItemSeqId"/>
+ <set field="orderShipment.shipGroupSeqId"
from-field="itemIssuance.shipGroupSeqId"/>
+ <set field="orderShipment.shipmentId"
from-field="itemIssuance.shipmentId"/>
+ <set field="orderShipment.shipmentItemSeqId"
from-field="itemIssuance.shipmentItemSeqId"/>
+ <set field="orderShipment.quantity" value="0.0"
type="BigDecimal"/>
+ <create-value value-field="orderShipment"/>
+ </if-empty>
+ <calculate field="orderShipment.quantity">
+ <calcop operator="add">
+ <calcop operator="get" field="orderShipment.quantity"/>
+ <calcop operator="get" field="itemIssuance.quantity"/>
+ </calcop>
+ </calculate>
+ <store-value value-field="orderShipment"/>
<get-related value-field="itemIssuance"
relation-name="ItemIssuanceRole" list="itemIssuanceRoles"/>
<iterate entry="itemIssuanceRole" list="itemIssuanceRoles">
<remove-value value-field="itemIssuanceRole"/>
</iterate>
+ <entity-condition entity-name="InventoryItemDetail"
list="inventoryItemDetails">
+ <condition-expr field-name="itemIssuanceId" operator="equals"
from-field="itemIssuance.itemIssuanceId"/>
+ </entity-condition>
+ <iterate entry="inventoryItemDetail" list="inventoryItemDetails">
+ <set field="inventoryItemDetail.itemIssuanceId"
from-field="nullField"/>
+ <store-value value-field="inventoryItemDetail"/>
+ </iterate>
<remove-value value-field="itemIssuance"/>
</iterate>
</simple-method>