[OFBiz] SVN: r4878 - in trunk/applications: order/src/org/ofbiz/order/order product/data product/entitydef

jaz at svn.ofbiz.org jaz at svn.ofbiz.org
Thu Apr 21 15:42:24 EDT 2005


Author: jaz
Date: 2005-04-21 14:42:13 -0500 (Thu, 21 Apr 2005)
New Revision: 4878

Modified:
   trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java
   trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
   trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
   trunk/applications/product/data/ProductTypeData.xml
   trunk/applications/product/entitydef/entitymodel.xml
Log:
added new fields to product type to note physical vs digital goods; changed implementation code to no longer look for specific product types; but rather these flags on the type value


Modified: trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java	2005-04-21 16:40:26 UTC (rev 4877)
+++ trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java	2005-04-21 19:42:13 UTC (rev 4878)
@@ -52,10 +52,10 @@
  * @since      2.0
  */
 public class OrderChangeHelper {
-    
+
     public static final String module = OrderChangeHelper.class.getName();
-    
-    public static boolean approveOrder(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) {        
+
+    public static boolean approveOrder(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) {
         GenericValue productStore = OrderReadHelper.getProductStoreFromOrder(dispatcher.getDelegator(), orderId);
         if (productStore == null) {
             throw new IllegalArgumentException("Could not find ProductStore for orderId [" + orderId + "], cannot approve order.");
@@ -72,7 +72,7 @@
         if (productStore.get("digitalItemApprovedStatus") != null) {
             DIGITAL_ITEM_STATUS = productStore.getString("digitalItemApprovedStatus");
         }
-        
+
         try {
             OrderChangeHelper.orderStatusChanges(dispatcher, userLogin, orderId, HEADER_STATUS, "ITEM_CREATED", ITEM_STATUS, DIGITAL_ITEM_STATUS);
             OrderChangeHelper.releaseInitialOrderHold(dispatcher, orderId);
@@ -88,11 +88,11 @@
             Debug.logError(e, "Service invocation error, status changes were not updated for order #" + orderId, module);
             return false;
         }
-        
+
         return true;
-    }    
-    
-    public static boolean rejectOrder(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) {        
+    }
+
+    public static boolean rejectOrder(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) {
         GenericValue productStore = OrderReadHelper.getProductStoreFromOrder(dispatcher.getDelegator(), orderId);
         String HEADER_STATUS = "ORDER_REJECTED";
         String ITEM_STATUS = "ITEM_REJECTED";
@@ -101,8 +101,8 @@
           }
           if (productStore.get("itemDeclinedStatus") != null) {
               ITEM_STATUS = productStore.getString("itemDeclinedStatus");
-          }        
-        
+          }
+
         try {
             OrderChangeHelper.orderStatusChanges(dispatcher, userLogin, orderId, HEADER_STATUS, null, ITEM_STATUS, null);
             OrderChangeHelper.cancelInventoryReservations(dispatcher, userLogin, orderId);
@@ -139,8 +139,8 @@
           }
           if (productStore.get("itemCancelStatus") != null) {
               ITEM_STATUS = productStore.getString("itemCancelStatus");
-          }                  
-        
+          }
+
         try {
             OrderChangeHelper.orderStatusChanges(dispatcher, userLogin, orderId, HEADER_STATUS, null, ITEM_STATUS, null);
             OrderChangeHelper.cancelInventoryReservations(dispatcher, userLogin, orderId);
@@ -151,26 +151,26 @@
             return false;
         }
         return true;
-    }  
-    
-    public static void orderStatusChanges(LocalDispatcher dispatcher, GenericValue userLogin, String orderId, String orderStatus, String fromItemStatus, String toItemStatus, String digitalItemStatus) throws GenericServiceException {                             
+    }
+
+    public static void orderStatusChanges(LocalDispatcher dispatcher, GenericValue userLogin, String orderId, String orderStatus, String fromItemStatus, String toItemStatus, String digitalItemStatus) throws GenericServiceException {
         // set the status on the order header
         Map statusFields = UtilMisc.toMap("orderId", orderId, "statusId", orderStatus, "userLogin", userLogin);
-        Map statusResult = dispatcher.runSync("changeOrderStatus", statusFields);                               
+        Map statusResult = dispatcher.runSync("changeOrderStatus", statusFields);
         if (statusResult.containsKey(ModelService.ERROR_MESSAGE)) {
-            Debug.logError("Problems adjusting order header status for order #" + orderId, module);                            
+            Debug.logError("Problems adjusting order header status for order #" + orderId, module);
         }
-                        
+
         // set the status on the order item(s)
         Map itemStatusFields = UtilMisc.toMap("orderId", orderId, "statusId", toItemStatus, "userLogin", userLogin);
         if (fromItemStatus != null) {
             itemStatusFields.put("fromStatusId", fromItemStatus);
         }
-        Map itemStatusResult = dispatcher.runSync("changeOrderItemStatus", itemStatusFields);                        
+        Map itemStatusResult = dispatcher.runSync("changeOrderItemStatus", itemStatusFields);
         if (itemStatusResult.containsKey(ModelService.ERROR_MESSAGE)) {
             Debug.logError("Problems adjusting order item status for order #" + orderId, module);
         }
-        
+
         // now set the status for digital items
         if (digitalItemStatus != null && !digitalItemStatus.equals(toItemStatus)) {
             GenericDelegator delegator = dispatcher.getDelegator();
@@ -199,13 +199,21 @@
                             Debug.logError(e, "ERROR: Unable to get Product record for OrderItem : " + orderId + "/" + orderItemSeqId, module);
                         }
                         if (product != null) {
-                            String productType = product.getString("productTypeId");
-                            if ("DIGITAL_GOOD".equals(productType) || "FINDIG_GOOD".equals(productType)) {
-                                // update the status
-                                Map digitalStatusFields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "statusId", digitalItemStatus, "userLogin", userLogin);
-                                Map digitalStatusChange = dispatcher.runSync("changeOrderItemStatus", digitalStatusFields);
-                                if (ModelService.RESPOND_ERROR.equals(digitalStatusChange.get(ModelService.RESPONSE_MESSAGE))) {
-                                    Debug.logError("Problems with digital product status change : " + product, module);
+                            GenericValue productType = null;
+                            try {
+                                productType = product.getRelatedOne("ProductType");
+                            } catch (GenericEntityException e) {
+                                Debug.logError(e, "ERROR: Unable to get ProductType from Product : " + product, module);
+                            }
+                            if (productType != null) {
+                                String isDigital = productType.getString("isDigital");
+                                if (isDigital != null && "Y".equalsIgnoreCase(isDigital)) {                                
+                                    // update the status
+                                    Map digitalStatusFields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "statusId", digitalItemStatus, "userLogin", userLogin);
+                                    Map digitalStatusChange = dispatcher.runSync("changeOrderItemStatus", digitalStatusFields);
+                                    if (ModelService.RESPOND_ERROR.equals(digitalStatusChange.get(ModelService.RESPONSE_MESSAGE))) {
+                                        Debug.logError("Problems with digital product status change : " + product, module);
+                                    }
                                 }
                             }
                         }
@@ -213,15 +221,15 @@
                 }
             }
         }
