Author: jacopoc
Date: Fri Aug 4 09:24:34 2006
New Revision: 428769
URL:
http://svn.apache.org/viewvc?rev=428769&view=revLog:
Now the getProductCost service will consider the virtual's costs if the product is a variant and no costs are available.
Modified:
incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
Modified: incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml?rev=428769&r1=428768&r2=428769&view=diff==============================================================================
--- incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml (original)
+++ incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/cost/CostServices.xml Fri Aug 4 09:24:34 2006
@@ -98,6 +98,7 @@
<filter-list-by-date list-name="otherCosts"/>
<first-from-list list-name="otherCosts" entry-name="otherCost"/>
+ <set field="productCost" value="0" type="Double" />
<calculate field-name="productCost">
<calcop field-name="laborCost.cost" operator="add">
<calcop field-name="materialsCost.cost" operator="get"/>
@@ -105,6 +106,23 @@
<calcop field-name="otherCost.cost" operator="get"/>
</calcop>
</calculate>
+ <!-- if the cost is zero, and the product is a variant, get the cost of the virtual -->
+ <if-compare field-name="productCost" operator="equals" value="0" type="Double">
+ <entity-one entity-name="Product" value-name="product"/>
+ <set from-field="product.productId" field="assocAndMap.productIdTo"/>
+ <set value="PRODUCT_VARIANT" field="assocAndMap.productAssocTypeId"/>
+ <find-by-and entity-name="ProductAssoc" map-name="assocAndMap" list-name="virtualAssocs"/>
+ <filter-list-by-date list-name="virtualAssocs"/>
+ <first-from-list list-name="virtualAssocs" entry-name="virtualAssoc"/>
+ <if-not-empty field-name="virtualAssoc">
+ <set from-field="virtualAssoc.productId" field="inputMap.productId"/>
+ <set from-field="parameters.currencyUomId" field="inputMap.currencyUomId"/>
+ <set from-field="parameters.costComponentTypePrefix" field="inputMap.costComponentTypePrefix"/>
+ <call-service service-name="getProductCost" in-map-name="inputMap">
+ <result-to-field result-name="productCost"/>
+ </call-service>
+ </if-not-empty>
+ </if-compare>
<!--
<if-compare field-name="productCost" operator="equals" value="0" type="Double">
<clear-field field-name="costsAndMap"/>