Author: hansbak
Date: Thu Sep 15 13:32:52 2011
New Revision: 1171093

URL: http://svn.apache.org/viewvc?rev=1171093&view=rev
Log:
make sure that the product type productservice does not affect accounting when 
entering and shipping from inventory

Modified:
    ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
    
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
    
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java

Modified: ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml?rev=1171093&r1=1171092&r2=1171093&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_ledger.xml Thu Sep 15 
13:32:52 2011
@@ -31,6 +31,8 @@ under the License.
     <eca service="createItemIssuance" event="commit">
         <condition field-name="orderId" operator="is-not-empty"/>
         <condition field-name="inventoryItemId" operator="is-not-empty"/>
+        <!-- Ignore the inventory shipment if the product type is 
service_product -->
+        <condition field-name="productTypeId" operator="not-equals" 
value="SERVICE_PRODUCT"/>
         <action service="createAcctgTransForSalesShipmentIssuance" 
mode="sync"/>
     </eca>
 
@@ -42,6 +44,8 @@ under the License.
 
     <!-- create the accounting transactions for a shipment receipt every time 
the inventory is received -->
     <eca service="createShipmentReceipt" event="commit">
+        <!-- Ignore the inventory shipment if the product type is 
service_product -->
+        <condition field-name="productTypeId" operator="not-equals" 
value="SERVICE_PRODUCT"/>
         <action service="createAcctgTransForShipmentReceipt" mode="sync"/>
     </eca>
 

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1171093&r1=1171092&r2=1171093&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
(original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
Thu Sep 15 13:32:52 2011
@@ -1168,7 +1168,8 @@ public class OrderServices {
                             GenericValue permUserLogin = 
delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", 
"system"));
                             ripCtx.put("productId", productId);
                             ripCtx.put("facilityId", inventoryFacilityId);
-                            ripCtx.put("inventoryItemTypeId", 
"NON_SERIAL_INV_ITEM");
+                            ripCtx.put("inventoryItemTypeId", 
"SERIALIZED_INV_ITEM");
+                            ripCtx.put("statusId","INV_AVAILABLE");
                             ripCtx.put("quantityAccepted", 
orderItem.getBigDecimal("quantity"));
                             ripCtx.put("quantityRejected", 0.0);
                             ripCtx.put("userLogin", permUserLogin);

Modified: 
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
 (original)
+++ 
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
 Thu Sep 15 13:32:52 2011
@@ -43,6 +43,11 @@ under the License.
                 <set field="updateContext.inventoryItemId" 
from-field="inventoryItem.inventoryItemId"/>
                 <set field="updateContext.statusId" value="INV_DELIVERED"/>
                 <call-service service-name="updateInventoryItem" 
in-map-name="updateContext"/>
+                
+                <entity-one value-field="product" entity-name="Product">
+                    <field-map field-name="productId" 
from-field="inventoryItem.productId"/>
+                </entity-one>
+                <field-to-result field="product.productTypeId" 
result-name="productTypeId"/>
             </if-compare>
         </if-not-empty>
     </simple-method>

Modified: 
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1171093&r1=1171092&r2=1171093&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
 (original)
+++ 
ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
 Thu Sep 15 13:32:52 2011
@@ -45,6 +45,9 @@ under the License.
             <set field="invDet.receiptId" from-field="receiptId"/>
             <store-value value-field="invDet"/>
         </if-not-empty>
+        
+        <entity-one value-field="product" entity-name="Product"/>
+        <field-to-result field="product.productTypeId" 
result-name="productTypeId"/>
     </simple-method>
 
     <simple-method method-name="createShipmentReceiptRole" 
short-description="Create a ShipmentReceipt Role">

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=1171093&r1=1171092&r2=1171093&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Thu Sep 
15 13:32:52 2011
@@ -397,6 +397,7 @@ under the License.
         <permission-service service-name="facilityGenericPermission" 
main-action="CREATE"/>
         <auto-attributes include="pk" mode="OUT" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <attribute name="productTypeId" type="String" mode="OUT" 
optional="true"/>
     </service>
     <service name="updateItemIssuance" default-entity-name="ItemIssuance" 
engine="simple"
             
location="component://product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml"
 invoke="updateItemIssuance" auth="true">
@@ -735,6 +736,7 @@ under the License.
         <permission-service service-name="facilityGenericPermission" 
main-action="CREATE"/>
         <implements service="interfaceShipmentReceipt"/>
         <attribute name="receiptId" type="String" mode="OUT" optional="false"/>
+        <attribute name="productTypeId" type="String" mode="OUT" 
optional="true"/>
     </service>
     <service name="updatePurchaseShipmentFromReceipt" engine="java"
       location="org.ofbiz.shipment.shipment.ShipmentServices" 
invoke="updatePurchaseShipmentFromReceipt" auth="true">

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1171093&r1=1171092&r2=1171093&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
 Thu Sep 15 13:32:52 2011
@@ -62,7 +62,7 @@ public class ProductWorker {
         String errMsg = "";
         if (product != null) {
             String productTypeId = product.getString("productTypeId");
-            if ("SERVICE".equals(productTypeId) || 
(ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) {
+            if ("SERVICE".equals(productTypeId) || 
"SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product) && 
!ProductWorker.isPhysical(product))) {
                 // don't charge shipping on services or digital goods
                 return false;
             }


Reply via email to