-    } 
-    
+    }
+
     public static void cancelInventoryReservations(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) throws GenericServiceException {
         // cancel the inventory reservations
         Map cancelInvFields = UtilMisc.toMap("orderId", orderId, "userLogin", userLogin);
         Map cancelInvResult = dispatcher.runSync("cancelOrderInventoryReservation", cancelInvFields);
         if (ModelService.RESPOND_ERROR.equals(cancelInvResult.get(ModelService.RESPONSE_MESSAGE))) {
             Debug.logError("Problems reversing inventory reservations for order #" + orderId, module);
-        }                         
+        }
     }
 
     public static void releasePaymentAuthorizations(LocalDispatcher dispatcher, GenericValue userLogin, String orderId) throws GenericServiceException {
@@ -285,7 +293,7 @@
 
     public static GenericValue createPaymentFromPreference(GenericValue orderPaymentPreference, String paymentRefNumber, String paymentFromId, String comments) {
         GenericDelegator delegator = orderPaymentPreference.getDelegator();
-        
+
         // get the order header
         GenericValue orderHeader = null;
         try {
@@ -293,12 +301,12 @@
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot get OrderHeader from payment preference", module);
         }
-        
+
         // get the store for the order
-        GenericValue productStore = null;        
+        GenericValue productStore = null;
         if (orderHeader != null) {
-            try {                
-                productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId")));                                                   
+            try {
+                productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId")));
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Cannot get the ProductStore for the order header", module);
             }
@@ -306,19 +314,19 @@
             Debug.logWarning("No order header, cannot create payment", module);
             return null;
         }
-        
+
         if (productStore == null) {
             Debug.logWarning("No product store, cannot create payment", module);
             return null;
         }
-        
-        // set the payToPartyId       
+
+        // set the payToPartyId
         String payToPartyId = productStore.getString("payToPartyId");
         if (payToPartyId == null) {
             Debug.logWarning("No payToPartyId set on ProductStore : " + productStore.getString("productStoreId"), module);
             return null;
         }
-        
+
         // create the payment
         GenericValue payment = delegator.makeValue("Payment", UtilMisc.toMap("paymentId", delegator.getNextSeqId("Payment")));
         payment.set("paymentTypeId", "RECEIPT");
@@ -326,81 +334,81 @@
         payment.set("paymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId"));
         payment.set("amount", orderPaymentPreference.getDouble("maxAmount"));
         payment.set("statusId", "PMNT_RECEIVED");
-        payment.set("effectiveDate", UtilDateTime.nowTimestamp());        
-        payment.set("partyIdTo", payToPartyId); 
-        if (paymentRefNumber != null) { 
+        payment.set("effectiveDate", UtilDateTime.nowTimestamp());
+        payment.set("partyIdTo", payToPartyId);
+        if (paymentRefNumber != null) {
             payment.set("paymentRefNum", paymentRefNumber);
         }
         if (paymentFromId != null) {
             payment.set("partyIdFrom", paymentFromId);
         } else {
-            payment.set("partyIdFrom", "_NA_"); 
+            payment.set("partyIdFrom", "_NA_");
         }
         if (comments != null) {
-            payment.set("comments", comments);        
-        }        
-             
+            payment.set("comments", comments);
+        }
+
         return payment;
     }
 
     public static boolean releaseInitialOrderHold(LocalDispatcher dispatcher, String orderId) {
         // get the delegator from the dispatcher
         GenericDelegator delegator = dispatcher.getDelegator();
-        
+
         // find the workEffortId for this order
         List workEfforts = null;
         try {
-            workEfforts = delegator.findByAnd("WorkEffort", UtilMisc.toMap("currentStatusId", "WF_SUSPENDED", "sourceReferenceId", orderId));            
+            workEfforts = delegator.findByAnd("WorkEffort", UtilMisc.toMap("currentStatusId", "WF_SUSPENDED", "sourceReferenceId", orderId));
         } catch (GenericEntityException e) {
             Debug.logError(e, "Problems getting WorkEffort with order ref number: " + orderId, module);
             return false;
-        }        
-                         
-        if (workEfforts != null) {            
+        }
+
+        if (workEfforts != null) {
             // attempt to release the order workflow from 'Hold' status (resume workflow)
-            boolean allPass = true; 
+            boolean allPass = true;
             Iterator wei = workEfforts.iterator();
             while (wei.hasNext()) {
-                GenericValue workEffort = (GenericValue) wei.next();                             
+                GenericValue workEffort = (GenericValue) wei.next();
                 String workEffortId = workEffort.getString("workEffortId");
-                try {                                           
+                try {
                     if (workEffort.getString("currentStatusId").equals("WF_SUSPENDED")) {
-                        WorkflowClient client = new WorkflowClient(dispatcher.getDispatchContext());                
+                        WorkflowClient client = new WorkflowClient(dispatcher.getDispatchContext());
                         client.resume(workEffortId);
                     } else {
                         Debug.logVerbose("Current : --{" + workEffort + "}-- not resuming", module);
-                    }                
+                    }
                 } catch (WfException e) {
                     Debug.logError(e, "Problem resuming activity : " + workEffortId, module);
-                    allPass = false;                                     
+                    allPass = false;
                 }
             }
             return allPass;
         } else {
             Debug.logWarning("No WF found for order ID : " + orderId, module);
         }
-        return false;               
+        return false;
     }
-    
+
     public static boolean abortOrderProcessing(LocalDispatcher dispatcher, String orderId) {
         Debug.logInfo("Aborting workflow for order " + orderId, module);
         GenericDelegator delegator = dispatcher.getDelegator();
-        
+
         // find the workEffortId for this order
         GenericValue workEffort = null;
         try {
             List workEfforts = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortTypeId", "WORK_FLOW", "sourceReferenceId", orderId));
             if (workEfforts != null && workEfforts.size() > 1) {
-                Debug.logWarning("More then one workflow found for defined order: " + orderId, module);                
+                Debug.logWarning("More then one workflow found for defined order: " + orderId, module);
             }
             workEffort = EntityUtil.getFirst(workEfforts);
         } catch (GenericEntityException e) {
             Debug.logError(e, "Problems getting WorkEffort with order ref number: " + orderId, module);
             return false;
-        }  
-        
+        }
+
         if (workEffort != null) {
-            String workEffortId = workEffort.getString("workEffortId");            
+            String workEffortId = workEffort.getString("workEffortId");
             if (workEffort.getString("currentStatusId").equals("WF_RUNNING")) {
                 Debug.logInfo("WF is running; trying to abort", module);
                 WorkflowClient client = new WorkflowClient(dispatcher.getDispatchContext());
@@ -410,9 +418,9 @@
                     Debug.logError(e, "Problem aborting workflow", module);
                     return false;
                 }
-                return true;               
-            }             
-        }                              
+                return true;
+            }
+        }
         return false;
     }
 }

Modified: trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java	2005-04-21 16:40:26 UTC (rev 4877)
+++ trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java	2005-04-21 19:42:13 UTC (rev 4878)
@@ -116,7 +116,7 @@
         this.adjustments = adjustments;
         this.orderItems = orderItems;
     }
-    
+
     public OrderReadHelper(GenericDelegator delegator, String orderId) {
         try {
             this.orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
@@ -172,7 +172,7 @@
         }
         return paymentPrefs;
     }
-    
+
     public List getOrderPayments() {
         return getOrderPayments(null);
     }
@@ -876,7 +876,7 @@
                 // determine girth (longest field is length)
                 double[] sizeInfo = { height.doubleValue(), width.doubleValue(), depth.doubleValue() };
                 Arrays.sort(sizeInfo);
-                
+
                 size = (sizeInfo[0] * 2) + (sizeInfo[1] * 2) + sizeInfo[2];
             }
         }
@@ -1096,43 +1096,53 @@
                     Debug.logError(e, "Unable to get Product from OrderItem", module);
                 }
                 if (product != null) {
-                    String productType = product.getString("productTypeId");
-                    if ("DIGITAL_GOOD".equals(productType) || "FINDIG_GOOD".equals(productType)) {
-                        // make sure we have an OrderItemBilling record
-                        List orderItemBillings = null;
-                        try {
-                            orderItemBillings = item.getRelated("OrderItemBilling");
-                        } catch (GenericEntityException e) {
-                            Debug.logError(e, "Unable to get OrderItemBilling from OrderItem");
-                        }
+                    GenericValue productType = null;
+                    try {
+                        productType = product.getRelatedOne("ProductType");
+                    } catch (GenericEntityException e) {
+                        Debug.logError(e, "ERROR: Unable to get ProductType from Product", module);
+                    }
 
-                        if (orderItemBillings != null && orderItemBillings.size() > 0) {
-                            // get the ProductContent records
-                            List productContents = null;
+                    if (productType != null) {
+                        String isDigital = productType.getString("isDigital");
+
+                        if (isDigital != null && "Y".equalsIgnoreCase(isDigital)) {
+                            // make sure we have an OrderItemBilling record
+                            List orderItemBillings = null;
                             try {
-                                productContents = product.getRelated("ProductContent");
+                                orderItemBillings = item.getRelated("OrderItemBilling");
                             } catch (GenericEntityException e) {
-                                Debug.logError("Unable to get ProductContent from Product", module);
+                                Debug.logError(e, "Unable to get OrderItemBilling from OrderItem");
                             }
-                            List cExprs = UtilMisc.toList(
-                                    new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "DIGITAL_DOWNLOAD"),
-                                    new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EMAIL"),
-                                    new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EXTERNAL"));
-                            // add more as needed
-                            productContents = EntityUtil.filterByDate(productContents);
-                            productContents = EntityUtil.filterByOr(productContents, cExprs);
 
-                            if (productContents != null && productContents.size() > 0) {
-                                // make sure we are still within the allowed timeframe and use limits
-                                Iterator pci = productContents.iterator();
-                                while (pci.hasNext()) {
-                                    GenericValue productContent = (GenericValue) pci.next();
-                                    Timestamp fromDate = productContent.getTimestamp("purchaseFromDate");
-                                    Timestamp thruDate = productContent.getTimestamp("purchaseThruDate");
-                                    if (fromDate == null || item.getTimestamp("orderDate").after(fromDate)) {
-                                        if (thruDate == null || item.getTimestamp("orderDate").before(thruDate)) {
-                                            // TODO: Implement use count and days
-                                            digitalItems.add(item);
+                            if (orderItemBillings != null && orderItemBillings.size() > 0) {
+                                // get the ProductContent records
+                                List productContents = null;
+                                try {
+                                    productContents = product.getRelated("ProductContent");
+                                } catch (GenericEntityException e) {
+                                    Debug.logError("Unable to get ProductContent from Product", module);
+                                }
+                                List cExprs = UtilMisc.toList(
+                                        new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "DIGITAL_DOWNLOAD"),
+                                        new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EMAIL"),
+                                        new EntityExpr("productContentTypeId", EntityOperator.EQUALS, "FULFILLMENT_EXTERNAL"));
+                                // add more as needed
+                                productContents = EntityUtil.filterByDate(productContents);
+                                productContents = EntityUtil.filterByOr(productContents, cExprs);
+
+                                if (productContents != null && productContents.size() > 0) {
+                                    // make sure we are still within the allowed timeframe and use limits
+                                    Iterator pci = productContents.iterator();
+                                    while (pci.hasNext()) {
+                                        GenericValue productContent = (GenericValue) pci.next();
+                                        Timestamp fromDate = productContent.getTimestamp("purchaseFromDate");
+                                        Timestamp thruDate = productContent.getTimestamp("purchaseThruDate");
+                                        if (fromDate == null || item.getTimestamp("orderDate").after(fromDate)) {
+                                            if (thruDate == null || item.getTimestamp("orderDate").before(thruDate)) {
+                                                // TODO: Implement use count and days
+                                                digitalItems.add(item);
+                                            }
                                         }
                                     }
                                 }
@@ -1166,7 +1176,7 @@
         }
         return workEffort.getString("workEffortId");
     }
-    
+
     public String getCurrentItemStatus(GenericValue orderItem) {
         GenericValue statusItem = null;
         try {
@@ -1223,7 +1233,7 @@
         }
         return EntityUtil.filterByAnd(orderItemIssuances, UtilMisc.toMap("orderItemSeqId", orderItem.getString("orderItemSeqId")));
     }
-    
+
     public List getOrderReturnItems() {
         GenericDelegator delegator = orderHeader.getDelegator();
         if (this.orderReturnItems == null) {
@@ -1244,7 +1254,7 @@
         // get only the RETURN_RECEIVED and RETURN_COMPLETED statusIds
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_RECEIVED")));
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED")));
-                
+
         double returnedQuantity = 0.00;
         if (returnedItems != null) {
             Iterator i = returnedItems.iterator();
@@ -1257,15 +1267,15 @@
         }
         return returnedQuantity;
     }
-    
+
     public double getOrderReturnedTotal() {
         List returnedItemsBase = getOrderReturnItems();
         List returnedItems = new ArrayList(returnedItemsBase.size());
-        
+
         // get only the RETURN_RECEIVED and RETURN_COMPLETED statusIds
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_RECEIVED")));
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED")));
-        
+
         double returnedAmount = 0.00;
         Iterator i = returnedItems.iterator();
         while (i.hasNext()) {
@@ -1276,16 +1286,16 @@
         }
         return returnedAmount;
     }
-    
+
     public double getOrderNonReturnedTaxAndShipping() {
         // first make a Map of orderItemSeqId key, returnQuantity value
         List returnedItemsBase = getOrderReturnItems();
         List returnedItems = new ArrayList(returnedItemsBase.size());
-        
+
         // get only the RETURN_RECEIVED and RETURN_COMPLETED statusIds
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_RECEIVED")));
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED")));
-        
+
         Map itemReturnedQuantities = new HashMap();
         Iterator i = returnedItems.iterator();
         while (i.hasNext()) {
@@ -1301,16 +1311,16 @@
                 }
             }
         }
-        
+
         // then go through all order items and for the quantity not returned calculate it's portion of the item, and of the entire order
         double totalSubTotalNotReturned = 0;
         double totalTaxNotReturned = 0;
         double totalShippingNotReturned = 0;
-        
+
         Iterator orderItems = this.getValidOrderItems().iterator();
         while (orderItems.hasNext()) {
             GenericValue orderItem = (GenericValue) orderItems.next();
-            
+
             Double itemQuantityDbl = orderItem.getDouble("quantity");
             if (itemQuantityDbl == null) {
                 continue;
@@ -1348,7 +1358,7 @@
         }
         double orderTaxNotReturned = this.getTaxTotal() * orderFactorNotReturned;
         double orderShippingNotReturned = this.getShippingTotal() * orderFactorNotReturned;
-        
+
         return totalTaxNotReturned + totalShippingNotReturned + orderTaxNotReturned + orderShippingNotReturned;
     }
 
@@ -1562,7 +1572,7 @@
 
         if (cancelQty == null) cancelQty = new Double(0.0);
         if (orderQty == null) orderQty = new Double(0.0);
-        
+
         return new Double(orderQty.doubleValue() - cancelQty.doubleValue());
     }
 
@@ -1703,9 +1713,9 @@
 
     // ================= Order Item Adjustments =================
     public static double getOrderItemsSubTotal(List orderItems, List adjustments) {
-        return getOrderItemsSubTotal(orderItems, adjustments, null); 
+        return getOrderItemsSubTotal(orderItems, adjustments, null);
         }
-    
+
     public static double getOrderItemsSubTotal(List orderItems, List adjustments, List workEfforts) {
         double result = 0.0;
         Iterator itemIter = UtilMisc.toIterator(orderItems);
@@ -1714,7 +1724,7 @@
             GenericValue orderItem = (GenericValue) itemIter.next();
             double itemTotal = getOrderItemSubTotal(orderItem, adjustments);
 //          Debug.log("Item : " + orderItem.getString("orderId") + " / " + orderItem.getString("orderItemSeqId") + " = " + itemTotal, module);
-            
+
             if (workEfforts != null && orderItem.getString("orderItemTypeId").compareTo("RENTAL_ORDER_ITEM") == 0) {
                 Iterator weIter = UtilMisc.toIterator(workEfforts);
                 while (weIter != null && weIter.hasNext()) {
@@ -1727,7 +1737,7 @@
                 }
             }
             result += itemTotal;
-            
+
         }
         return UtilFormatOut.formatPriceNumber(result).doubleValue();
     }
@@ -1764,8 +1774,8 @@
                     result *= getWorkEffortRentalQuantity(workEffort);
                 }
             }
-        }     
-    
+        }
+
         // subtotal also includes non tax and shipping adjustments; tax and shipping will be calculated using this adjusted value
         result += getOrderItemAdjustmentsTotal(orderItem, adjustments, true, false, false, forTax, forShipping);
 
@@ -1798,14 +1808,14 @@
         if (workEffort.get("reservNthPPPerc") != null)
             nthPersonPerc = workEffort.getDouble("reservNthPPPerc").doubleValue();
         long length = 1;
-        if (workEffort.get("estimatedStartDate") != null && workEffort.get("estimatedCompletionDate") != null) 
-            length = (workEffort.getTimestamp("estimatedCompletionDate").getTime() - workEffort.getTimestamp("estimatedStartDate").getTime()) / 86400000; 
-        
+        if (workEffort.get("estimatedStartDate") != null && workEffort.get("estimatedCompletionDate") != null)
+            length = (workEffort.getTimestamp("estimatedCompletionDate").getTime() - workEffort.getTimestamp("estimatedStartDate").getTime()) / 86400000;
+
         double rentalAdjustment = 0;
         if (persons > 1)    {
             if (persons > 2 ) {
-                persons -= 2; 
-                if(nthPersonPerc > 0) 
+                persons -= 2;
+                if(nthPersonPerc > 0)
                     rentalAdjustment = persons * nthPersonPerc;
                 else
                     rentalAdjustment = persons * secondPersonPerc;
@@ -1815,11 +1825,11 @@
                 rentalAdjustment += secondPersonPerc;
         }
         rentalAdjustment += 100;  // add final 100 percent for first person
-        rentalAdjustment = rentalAdjustment/100 * length; 
+        rentalAdjustment = rentalAdjustment/100 * length;
 //        Debug.logInfo("rental parameters....Nbr of persons:" + persons + " extra% 2nd person:" + secondPersonPerc + " extra% Nth person:" + nthPersonPerc + " Length: " + length + "  total rental adjustment:" + rentalAdjustment ,module);
         return rentalAdjustment; // return total rental adjustment
         }
-    
+
     public static double getAllOrderItemsAdjustmentsTotal(List orderItems, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) {
         double result = 0.0;
         Iterator itemIter = UtilMisc.toIterator(orderItems);

Modified: trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java	2005-04-21 16:40:26 UTC (rev 4877)
+++ trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java	2005-04-21 19:42:13 UTC (rev 4878)
@@ -100,7 +100,7 @@
         // get the order type
         String orderTypeId = (String) context.get("orderTypeId");
         String partyId = (String) context.get("partyId");
-        
+
         // check security permissions for order:
         //  SALES ORDERS - if userLogin has ORDERMGR_SALES_CREATE or ORDERMGR_CREATE permission, or if it is same party as the partyId, or
         //                 if it is an AGENT (sales rep) creating an order for his customer
@@ -114,7 +114,7 @@
                 // check sales agent/customer relationship
                 List repsCustomers = new LinkedList();
                 try {
-                    repsCustomers = EntityUtil.filterByDate(userLogin.getRelatedOne("Party").getRelatedByAnd("FromPartyRelationship", 
+                    repsCustomers = EntityUtil.filterByDate(userLogin.getRelatedOne("Party").getRelatedByAnd("FromPartyRelationship",
                             UtilMisc.toMap("roleTypeIdFrom", "AGENT", "roleTypeIdTo", "CUSTOMER", "partyIdTo", partyId)));
                 } catch (GenericEntityException ex) {
                     Debug.logError("Could not determine if " + partyId + " is a customer of user " + userLogin.getString("userLoginId") + " due to " + ex.getMessage(), module);
@@ -131,9 +131,9 @@
             partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin, security, context, resultSecurity, "ORDERMGR", "_CREATE");
             if (resultSecurity.size() > 0) {
                 return resultSecurity;
-            }    
+            }
         }
-        
+
         boolean isImmediatelyFulfilled = false;
         String productStoreId = (String) context.get("productStoreId");
         GenericValue productStore = null;
@@ -147,7 +147,7 @@
         if (productStore != null) {
             isImmediatelyFulfilled = "Y".equals(productStore.getString("isImmediatelyFulfilled"));
         }
-        
+
         successResult.put("orderTypeId", orderTypeId);
 
         // lookup the order type entity
@@ -177,16 +177,16 @@
         Iterator itemIter = orderItems.iterator();
         java.sql.Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
 
-        //  
+        //
         // need to run through the items combining any cases where multiple lines refer to the
         // same product so the inventory check will work correctly
         // also count quantities ordered while going through the loop
         while (itemIter.hasNext()) {
             GenericValue orderItem = (GenericValue) itemIter.next();
-            
+
             // start by putting it in the itemValuesById Map
             itemValuesBySeqId.put(orderItem.getString("orderItemSeqId"), orderItem);
-            
+
             String currentProductId = (String) orderItem.get("productId");
             if (currentProductId != null) {
                 // only normalize items with a product associated (ignore non-product items)
@@ -197,7 +197,7 @@
                     Double currentQuantity = (Double) normalizedItemQuantities.get(currentProductId);
                     normalizedItemQuantities.put(currentProductId, new Double(currentQuantity.doubleValue() + orderItem.getDouble("quantity").doubleValue()));
                 }
-                
+
                 try {
                     // count product ordered quantities
                     // run this synchronously so it will run in the same transaction
@@ -295,7 +295,7 @@
                     return ServiceUtil.returnError("Rental order items in the order, however no workEfforts with start/end date and number of persons");
                 }
                 Iterator we = workEfforts.iterator();  // find the related workEffortItem (workEffortId = orderSeqId)
-                while (we.hasNext()) {    
+                while (we.hasNext()) {
                     // create the entity maps required.
                     GenericValue workEffort = (GenericValue) we.next();
                     if (workEffort.getString("workEffortId").equals(orderItem.getString("orderItemSeqId")))    {
@@ -338,11 +338,11 @@
             orderId = ProductStoreWorker.makeProductStoreOrderId(delegator, productStoreId);
         } else {
             // for purchase orders, a product store id should not be required to make an order
-            orderId = delegator.getNextSeqId("OrderHeader"); 
+            orderId = delegator.getNextSeqId("OrderHeader");
         }
 
         String billingAccountId = (String) context.get("billingAccountId");
-        
+
         Map orderHeaderMap = UtilMisc.toMap("orderId", orderId, "orderTypeId", orderTypeId,
                 "orderDate", nowTimestamp, "entryDate", nowTimestamp,
                 "statusId", initialStatus, "billingAccountId", billingAccountId);
@@ -421,7 +421,7 @@
             GenericValue orderItem = (GenericValue) oi.next();
             orderItem.set("orderId", orderId);
             toBeStored.add(orderItem);
-            
+
             // create the item status record
             String itemStatusId = delegator.getNextSeqId("OrderStatus").toString();
             GenericValue itemStatus = delegator.makeValue("OrderStatus", UtilMisc.toMap("orderStatusId", itemStatusId));
@@ -433,7 +433,7 @@
             toBeStored.add(itemStatus);
         }
 
-        // create the workeffort records 
+        // create the workeffort records
         // and connect them with the orderitem over the WorkOrderItemFulfillment
         // create also the techData calendars to keep track of availability of the fixed asset.
         if (workEfforts != null && workEfforts.size() > 0) {
@@ -445,9 +445,9 @@
                 // find fixed asset supplied on the workeffort map
                 GenericValue fixedAsset = null;
                 Debug.logInfo("find the fixedAsset",module);
-                try { fixedAsset = delegator.findByPrimaryKey("FixedAsset", 
-                        UtilMisc.toMap("fixedAssetId", workEffort.get("fixedAssetId")));     
-                } 
+                try { fixedAsset = delegator.findByPrimaryKey("FixedAsset",
+                        UtilMisc.toMap("fixedAssetId", workEffort.get("fixedAssetId")));
+                }
                 catch (GenericEntityException e) {
                     return ServiceUtil.returnError("fixed_Asset_not_found. Fixed AssetId: " + workEffort.get("fixedAssetId"));
                 }
@@ -457,8 +457,8 @@
                 // see if this fixed asset has a calendar, when no create one and attach to fixed asset
                 Debug.logInfo("find the techdatacalendar",module);
                 GenericValue techDataCalendar = null;
-                try { techDataCalendar = fixedAsset.getRelatedOne("TechDataCalendar"); 
-                } 
+                try { techDataCalendar = fixedAsset.getRelatedOne("TechDataCalendar");
+                }
                 catch (GenericEntityException e) {
                     Debug.logInfo("TechData calendar does not exist yet so create for fixedAsset: " + fixedAsset.get("fixedAssetId") ,module);
                 }
@@ -467,7 +467,7 @@
                     Debug.logInfo("create techdata calendar because it does not exist",module);
                     String calendarId = delegator.getNextSeqId("techDataCalendar").toString();
                     techDataCalendar.set("calendarId", calendarId);
-                    toBeStored.add(techDataCalendar); 
+                    toBeStored.add(techDataCalendar);
                     Debug.logInfo("update fixed Asset",module);
                     fixedAsset.set("calendarId",calendarId);
                     toBeStored.add(fixedAsset);
@@ -476,7 +476,7 @@
                 workOrderItemFulfillment.set("orderItemSeqId", workEffort.get("workEffortId").toString()); // orderItemSeqNo is stored here so save first
                 // workeffort
                 String workEffortId = delegator.getNextSeqId("WorkEffort").toString(); // find next available workEffortId
-                workEffort.set("workEffortId", workEffortId); 
+                workEffort.set("workEffortId", workEffortId);
                 workEffort.set("workEffortTypeId", "ASSET_USAGE");
                 toBeStored.add(workEffort);  // store workeffort before workOrderItemFulfillment because of workEffortId key constraint
                 // workOrderItemFulfillment
@@ -490,12 +490,12 @@
                 Timestamp estimatedStartDate = workEffort.getTimestamp("estimatedStartDate");
                 Timestamp estimatedCompletionDate = workEffort.getTimestamp("estimatedCompletionDate");
                 long dayCount = (estimatedCompletionDate.getTime() - estimatedStartDate.getTime())/86400000;
-                while (--dayCount >= 0)    { 
+                while (--dayCount >= 0)    {
                     GenericValue techDataCalendarExcDay = null;
                     // find an existing Day exception record
                     Timestamp exceptionDateStartTime = new Timestamp((long)(estimatedStartDate.getTime() + (dayCount * 86400000)));
                     try {     techDataCalendarExcDay = delegator.findByPrimaryKey("TechDataCalendarExcDay",
-                            UtilMisc.toMap("calendarId", fixedAsset.get("calendarId"), "exceptionDateStartTime", exceptionDateStartTime)); 
+                            UtilMisc.toMap("calendarId", fixedAsset.get("calendarId"), "exceptionDateStartTime", exceptionDateStartTime));
                     }
                     catch (GenericEntityException e) {
                         Debug.logInfo(" techData excday record not found so creating........", module);
@@ -506,11 +506,11 @@
                         techDataCalendarExcDay.set("exceptionDateStartTime", exceptionDateStartTime);
                         techDataCalendarExcDay.set("usedCapacity",new Double(00.00));  // initialise to zero
                         techDataCalendarExcDay.set("exceptionCapacity", fixedAsset.getDouble("productionCapacity"));
-//                       Debug.logInfo(" techData excday record not found creating for calendarId: " + techDataCalendarExcDay.getString("calendarId") + 
+//                       Debug.logInfo(" techData excday record not found creating for calendarId: " + techDataCalendarExcDay.getString("calendarId") +
 //                               " and date: " + exceptionDateStartTime.toString(), module);
                     }
                     // add the quantity to the quantity on the date record
-                    Double newUsedCapacity = new Double(techDataCalendarExcDay.getDouble("usedCapacity").doubleValue() + 
+                    Double newUsedCapacity = new Double(techDataCalendarExcDay.getDouble("usedCapacity").doubleValue() +
                             workEffort.getDouble("quantityToProduce").doubleValue());
                     // check to see if the requested quantity is available on the requested day but only when the maximum capacity is set on the fixed asset
                     if (fixedAsset.get("productionCapacity") != null)    {
@@ -526,8 +526,8 @@
                     }
                     techDataCalendarExcDay.set("usedCapacity", newUsedCapacity);
                     toBeStored.add(techDataCalendarExcDay);
-//                  Debug.logInfo("Update success CalendarID: " + techDataCalendarExcDay.get("calendarId").toString() + 
-//                            " and for date: " + techDataCalendarExcDay.get("exceptionDateStartTime").toString() + 
+//                  Debug.logInfo("Update success CalendarID: " + techDataCalendarExcDay.get("calendarId").toString() +
+//                            " and for date: " + techDataCalendarExcDay.get("exceptionDateStartTime").toString() +
 //                            " and for quantity: " + techDataCalendarExcDay.getDouble("usedCapacity").toString(), module);
                 }
             }
@@ -535,7 +535,7 @@
         if (errorMessages.size() > 0) {
             return ServiceUtil.returnError(errorMessages);
         }
- 
+
         // set the orderId on all adjustments; this list will include order and
         // item adjustments...
         List orderAdjustments = (List) context.get("orderAdjustments");
@@ -626,7 +626,7 @@
                     while (apIt.hasNext()) {
                         String additionalPartyId = (String) apIt.next();
                         toBeStored.add(delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", additionalPartyId, "roleTypeId", additionalRoleTypeId)));
-                        toBeStored.add(delegator.makeValue("OrderRole", UtilMisc.toMap("orderId", orderId, "partyId", additionalPartyId, "roleTypeId", additionalRoleTypeId)));                        
+                        toBeStored.add(delegator.makeValue("OrderRole", UtilMisc.toMap("orderId", orderId, "partyId", additionalPartyId, "roleTypeId", additionalRoleTypeId)));
                     }
                 }
             }
@@ -821,7 +821,7 @@
                         GenericValue orderItemShipGroupAssoc = (GenericValue) osiInfos.next();
                         if ("OrderItemShipGroupAssoc".equals(orderItemShipGroupAssoc.getEntityName())) {
                             GenericValue orderItem = (GenericValue) itemValuesBySeqId.get(orderItemShipGroupAssoc.get("orderItemSeqId"));
-                                
+
                             if (UtilValidate.isNotEmpty(orderItem.getString("productId")) && !"RENTAL_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { // ignore for rental
                                 // only reserve product items; ignore non-product items
                                 try {
@@ -835,7 +835,7 @@
                                     reserveInput.put("quantity", orderItemShipGroupAssoc.getDouble("quantity"));
                                     reserveInput.put("userLogin", userLogin);
                                     Map reserveResult = dispatcher.runSync("reserveStoreInventory", reserveInput);
-                                    
+
                                     if (ServiceUtil.isError(reserveResult)) {
                                         GenericValue product = null;
                                         try {
@@ -843,7 +843,7 @@
                                         } catch (GenericEntityException e) {
                                             Debug.logError(e, "Error when looking up product in createOrder service, product failed inventory reservation", module);
                                         }
-                                        
+
                                         String invErrMsg = "The product ";
                                         if (product != null) {
                                             invErrMsg += getProductName(product, orderItem);
@@ -860,7 +860,7 @@
                         }
                     }
                 }
-                
+
                 if (resErrorMessages.size() > 0) {
                     return ServiceUtil.returnError(resErrorMessages);
                 }
@@ -916,7 +916,7 @@
             double updatedTotal = orh.getOrderGrandTotal();
 
             // calculate subTotal as grandTotal - returnsTotal - (tax + shipping of items not returned)
-            double remainingSubTotal = updatedTotal - orh.getOrderReturnedTotal() - orh.getOrderNonReturnedTaxAndShipping();            
+            double remainingSubTotal = updatedTotal - orh.getOrderReturnedTotal() - orh.getOrderNonReturnedTaxAndShipping();
 
             if (currentTotal == null || currentSubTotal == null || updatedTotal != currentTotal.doubleValue() ||
                     remainingSubTotal != currentSubTotal.doubleValue()) {
@@ -1101,7 +1101,7 @@
 
                     // prepare the service context
                     Map serviceContext = UtilMisc.toMap("productStoreId", orh.getProductStoreId(), "itemProductList", products, "itemAmountList", amounts,
-                        "itemShippingList", shipAmts, "itemPriceList", itPrices, "orderShippingAmount", orderShipping);                    
+                        "itemShippingList", shipAmts, "itemPriceList", itPrices, "orderShippingAmount", orderShipping);
                     serviceContext.put("shippingAddress", shippingAddress);
 
                     // invoke the calcTax service
@@ -2048,7 +2048,7 @@
         GenericValue userLogin = (GenericValue) context.get("userLogin");
 
         String prefId = null;
-        
+
         try {
             prefId = delegator.getNextSeqId("OrderPaymentPreference");
         } catch (IllegalArgumentException e) {
@@ -2094,7 +2094,7 @@
         }
         return ServiceUtil.returnError("Error getting order header information; null");
     }
- 
+
     /** Service to get the total shipping for an order. */
     public static Map getOrderShippingAmount(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
@@ -3410,17 +3410,28 @@
                     Debug.logError(e, "ERROR: Unable to get Product from OrderItem", module);
                 }
                 if (product != null) {
-                    String productType = product.getString("productTypeId");
-                    // check for digital and finished/digital goods
-                    if ("DIGITAL_GOOD".equals(productType) || "FINDIG_GOOD".equals(productType)) {
-                        // we only invoice APPROVED items
-                        if ("ITEM_APPROVED".equals(item.getString("statusId"))) {
-                            digitalItems.add(item);
+                    GenericValue productType = null;
+                    try {
+                        productType = product.getRelatedOne("ProductType");
+                    } catch (GenericEntityException e) {
+                        Debug.logError(e, "ERROR: Unable to get ProductType from Product", module);
+                    }
+
+                    if (productType != null) {
+                        String isPhysical = productType.getString("isPhysical");
+                        String isDigital = productType.getString("isDigital");
+
+                        // check for digital and finished/digital goods
+                        if (isDigital != null && "Y".equalsIgnoreCase(isDigital)) {
+                            // we only invoice APPROVED items
+                            if ("ITEM_APPROVED".equals(item.getString("statusId"))) {
+                                digitalItems.add(item);
+                            }
+                            if (isPhysical == null || !"Y".equalsIgnoreCase(isPhysical)) {
+                                // 100% digital goods need status change
+                                digitalProducts.put(item, product);
+                            }
                         }
-                        if ("DIGITAL_GOOD".equals(productType)) {
-                            // 100% digital goods need status change
-                            digitalProducts.put(item, product);
-                        }
                     }
                 }
             }
@@ -3441,14 +3452,26 @@
                 return ServiceUtil.returnError((String) invoiceResult.get(ModelService.ERROR_MESSAGE));
             }
 
-            // update the status of DIGITAL_GOOD to COMPLETED; leave FINDIG as APPROVED for pick/ship
+            // update the status of digital goods to COMPLETED; leave physical/digital as APPROVED for pick/ship
             Iterator dii = digitalItems.iterator();
             while (dii.hasNext()) {
+                GenericValue productType = null;
                 GenericValue item = (GenericValue) dii.next();
                 GenericValue product = (GenericValue) digitalProducts.get(item);
-                if (product != null) {
+
+                try {
+                    productType = product.getRelatedOne("ProductType");
+                } catch (GenericEntityException e) {
+                    Debug.logError(e, "ERROR: Unable to get ProductType from Product", module);
+                }
+
+                if (product != null && productType != null) {
+                    String isPhysical = productType.getString("isPhysical");
+                    String isDigital = productType.getString("isDigital");
+
                     // we were set as a digital good; one more check and change status
-                    if ("DIGITAL_GOOD".equals(product.getString("productTypeId"))) {
+                    if ((isDigital != null && "Y".equalsIgnoreCase(isDigital)) && (
+                            isPhysical == null || !"Y".equalsIgnoreCase(isPhysical))) {
                         Map statusCtx = new HashMap();
                         statusCtx.put("orderId", item.getString("orderId"));
                         statusCtx.put("orderItemSeqId", item.getString("orderItemSeqId"));

Modified: trunk/applications/product/data/ProductTypeData.xml
===================================================================
--- trunk/applications/product/data/ProductTypeData.xml	2005-04-21 16:40:26 UTC (rev 4877)
+++ trunk/applications/product/data/ProductTypeData.xml	2005-04-21 19:42:13 UTC (rev 4878)
@@ -280,16 +280,16 @@
 
     <ProductStoreGroup productStoreGroupName="Not Applicable" description="Not Applicable" productStoreGroupId="_NA_" productStoreGroupTypeId="" primaryParentGroupId=""/>
 
-    <ProductType description="Fixed Asset Usage" hasTable="N" parentTypeId="" productTypeId="ASSET_USAGE"/>
-    <ProductType description="Service" hasTable="N" parentTypeId="" productTypeId="SERVICE"/>
-    <ProductType description="Good" hasTable="N" parentTypeId="" productTypeId="GOOD"/>
-    <ProductType description="Raw Material" hasTable="N" parentTypeId="GOOD" productTypeId="RAW_MATERIAL"/>
-    <ProductType description="Subassembly" hasTable="N" parentTypeId="GOOD" productTypeId="SUBASSEMBLY"/>
-    <ProductType description="Finished Good" hasTable="N" parentTypeId="GOOD" productTypeId="FINISHED_GOOD"/>
-    <ProductType description="Digital Good" hasTable="N" parentTypeId="GOOD" productTypeId="DIGITAL_GOOD"/>
-    <ProductType description="Finished/Digital Good" hasTable="N" parentTypeId="GOOD" productTypeId="FINDIG_GOOD"/>
-    <ProductType description="Configurable Good" hasTable="N" parentTypeId="GOOD" productTypeId="AGGREGATED"/>
-    <ProductType description="Work In Process" hasTable="N" parentTypeId="GOOD" productTypeId="WIP"/>
+    <ProductType description="Fixed Asset Usage" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="ASSET_USAGE"/>
+    <ProductType description="Service" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="SERVICE"/>
+    <ProductType description="Good" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="GOOD"/>
+    <ProductType description="Raw Material" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="GOOD" productTypeId="RAW_MATERIAL"/>
+    <ProductType description="Subassembly" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="GOOD" productTypeId="SUBASSEMBLY"/>
+    <ProductType description="Finished Good" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="GOOD" productTypeId="FINISHED_GOOD"/>
+    <ProductType description="Digital Good" isPhysical="N" isDigital="Y" hasTable="N" parentTypeId="GOOD" productTypeId="DIGITAL_GOOD"/>
+    <ProductType description="Finished/Digital Good" isPhysical="Y" isDigital="Y" hasTable="N" parentTypeId="GOOD" productTypeId="FINDIG_GOOD"/>
+    <ProductType description="Configurable Good" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="GOOD" productTypeId="AGGREGATED"/>
+    <ProductType description="Work In Process" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="GOOD" productTypeId="WIP"/>
 
     <EnumerationType description="Product Requirement Method" enumTypeId="PROD_REQ_METHOD" hasTable="N" parentTypeId=""/>
     <!-- NONE: no requirement is created (default) -->

Modified: trunk/applications/product/entitydef/entitymodel.xml
===================================================================
--- trunk/applications/product/entitydef/entitymodel.xml	2005-04-21 16:40:26 UTC (rev 4877)
+++ trunk/applications/product/entitydef/entitymodel.xml	2005-04-21 19:42:13 UTC (rev 4878)
@@ -29,7 +29,7 @@
  */
 -->
 
-<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/entitymodel.xsd">
   <!-- ========================================================= -->
   <!-- ======================== Defaults ======================= -->
@@ -1889,6 +1889,8 @@
             title="Product Type Entity" default-resource-name="ProductEntityLabels">
       <field name="productTypeId" type="id-ne"></field>
       <field name="parentTypeId" type="id"></field>
+      <field name="isPhysical" type="indicator"></field>
+      <field name="isDigital" type="indicator"></field>
       <field name="hasTable" type="indicator"></field>
       <field name="description" type="description"></field>
       <prim-key field="productTypeId"/>
@@ -2122,7 +2124,7 @@
         <key-map field-name="productPromoCodeId"/>
       </relation>
     </entity>
-    <view-entity entity-name="ProductPromoCodeEmailParty" 
+    <view-entity entity-name="ProductPromoCodeEmailParty"
             package-name="org.ofbiz.product.promo"
             title="Product Promotion Email and Party View Entity">
       <member-entity entity-alias="PPCE" entity-name="ProductPromoCodeEmail"/>
@@ -2645,7 +2647,7 @@
       </relation>
       <relation type="one" fk-name="PROD_STR_PAYTOPTY" rel-entity-name="Party">
         <key-map field-name="payToPartyId" rel-field-name="partyId"/>
-      </relation>      
+      </relation>
       <relation type="one" fk-name="PROD_STR_CURUOM" rel-entity-name="Uom">
         <key-map field-name="defaultCurrencyUomId" rel-field-name="uomId"/>
       </relation>
@@ -2967,7 +2969,7 @@
       <field name="includeGeoId" type="id"></field>
       <field name="excludeGeoId" type="id"></field>
       <field name="serviceName" type="long-varchar"></field>
-      <field name="configProps" type="long-varchar"></field>  
+      <field name="configProps" type="long-varchar"></field>
       <field name="sequenceNumber" type="numeric"></field>
       <prim-key field="productStoreId"/>
       <prim-key field="shipmentMethodTypeId"/>
@@ -3150,7 +3152,7 @@
         <key-map field-name="currencyUomId" rel-field-name="uomId"/>
       </relation>
     </entity>
-    <entity entity-name="SupplierProductFeature" package-name="org.ofbiz.product.supplier" 
+    <entity entity-name="SupplierProductFeature" package-name="org.ofbiz.product.supplier"
             title="Supplier-specific product feature information">
       <field name="partyId" type="id-ne"/>
       <field name="productFeatureId" type="id-ne"/>
@@ -3176,7 +3178,7 @@
       <field name="description" type="description"></field>
       <prim-key field="supplierRatingTypeId"/>
     </entity>
-    
+
   <!-- ========================================================= -->
   <!-- org.ofbiz.product.config -->
   <!-- ========================================================= -->



More information about the Svn mailing list