svn commit: r759251 [2/3] - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: ./ finaccount/ order/ quote/ requirement/ shoppingcart/ shoppingcart/product/ shoppingcart/shipping/ shoppinglist/ task/ test/

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

svn commit: r759251 [2/3] - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: ./ finaccount/ order/ quote/ requirement/ shoppingcart/ shoppingcart/product/ shoppingcart/shipping/ shoppinglist/ task/ test/

doogie-3
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Fri Mar 27 17:01:06 2009
@@ -123,7 +123,7 @@
     /** these are defaults for all ship groups */
     private Timestamp defaultShipAfterDate = null;
     private Timestamp defaultShipBeforeDate = null;
-
+
     /** Contains a List for each productPromoId (key) containing a productPromoCodeId (or empty string for no code) for each use of the productPromoId */
     private List productPromoUseInfoList = new LinkedList();
     /** Contains the promo codes entered */
@@ -197,11 +197,11 @@
         this.defaultShipAfterDate = cart.getDefaultShipAfterDate();
         this.defaultShipBeforeDate = cart.getDefaultShipBeforeDate();
         this.cancelBackOrderDate = cart.getCancelBackOrderDate();
-
+
         this.terminalId = cart.getTerminalId();
         this.transactionId = cart.getTransactionId();
         this.autoOrderShoppingListId = cart.getAutoOrderShoppingListId();
-
+
         // clone the additionalPartyRoleMap
         this.additionalPartyRole = new HashMap();
         Iterator it = cart.additionalPartyRole.entrySet().iterator();
@@ -250,7 +250,7 @@
         if (productStore == null) {
             throw new IllegalArgumentException("Unable to locate ProductStore by ID [" + productStoreId + "]");
         }
-
+
         String storeViewCartOnAdd = productStore.getString("viewCartOnAdd");
         if (storeViewCartOnAdd != null && "Y".equalsIgnoreCase(storeViewCartOnAdd)) {
             this.viewCartOnAdd = true;
@@ -351,7 +351,7 @@
     public void setOrderName(String orderName) {
         this.orderName = orderName;
     }
-
+
     public String getOrderName() {
         return orderName;
     }
@@ -359,7 +359,7 @@
     public void setWorkEffortId(String workEffortId) {
         this.workEffortId = workEffortId;
     }
-
+
     public String getWorkEffortId() {
         return workEffortId;
     }
@@ -399,7 +399,7 @@
     public Timestamp getOrderDate() {
         return this.orderDate;
     }
-
+
     /** Sets the currency for the cart. */
     public void setCurrency(LocalDispatcher dispatcher, String currencyUom) throws CartItemModifyException {
         if (isReadOnlyCart()) {
@@ -460,12 +460,12 @@
     public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
             Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features, Map attributes, String prodCatalogId,
             ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException {
-
+
        return addOrIncreaseItem(productId,selectedAmount,quantity,reservStart,reservLength,reservPersons,
                        null,null,shipBeforeDate,shipAfterDate,features,attributes,prodCatalogId,
                 configWrapper,itemType,itemGroupNumber,parentProductId,dispatcher);
     }
-
+
     /** add rental (with accommodation) item to cart  */
     public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
                String accommodationMapId, String accommodationSpotId,
@@ -474,18 +474,18 @@
         if (isReadOnlyCart()) {
            throw new CartItemModifyException("Cart items cannot be changed");
         }
-
+
         selectedAmount = selectedAmount == null ? BigDecimal.ZERO : selectedAmount;
         reservLength = reservLength == null ? BigDecimal.ZERO : reservLength;
         reservPersons = reservPersons == null ? BigDecimal.ZERO : reservPersons;
-
+
         ShoppingCart.ShoppingCartItemGroup itemGroup = this.getItemGroupByNumber(itemGroupNumber);
         GenericValue supplierProduct = null;
         // Check for existing cart item.
         for (int i = 0; i < this.cartLines.size(); i++) {
             ShoppingCartItem sci = (ShoppingCartItem) cartLines.get(i);
 
-
+
             if (sci.equals(productId, reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, features, attributes, prodCatalogId,selectedAmount, configWrapper, itemType, itemGroup, false)) {
                 BigDecimal newQuantity = sci.getQuantity().add(quantity);
                 if (sci.getItemType().equals("RENTAL_ORDER_ITEM")) {
@@ -498,7 +498,7 @@
                         throw new CartItemModifyException(isAvailable);
                     }
                 }
-
+
                 if (Debug.verboseOn()) Debug.logVerbose("Found a match for id " + productId + " on line " + i + ", updating quantity to " + newQuantity, module);
                 sci.setQuantity(newQuantity, dispatcher, this);
 
@@ -604,7 +604,7 @@
     public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersonsDbl,String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
         return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersonsDbl, accommodationMapId, accommodationSpotId, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks));
     }
-
+
     /** Add an item to the shopping cart. */
     public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException {
         return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks));
@@ -659,7 +659,7 @@
             // Check for existing cart item
             for (ShoppingCartItem cartItem : cartLines) {
                 //Debug.logInfo("Checking cartItem with product [" + cartItem.getProductId() + "] becuase that is in group [" + (cartItem.getItemGroup()==null ? "no group" : cartItem.getItemGroup().getGroupNumber()) + "]", module);
-
+
                 if (UtilValidate.isNotEmpty(groupNumber) && !cartItem.isInItemGroup(groupNumber)) {
                     //Debug.logInfo("Not using cartItem with product [" + cartItem.getProductId() + "] becuase not in group [" + groupNumber + "]", module);
                     continue;
@@ -696,7 +696,7 @@
     public void removeExtraItems(List multipleItems, LocalDispatcher dispatcher, int maxItems) throws CartItemModifyException {
         // if 1 or 0 items, do nothing
         if (multipleItems.size() <= maxItems) return;
-
+
         // remove all except first <maxItems> in list from the cart, first because new cart items are added to the beginning...
         List localList = FastList.newInstance();
         localList.addAll(multipleItems);
@@ -718,7 +718,7 @@
         }
         return totalQuantity;
     }
-
+
     public static List getItemsProducts(List cartItems) {
         List productList = FastList.newInstance();
         Iterator localIter = cartItems.iterator();
@@ -731,7 +731,7 @@
         }
         return productList;
     }
-
+
     public void ensureItemsQuantity(List cartItems, LocalDispatcher dispatcher, BigDecimal quantity) throws CartItemModifyException {
         Iterator localIter = cartItems.iterator();
         while (localIter.hasNext()) {
@@ -741,7 +741,7 @@
             }
         }
     }
-
+
     public BigDecimal ensureItemsTotalQuantity(List cartItems, LocalDispatcher dispatcher, BigDecimal quantity) throws CartItemModifyException {
         BigDecimal quantityRemoved = BigDecimal.ZERO;
         // go through the items and reduce quantityToKeep by the item quantities until it is 0, then remove the remaining...
@@ -749,7 +749,7 @@
         Iterator localIter = cartItems.iterator();
         while (localIter.hasNext()) {
             ShoppingCartItem item = (ShoppingCartItem) localIter.next();
-
+
             if (quantityToKeep.compareTo(item.getQuantity()) >= 0) {
                 // quantityToKeep sufficient to keep it all... just reduce quantityToKeep and move on
                 quantityToKeep = quantityToKeep.subtract(item.getQuantity());
@@ -769,7 +769,7 @@
         }
         return quantityRemoved;
     }
-
+
     // ============== WorkEffort related methods ===============
     public boolean containAnyWorkEffortCartItems() {
         // Check for existing cart item.
@@ -792,7 +792,7 @@
         }
         return true;
     }
-
+
     /**
      * Check to see if the cart contains only Digital Goods, ie no Finished Goods and no Finished/Digital Goods, et cetera.
      * This is determined by making sure no Product has a type where ProductType.isPhysical!=N.
@@ -884,7 +884,7 @@
     public Iterator iterator() {
         return cartLines.iterator();
     }
-
+
     public ShoppingCart.ShoppingCartItemGroup getItemGroupByNumber(String groupNumber) {
         if (UtilValidate.isEmpty(groupNumber)) return null;
         return (ShoppingCart.ShoppingCartItemGroup) this.itemGroupByNumberMap.get(groupNumber);
@@ -898,7 +898,7 @@
         this.itemGroupByNumberMap.put(newGroup.getGroupNumber(), newGroup);
         return newGroup.getGroupNumber();
     }
-
+
     public List getCartItemsInNoGroup() {
         List cartItemList = FastList.newInstance();
         for (ShoppingCartItem cartItem : cartLines) {
@@ -908,7 +908,7 @@
         }
         return cartItemList;
     }
-
+
     public List getCartItemsInGroup(String groupNumber) {
         List cartItemList = FastList.newInstance();
         ShoppingCart.ShoppingCartItemGroup itemGroup = this.getItemGroupByNumber(groupNumber);
@@ -921,7 +921,7 @@
         }
         return cartItemList;
     }
-
+
     public void deleteItemGroup(String groupNumber) {
         ShoppingCartItemGroup itemGroup = this.getItemGroupByNumber(groupNumber);
         if (itemGroup != null) {
@@ -932,7 +932,7 @@
                 ShoppingCartItem cartItem = (ShoppingCartItem) cartItemIter.next();
                 cartItem.setItemGroup(null);
             }
-
+
             // if this is a parent of any set them to this group's parent (or null)
             Iterator itemGroupIter = this.itemGroupByNumberMap.values().iterator();
             while (itemGroupIter.hasNext()) {
@@ -941,12 +941,12 @@
                     otherItemGroup.inheritParentsParent();
                 }
             }
-
+
             // finally, remove the itemGroup...
             this.itemGroupByNumberMap.remove(groupNumber);
         }
     }
-
+
     //=======================================================
     // Other General Info Maintenance Methods
     //=======================================================
@@ -1113,15 +1113,15 @@
    public void setDefaultShipBeforeDate(Timestamp defaultShipBeforeDate) {
       this.defaultShipBeforeDate = defaultShipBeforeDate;
    }
-
+
    public Timestamp getDefaultShipBeforeDate() {
        return this.defaultShipBeforeDate;
    }
-
+
    public void setDefaultShipAfterDate(Timestamp defaultShipAfterDate) {
        this.defaultShipAfterDate = defaultShipAfterDate;
    }
-
+
     public void setCancelBackOrderDate(Timestamp cancelBackOrderDate) {
         this.cancelBackOrderDate = cancelBackOrderDate;
     }
@@ -1129,11 +1129,11 @@
     public Timestamp getCancelBackOrderDate() {
         return this.cancelBackOrderDate;
     }
-
+
    public Timestamp getDefaultShipAfterDate() {
        return this.defaultShipAfterDate;
    }
-
+
     public String getOrderPartyId() {
         return this.orderPartyId != null ? this.orderPartyId : this.getPartyId();
     }
@@ -1542,7 +1542,7 @@
             paymentInfo.remove(inf);
         }
         paymentInfo.add(inf);
-
+
         return inf;
     }
 
@@ -1581,7 +1581,7 @@
         }
         return null;
     }
-
+
     /** returns the total payment amounts */
     public BigDecimal getPaymentTotal() {
         BigDecimal total = BigDecimal.ZERO;
@@ -1827,7 +1827,7 @@
     public GenericValue getGiftCertSettingFromStore(GenericDelegator delegator) throws GenericEntityException {
         return delegator.findByPrimaryKeyCache("ProductStoreFinActSetting", UtilMisc.toMap("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId));
     }
-
+
     /**
      * Determines whether pin numbers are required for gift cards, based on ProductStoreFinActSetting.  Default to true.
      * @return
@@ -1850,7 +1850,7 @@
             return true;
         }
     }
-
+
     /**
      * Returns whether the cart should validate gift cards against FinAccount (ie, internal gift certificates).  Defaults to false.
      * @param delegator
@@ -1874,7 +1874,7 @@
             return false;
         }
     }
-
+
     // =======================================================================
     // Billing Accounts
     // =======================================================================
@@ -1991,18 +1991,18 @@
      */
     public void setShipGroupShipDatesFromItem(ShoppingCartItem item) {
         Map shipGroups = this.getShipGroups(item);
-
+
         if ((shipGroups != null) && (shipGroups.keySet() != null)) {
             for (Iterator shipGroupKeys = shipGroups.keySet().iterator(); shipGroupKeys.hasNext(); ) {
                 Integer shipGroup = (Integer) shipGroupKeys.next();
                 CartShipInfo cartShipInfo = this.getShipInfo(shipGroup.intValue());
-
+
                 cartShipInfo.resetShipAfterDateIfBefore(item.getShipAfterDate());
                 cartShipInfo.resetShipBeforeDateIfAfter(item.getShipBeforeDate());
             }
         }
     }
-
+
     public BigDecimal getItemShipGroupEstimate(int idx) {
         CartShipInfo csi = this.getShipInfo(idx);
         return csi.shipEstimate;
@@ -2029,11 +2029,11 @@
             if (quantity.compareTo(item.getQuantity()) > 0) {
                 quantity = item.getQuantity();
             }
-
+
             // re-set the ship group's before and after dates based on the item's
             csi.resetShipBeforeDateIfAfter(item.getShipBeforeDate());
             csi.resetShipAfterDateIfBefore(item.getShipAfterDate());
-
+
             CartShipInfo.CartShipItemInfo csii = csi.setItemInfo(item, quantity);
             this.checkShipItemInfo(csi, csii);
         }
@@ -2343,7 +2343,7 @@
         CartShipInfo csi = this.getShipInfo(idx);
         csi.shipGroupSeqId = shipGroupSeqId;
     }
-
+
     public String getShipGroupSeqId(int idx) {
         CartShipInfo csi = this.getShipInfo(idx);
         return csi.shipGroupSeqId;
@@ -2381,7 +2381,7 @@
     public List getInternalOrderNotes() {
         return this.internalOrderNotes;
     }
-
+
     public List getOrderNotes() {
         return this.orderNotes;
     }
@@ -2646,7 +2646,7 @@
     public int addOrderTerm(String termTypeId, BigDecimal termValue, Long termDays) {
         return addOrderTerm(termTypeId, termValue, termDays, null);
     }
-
+
     /** Add an orderTerm to the order */
     public int addOrderTerm(String termTypeId, BigDecimal termValue, Long termDays, String textValue) {
         GenericValue orderTerm = GenericValue.create(delegator.getModelEntity("OrderTerm"));
@@ -3010,7 +3010,7 @@
     public Iterator getProductPromoUseInfoIter() {
         return productPromoUseInfoList.iterator();
     }
-
+
     public BigDecimal getProductPromoTotal() {
         BigDecimal totalDiscount = BigDecimal.ZERO;
         List cartAdjustments = this.getAdjustments();
@@ -3249,7 +3249,7 @@
     // =======================================================================
     // Methods used for order creation
     // =======================================================================
-
+
     /**
      * Returns the Id of an AGGREGATED_CONF product having exact configId.
      * If AGGREGATED_CONF product do not exist, creates one, associates it to the AGGREGATED product, and copy its production run template.
@@ -3268,7 +3268,7 @@
             if (configId.equals(newProductId)) {
                 return newProductId;
             }
-
+
             //create new product and associate it
             GenericValue product = item.getProduct();
             String productName = product.getString("productName");
@@ -3285,13 +3285,13 @@
                 serviceContext.put("requirementMethodEnumId", product.getString("requirementMethodEnumId"));
             }
             serviceContext.put("userLogin", permUserLogin);
-
+
             Map result = dispatcher.runSync("createProduct", serviceContext);
             if (ServiceUtil.isError(result)) {
                 Debug.logError(ServiceUtil.getErrorMessage(result), module);
                 return null;
             }
-
+
             serviceContext.clear();
             newProductId = (String) result.get("productId");
             serviceContext.put("productId", item.getProductId());
@@ -3305,7 +3305,7 @@
                 Debug.logError(ServiceUtil.getErrorMessage(result), module);
                 return null;
             }
-
+
             //create a new WorkEffortGoodStandard based on existing one of AGGREGATED product .
             //Another approach could be to get WorkEffortGoodStandard of the AGGREGATED product while creating production run.
             List productionRunTemplates = getDelegator().findByAnd("WorkEffortGoodStandard", UtilMisc.toMap("productId", item.getProductId(), "workEffortGoodStdTypeId", "ROU_PROD_TEMPLATE", "statusId", "WEGS_CREATED"));
@@ -3324,7 +3324,7 @@
                     return null;
                 }
             }
-
+
         } catch (Exception e) {
             Debug.logError(e, module);
             return null;
@@ -3332,7 +3332,7 @@
 
         return newProductId;
     }
-
+
     public List makeOrderItemGroups() {
         List result = FastList.newInstance();
         Iterator groupValueIter = this.itemGroupByNumberMap.values().iterator();
@@ -3463,7 +3463,7 @@
                 if (fromInventoryItemId != null) {
                     orderItem.set("fromInventoryItemId", fromInventoryItemId);
                 }
-
+
                 result.add(orderItem);
                 // don't do anything with adjustments here, those will be added below in makeAllAdjustments
             }
@@ -3844,7 +3844,7 @@
     }
 
     public List makeAllOrderAttributes() {
-
+
         return makeAllOrderAttributes(null, ALL);
     }
 
@@ -4021,17 +4021,17 @@
                 return;
             }
         }
-
+
         List shipGroups = getShipGroups();
         if (shipGroups == null) return;
 
         // Intermediate structure supplierPartyId -> { ShoppingCartItem = { originalShipGroupIndex = dropShipQuantity } } to collect drop-shippable items
         Map dropShipItems = new HashMap();
-
+
         for (int shipGroupIndex = 0; shipGroupIndex < shipGroups.size(); shipGroupIndex++) {
-
+
             CartShipInfo shipInfo = (CartShipInfo) shipGroups.get(shipGroupIndex);
-
+
             // Ignore ship groups that are already drop shipped
             String shipGroupSupplierPartyId = shipInfo.getSupplierPartyId();
             if (UtilValidate.isNotEmpty(shipGroupSupplierPartyId)) {
@@ -4044,7 +4044,7 @@
 
             Iterator siit = shipItems.iterator();
             while (siit.hasNext()) {
-
+
                 ShoppingCartItem cartItem = (ShoppingCartItem) siit.next();
 
                 BigDecimal itemQuantity = cartItem.getQuantity();
@@ -4058,12 +4058,12 @@
                 String requirementMethodEnumId = product.getString("requirementMethodEnumId");
 
                 if ("PRODRQM_DS".equals(requirementMethodEnumId)) {
-
+
                     // Drop ship the full quantity if the product is marked drop-ship only
                     dropShipQuantity = itemQuantity;
-
+
                 } else if ("PRODRQM_DSATP".equals(requirementMethodEnumId)) {
-
+
                     // Drop ship the quantity not available in inventory if the product is marked drop-ship on low inventory
                     try {
 
@@ -4081,19 +4081,19 @@
                         Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetInventoryAvailableByFacilityError", locale) + e.getMessage(), module);
                     }
                 } else {
-
+
                     // Don't drop ship anything if the product isn't so marked
                     dropShipQuantity = BigDecimal.ZERO;
                 }
 
                 if (dropShipQuantity.compareTo(BigDecimal.ZERO) <= 0) continue;
-
+
                 // Find a supplier for the product
                 String supplierPartyId = null;
                 try {
                     Map getSuppliersForProductResult = dispatcher.runSync("getSuppliersForProduct", UtilMisc.<String, Object>toMap("productId", productId, "quantity", dropShipQuantity, "canDropShip", "Y", "currencyUomId", getCurrency()));
                     List supplierProducts = (List) getSuppliersForProductResult.get("supplierProducts");
-
+
                     // Order suppliers by supplierPrefOrderId so that preferred suppliers are used first
                     supplierProducts = EntityUtil.orderBy(supplierProducts, UtilMisc.toList("supplierPrefOrderId"));
                     GenericValue supplierProduct = EntityUtil.getFirst(supplierProducts);
@@ -4103,10 +4103,10 @@
                 } catch (Exception e) {
                     Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError", locale) + e.getMessage(), module);
                 }
-
+
                 // Leave the items untouched if we couldn't find a supplier
                 if (UtilValidate.isEmpty(supplierPartyId)) continue;
-
+
                 if (! dropShipItems.containsKey(supplierPartyId)) dropShipItems.put(supplierPartyId, new HashMap());
                 Map supplierCartItems = (Map) dropShipItems.get(supplierPartyId);
 
@@ -4124,7 +4124,7 @@
 
             CartShipInfo shipInfo = null;
             int newShipGroupIndex = -1 ;
-
+
             // Attempt to get the first ship group for the supplierPartyId
             TreeMap supplierShipGroups = (TreeMap) this.getShipGroupsBySupplier(supplierPartyId);
             if (! UtilValidate.isEmpty(supplierShipGroups)) {
@@ -4153,7 +4153,7 @@
             }
         }
     }
-
+
     static class BasePriceOrderComparator implements Comparator, Serializable {
         private boolean ascending = false;
 
@@ -4193,36 +4193,36 @@
         protected ShoppingCartItemGroup(long groupNumber, String groupName) {
             this(groupNumber, groupName, null);
         }
-
+
         /** Note that to avoid foreign key issues when the groups are created a parentGroup should have a lower number than the child group. */
         protected ShoppingCartItemGroup(long groupNumber, String groupName, ShoppingCartItemGroup parentGroup) {
             this.groupNumber = groupNumber;
             this.groupName = groupName;
             this.parentGroup = parentGroup;
         }
-
+
         protected ShoppingCartItemGroup(ShoppingCartItemGroup itemGroup, ShoppingCartItemGroup parentGroup) {
             this.groupNumber = itemGroup.groupNumber;
             this.groupName = itemGroup.groupName;
             this.parentGroup = parentGroup;
         }
-
+
         public String getGroupNumber() {
             return UtilFormatOut.formatPaddedNumber(this.groupNumber, 2);
         }
-
+
         public String getGroupName() {
             return this.groupName;
         }
-
+
         public void setGroupName(String str) {
             this.groupName = str;
         }
-
+
         public ShoppingCartItemGroup getParentGroup () {
             return this.parentGroup;
         }
-
+
         protected GenericValue makeOrderItemGroup(GenericDelegator delegator) {
             GenericValue orderItemGroup = delegator.makeValue("OrderItemGroup");
             orderItemGroup.set("orderItemGroupSeqId", this.getGroupNumber());
@@ -4232,13 +4232,13 @@
             }
             return orderItemGroup;
         }
-
+
         public void inheritParentsParent() {
             if (this.parentGroup != null) {
                 this.parentGroup = this.parentGroup.getParentGroup();
             }
         }
-
+
         public boolean equals(Object obj) {
             if (obj == null) return false;
             ShoppingCartItemGroup that = (ShoppingCartItemGroup) obj;
@@ -4311,7 +4311,7 @@
         public List makeItemShipGroupAndAssoc(GenericDelegator delegator, ShoppingCart cart, long groupIndex) {
             shipGroupSeqId = UtilFormatOut.formatPaddedNumber(groupIndex, 5);
             List values = new LinkedList();
-
+
             // create order contact mech for shipping address
             if (this.internalContactMechId != null) {
                 GenericValue orderCm = delegator.makeValue("OrderContactMech");
@@ -4334,7 +4334,7 @@
             shipGroup.set("shipGroupSeqId", shipGroupSeqId);
             shipGroup.set("vendorPartyId", vendorPartyId);
             shipGroup.set("facilityId", facilityId);
-
+
             // use the cart's default ship before and after dates here
             if ((shipBeforeDate == null) && (cart.getDefaultShipBeforeDate() != null)) {
                 shipGroup.set("shipByDate", cart.getDefaultShipBeforeDate());
@@ -4346,7 +4346,7 @@
             } else {
                 shipGroup.set("shipAfterDate", shipAfterDate);
             }
-
+
             values.add(shipGroup);
 
             //set estimated ship dates
@@ -4363,7 +4363,7 @@
                 Timestamp estimatedShipDate  = (Timestamp) estimatedShipDates.getLast();
                 shipGroup.set("estimatedShipDate", estimatedShipDate);
             }
-
+
             //set estimated delivery dates
             FastList estimatedDeliveryDates = FastList.newInstance();
             for (Map.Entry <Object, Object> entry : shipItemInfo.entrySet()) {
@@ -4378,7 +4378,7 @@
                 Timestamp estimatedDeliveryDate = (Timestamp) estimatedDeliveryDates.getLast();
                 shipGroup.set("estimatedDeliveryDate", estimatedDeliveryDate);
             }
-
+
             // create the shipping estimate adjustments
             if (shipEstimate.compareTo(BigDecimal.ZERO) != 0) {
                 GenericValue shipAdj = delegator.makeValue("OrderAdjustment");
@@ -4488,7 +4488,7 @@
                 }
             }
         }
-
+
         /**
          * Reset the ship group's shipAfterDate if it is before the parameter
          * @param newShipBeforeDate
@@ -4500,7 +4500,7 @@
                 }
             }
         }
-
+
         public BigDecimal getTotalTax(ShoppingCart cart) {
             BigDecimal taxTotal = ZERO;
             for (int i = 0; i < shipTaxAdj.size(); i++) {
@@ -4516,7 +4516,7 @@
 
             return taxTotal;
         }
-
+
         public BigDecimal getTotal() {
             BigDecimal shipItemTotal = ZERO;
             Iterator iter = shipItemInfo.values().iterator();
@@ -4547,11 +4547,11 @@
             public ShoppingCartItem getItem() {
                 return this.item;
             }
-
+
             public BigDecimal getItemQuantity() {
                 return this.quantity;
             }
-
+
             public BigDecimal getItemSubTotal() {
                 return item.getItemSubTotal(quantity);
             }
@@ -4652,7 +4652,7 @@
                         values.add(orderCm);
                     }
                 }
-
+
                 GenericValue productStore = null;
                 try {
                     productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId()));
@@ -4672,7 +4672,7 @@
                         CartShipInfo csi = (CartShipInfo) shipIter.next();
                         maxAmount = csi.getTotal().add(cart.getOrderOtherAdjustmentTotal().divide(new BigDecimal(cart.getShipGroupSize()), generalRounding)).add(csi.getShipEstimate().add(csi.getTotalTax(cart)));
                         maxAmount = maxAmount.setScale(scale, rounding);
-
+
                         // create the OrderPaymentPreference record
                         GenericValue opp = delegator.makeValue("OrderPaymentPreference");
                         opp.set("paymentMethodTypeId", valueObj.getString("paymentMethodTypeId"));
@@ -4712,7 +4712,7 @@
                 } else if ("N".equals(splitPayPrefPerShpGrp)) {
                     maxAmount = maxAmount.add(amount);
                     maxAmount = maxAmount.setScale(scale, rounding);
-
+
                     // create the OrderPaymentPreference record
                     GenericValue opp = delegator.makeValue("OrderPaymentPreference");
                     opp.set("paymentMethodTypeId", valueObj.getString("paymentMethodTypeId"));
@@ -4763,7 +4763,7 @@
             } else if (!this.finAccountId.equals(that.finAccountId)) {
                 return -1;
             }
-
+
             if (this.paymentMethodId != null) {
                 if (that.paymentMethodId == null) {
                     return 1;
@@ -4817,7 +4817,7 @@
             return "Pm: " + paymentMethodId + " / PmType: " + paymentMethodTypeId + " / Amt: " + amount + " / Ref: " + refNum[0] + "!" + refNum[1];
         }
     }
-
+
     protected void finalize() throws Throwable {
         // DEJ20050518 we should not call clear because it kills the auto-save shopping list and is unnecessary given that when this object is GC'ed it will cause everything it points to that isn't referenced anywhere else to be GC'ed too: this.clear();
         super.finalize();

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Fri Mar 27 17:01:06 2009
@@ -91,7 +91,7 @@
         }
         return "success";
     }
-
+
     public static String addItemGroup(HttpServletRequest request, HttpServletResponse response) {
         ShoppingCart cart = getCartObject(request);
         Map parameters = UtilHttp.getParameterMap(request);
@@ -101,7 +101,7 @@
         request.setAttribute("itemGroupNumber", groupNumber);
         return "success";
     }
-
+
     public static String addCartItemToGroup(HttpServletRequest request, HttpServletResponse response) {
         ShoppingCart cart = getCartObject(request);
         Map parameters = UtilHttp.getParameterMap(request);
@@ -112,7 +112,7 @@
         cartItem.setItemGroup(itemGroupNumber, cart);
         return "success";
     }
-
+
     /** Event to add an item to the shopping cart. */
     public static String addToCart(HttpServletRequest request, HttpServletResponse response) {
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
@@ -185,7 +185,7 @@
         if (productCategoryId != null && productCategoryId.length() == 0) {
             productCategoryId = null;
         }
-
+
         if (paramMap.containsKey("ADD_ITEM_TYPE")) {
             itemType = (String) paramMap.remove("ADD_ITEM_TYPE");
         } else if (paramMap.containsKey("add_item_type")) {
@@ -244,8 +244,8 @@
                 ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator);
             }
         }
-
-
+
+
         //Check for virtual products
         if (ProductWorker.isVirtual(delegator, productId)) {
 
@@ -259,14 +259,14 @@
                         selectedFeatures.add(request.getParameterValues(paramName)[0]);
                     }
                 }
-
+
                 // check if features are selected
                 if (UtilValidate.isEmpty(selectedFeatures)) {
                     request.setAttribute("product_id", productId);
                     request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource_error,"cart.addToCart.chooseVariationBeforeAddingToCart",locale));
                     return "product";
                 }
-
+
                 String variantProductId = ProductWorker.getVariantFromFeatureTree(productId, selectedFeatures, delegator);
                 if (UtilValidate.isNotEmpty(variantProductId)) {
                     productId = variantProductId;
@@ -282,7 +282,7 @@
                 return "product";
             }
         }
-
+
         // get the override price
         if (paramMap.containsKey("PRICE")) {
             priceStr = (String) paramMap.remove("PRICE");
@@ -360,7 +360,7 @@
                     return "error";
                 }
             }
-
+
             //check for valid rental parameters
             if (UtilValidate.isEmpty(reservStart) && UtilValidate.isEmpty(reservLength) && UtilValidate.isEmpty(reservPersons)) {
                 request.setAttribute("product_id", productId);
@@ -419,14 +419,14 @@
                 amount = null;
             }
         }
-
+
         // check for required amount
         if ((ProductWorker.isAmountRequired(delegator, productId)) && (amount == null || amount.doubleValue() == 0.0)) {
             request.setAttribute("product_id", productId);
             request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource_error,"cart.addToCart.enterAmountBeforeAddingToCart",locale));
             return "product";
         }
-
+
         // get the ship before date (handles both yyyy-mm-dd input and full timestamp)
         shipBeforeDateStr = (String) paramMap.remove("shipBeforeDate");
         if (shipBeforeDateStr != null && shipBeforeDateStr.length() > 0) {
@@ -484,7 +484,7 @@
         if (surveyResponses != null) {
             paramMap.put("surveyResponses", surveyResponses);
         }
-
+
         GenericValue productStore = ProductStoreWorker.getProductStore(request);
         String addToCartRemoveIncompat = productStore.getString("addToCartRemoveIncompat");
         String addToCartReplaceUpsell = productStore.getString("addToCartReplaceUpsell");
@@ -544,7 +544,7 @@
         } catch (GenericEntityException e) {
             Debug.logError(e.getMessage(), module);
         }
-
+
         // Translate the parameters and add to the cart
         result = cartHelper.addToCart(catalogId, shoppingListId, shoppingListItemSeqId, productId, productCategoryId,
                 itemType, itemDescription, price, amount, quantity, reservStart, reservLength, reservPersons,
@@ -642,7 +642,7 @@
         }
 
         cart.setOrderType("PURCHASE_ORDER");
-
+
         session.setAttribute("shoppingCart", cart);
         session.setAttribute("productStoreId", cart.getProductStoreId());
         session.setAttribute("orderMode", cart.getOrderType());
@@ -784,13 +784,13 @@
             // here we want to do a full logout, but not using the normal logout stuff because it saves things in the UserLogin record that we don't want changed for the anonymous user
             session.invalidate();
             session = request.getSession(true);
-
+
             // to allow the display of the order confirmation page put the userLogin in the request, but leave it out of the session
             request.setAttribute("temporaryAnonymousUserLogin", userLogin);
-
+
             Debug.logInfo("Doing clearCart for anonymous user, so logging out but put anonymous userLogin in temporaryAnonymousUserLogin request attribute", module);
         }
-
+
         return "success";
     }
 
@@ -1128,7 +1128,7 @@
         }
         return "success";
     }
-
+
     /**
      * set the order name of the cart based on request.  right now will always return "success"
      *
@@ -1292,7 +1292,7 @@
                                                 UtilMisc.<String, Object>toMap("orderId", quoteId,
                                                         "skipProductChecks", Boolean.TRUE, // the products have already been checked in the order, no need to check their validity again
                                                         "userLogin", userLogin));
-
+
             cart = (ShoppingCart) outMap.get("shoppingCart");
         } catch (GenericServiceException exc) {
             request.setAttribute("_ERROR_MESSAGE_", exc.getMessage());
@@ -1451,7 +1451,7 @@
         // set party info
         String partyId = request.getParameter("supplierPartyId");
         cart.setAttribute("supplierPartyId", partyId);
-
+
         if (!UtilValidate.isEmpty(request.getParameter("partyId"))) {
             partyId = request.getParameter("partyId");
         }
@@ -1702,10 +1702,10 @@
 
         // set the order name
         cart.setOrderName(orderName);
-
+
         // set the corresponding purchase order id
         cart.setPoNumber(correspondingPoId);
-
+
         // set the default ship before and after dates if supplied
         try {
             if (UtilValidate.isNotEmpty(shipBeforeDateStr)) {
@@ -1726,9 +1726,9 @@
         }
         return "success";
     }
-
+
     public static String getConfigDetailsEvent(HttpServletRequest request, HttpServletResponse response) {
-
+
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         String productId = request.getParameter("product_id");
         String currencyUomId = ShoppingCartEvents.getCartObject(request).getCurrency();
@@ -1743,11 +1743,11 @@
             ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator);
             request.setAttribute("configId", configWrapper.getConfigId());
         }
-
+
         request.setAttribute("totalPrice", org.ofbiz.base.util.UtilFormatOut.formatCurrency(configWrapper.getTotalPrice(), currencyUomId, UtilHttp.getLocale(request)));
         return "success";
     }
-
+
     public static String bulkAddProductsInApprovedOrder(HttpServletRequest request, HttpServletResponse response) {
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
@@ -1761,7 +1761,7 @@
         String itemDescription = "";
         String orderId = null;
         String shipGroupSeqId = null;
-
+
         Map paramMap = UtilHttp.getParameterMap(request);
         String itemGroupNumber = request.getParameter("itemGroupNumber");
         int rowCount = UtilHttp.getMultiFormRowCount(paramMap);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Fri Mar 27 17:01:06 2009
@@ -110,7 +110,7 @@
                 reservStart,reservLength,reservPersons,null,null,shipBeforeDate,shipAfterDate,
                 configWrapper,itemGroupNumber,context,parentProductId);
     }
-
+
     /** Event to add an item to the shopping cart with accommodation. */
     public Map addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
             String productCategoryId, String itemType, String itemDescription,
@@ -201,7 +201,7 @@
             Debug.logInfo("parent productid " + pProductId,module);
             //if (product != null && !"Y".equals(product.getString("isVariant")))
             //    pProductId = null;
-
+
         }
 
         // Get the additional features selected for the product (if any)
@@ -227,16 +227,16 @@
                 additionalFeaturesMap.put(selectedFeatureType, productFeatureAndAppl);
             }
         }
-
+
         // add or increase the item to the cart
         try {
             int itemId = -1;
             if (productId != null) {
-
+
                        itemId = cart.addOrIncreaseItem(productId, amount, quantity, reservStart, reservLength,
                                                 reservPersons, accommodationMapId, accommodationSpotId, shipBeforeDate, shipAfterDate, additionalFeaturesMap, attributes,
                                                 catalogId, configWrapper, itemType, itemGroupNumber, pProductId, dispatcher);
-
+
             } else {
                 itemId = cart.addNonProductItem(itemType, itemDescription, productCategoryId, price, quantity, attributes, catalogId, itemGroupNumber, dispatcher);
             }
@@ -259,7 +259,7 @@
             result = ServiceUtil.returnError(e.getMessage());
             return result;
         }
-
+
         // Indicate there were no critical errors
         result = ServiceUtil.returnSuccess();
         return result;
@@ -290,7 +290,7 @@
         if (UtilValidate.isNotEmpty(itemIdList)) {
             itemIter = itemIdList.iterator();
         }
-
+
         String orderItemTypeId = null;
         String productId = null;
         if (itemIter != null && itemIter.hasNext()) {
@@ -322,7 +322,7 @@
                         } catch (GenericEntityException e) {
                             errorMsgs.add(e.getMessage());
                         }
-
+
                     }
                     try {
                         this.cart.addOrIncreaseItem(UtilValidate.isNotEmpty(aggregatedProdId) ? aggregatedProdId :  productId, amount, orderItem.getBigDecimal("quantity"),
@@ -370,10 +370,10 @@
         String keyPrefix = "quantity_";
         // use this prefix for a different structure, useful for radio buttons; can have any suffix, name="product_${whatever}" value="${productId}" and quantity is always 1
         String productQuantityKeyPrefix = "product_";
-
+
         // If a _ign_${itemGroupNumber} is appended to the name it will be put in that group instead of the default in the request parameter in itemGroupNumber
         String ignSeparator = "_ign_";
-
+
         // iterate through the context and find all keys that start with "quantity_"
         Iterator entryIter = context.entrySet().iterator();
         while (entryIter.hasNext()) {
@@ -390,7 +390,7 @@
                     itemGroupNumberToUse = key.substring(ignIndex + ignSeparator.length());
                     key = key.substring(0, ignIndex);
                 }
-
+
                 if (key.startsWith(keyPrefix)) {
                     productId = key.substring(keyPrefix.length());
                     quantStr = (String) entry.getValue();
@@ -438,11 +438,11 @@
         // check if we are using per row submit
         boolean useRowSubmit = (!context.containsKey("_useRowSubmit"))? false :
                 "Y".equalsIgnoreCase((String)context.get("_useRowSubmit"));
-
+
         // check if we are to also look in a global scope (no delimiter)
         //boolean checkGlobalScope = (!context.containsKey("_checkGlobalScope"))? false :
         //        "Y".equalsIgnoreCase((String)context.get("_checkGlobalScope"));
-
+
         // The number of multi form rows is retrieved
         int rowCount = UtilHttp.getMultiFormRowCount(context);
 
@@ -451,7 +451,7 @@
         if (UtilValidate.isNotEmpty(facilityId)) {
             cart.setFacilityId(facilityId);
         }
-
+
         // now loop throw the rows and prepare/invoke the service for each
         for (int i = 0; i < rowCount; i++) {
             String productId = null;
@@ -460,12 +460,12 @@
             String thisSuffix = UtilHttp.MULTI_ROW_DELIMITER + i;
             boolean rowSelected = (!context.containsKey("_rowSubmit" + thisSuffix))? false :
                     "Y".equalsIgnoreCase((String)context.get("_rowSubmit" + thisSuffix));
-
+
             // make sure we are to process this row
             if (useRowSubmit && !rowSelected) {
                 continue;
             }
-
+
             // build the context
             if (context.containsKey("productId" + thisSuffix)) {
                 productId = (String) context.get("productId" + thisSuffix);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Fri Mar 27 17:01:06 2009
@@ -133,7 +133,7 @@
     private Timestamp shipAfterDate = null;
     private Timestamp EstimatedShipDate = null;
     private Timestamp cancelBackOrderDate = null;
-
+
     private Map contactMechIdsMap = FastMap.newInstance();
     private List orderItemPriceInfos = null;
     private List itemAdjustments = new LinkedList();
@@ -199,7 +199,7 @@
 
             String excMsg = UtilProperties.getMessage(resource_error, "item.cannot_add_product_virtual",
                                           messageMap , cart.getLocale() );
-
+
             Debug.logWarning(excMsg, module);
             throw new CartItemModifyException(excMsg);
         }
@@ -214,7 +214,7 @@
 
                 String excMsg = UtilProperties.getMessage(resource_error, "item.cannot_add_product_not_configured_correctly",
                                               messageMap , cart.getLocale() );
-
+
                 Debug.logWarning(excMsg, module);
                 throw new CartItemModifyException(excMsg);
             }
@@ -230,7 +230,7 @@
         if (selectedAmount != null) {
             newItem.setSelectedAmount(selectedAmount);
         }
-
+
         // set the ship before/after/dates and cancel back order date.  this needs to happen before setQuantity because setQuantity causes the ship group's dates to be
         // checked versus the cart item's
         newItem.setShipBeforeDate(shipBeforeDate != null ? shipBeforeDate : cart.getDefaultShipBeforeDate());
@@ -291,15 +291,15 @@
             Map additionalProductFeatureAndAppls, Map attributes, String prodCatalogId, ProductConfigWrapper configWrapper,
             String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, LocalDispatcher dispatcher, ShoppingCart cart, Boolean triggerExternalOpsBool, Boolean triggerPriceRulesBool, String parentProductId, Boolean skipInventoryChecks, Boolean skipProductChecks)
             throws CartItemModifyException, ItemNotFoundException {
-
+
         return makeItem(cartLocation,productId,selectedAmount,quantity,unitPrice,
                 reservStart,reservLength,reservPersons,null,null,shipBeforeDate,shipAfterDate,
                 additionalProductFeatureAndAppls,attributes,prodCatalogId,configWrapper,
                 itemType,itemGroup,dispatcher,cart,triggerExternalOpsBool,triggerPriceRulesBool,
                 parentProductId,skipInventoryChecks,skipProductChecks);
-
+
     }
-
+
     /**
      * Makes a ShoppingCartItem and adds it to the cart.
      * @param accommodationMapId Optional. reservations add into workeffort
@@ -313,10 +313,10 @@
         GenericDelegator delegator = cart.getDelegator();
         GenericValue product = null;
         GenericValue parentProduct = null;
-
+
         try {
             product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
-
+
             // first see if there is a purchase allow category and if this product is in it or not
             String purchaseProductCategoryId = CatalogWorker.getCatalogPurchaseAllowCategoryId(delegator, prodCatalogId);
             if (product != null && purchaseProductCategoryId != null) {
@@ -330,11 +330,11 @@
             Debug.logWarning(e.toString(), module);
             product = null;
         }
-
+
         if (product == null) {
             Map messageMap = UtilMisc.toMap("productId", productId );
             String excMsg = UtilProperties.getMessage(resource_error, "item.product_not_found", messageMap , cart.getLocale() );
-
+
             Debug.logWarning(excMsg, module);
             throw new ItemNotFoundException(excMsg);
         }
@@ -396,7 +396,7 @@
                prodCatalogId,configWrapper,itemType,itemGroup,dispatcher,cart,
                triggerExternalOpsBool,triggerPriceRulesBool,parentProduct,skipInventoryChecks,skipProductChecks);
     }
-
+
     /**
      * Makes a ShoppingCartItem and adds it to the cart.
      * @param accommodationMapId Optional. reservations add into workeffort
@@ -417,7 +417,7 @@
         reservPersons = reservPersons == null ? BigDecimal.ZERO : reservPersons;
         boolean triggerPriceRules = triggerPriceRulesBool == null ? true : triggerPriceRulesBool.booleanValue();
         boolean triggerExternalOps = triggerExternalOpsBool == null ? true : triggerExternalOpsBool.booleanValue();
-
+
         // check to see if product is virtual
         if ("Y".equals(product.getString("isVirtual"))) {
             Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
@@ -431,7 +431,7 @@
         }
 
         java.sql.Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
-
+
         if (!skipProductChecks.booleanValue()) {
             // check to see if introductionDate hasn't passed yet
             if (product.get("introductionDate") != null && nowTimestamp.before(product.getTimestamp("introductionDate"))) {
@@ -473,7 +473,7 @@
                 }
             }
              */
-
+
             // check to see if the product is fully configured
             if ("AGGREGATED".equals(product.getString("productTypeId"))) {
                 if (configWrapper == null || !configWrapper.isCompleted()) {
@@ -486,7 +486,7 @@
                 }
             }
         }
-
+
         // check to see if the product is a rental item
         if ("ASSET_USAGE".equals(product.getString("productTypeId"))) {
             if (reservStart == null)    {
@@ -508,7 +508,7 @@
                 throw new CartItemModifyException(excMsg);
             }
             newItem.setReservLength(reservLength);
-
+
             if (product.get("reservMaxPersons") != null) {
                 BigDecimal reservMaxPersons = product.getBigDecimal("reservMaxPersons");
                  if (reservMaxPersons.compareTo(reservPersons) < 0)    {
@@ -516,7 +516,7 @@
                                                      "reservPersons", reservPersons);
                      String excMsg = UtilProperties.getMessage(resource_error, "item.maximum_number_of_person_renting",
                                                    messageMap, cart.getLocale() );
-
+
                      Debug.logInfo(excMsg,module);
                      throw new CartItemModifyException(excMsg);
                  }
@@ -528,11 +528,11 @@
 
              if (product.get("reservNthPPPerc") != null)
                  newItem.setReservNthPPPerc(product.getBigDecimal("reservNthPPPerc"));
-
+
              if ((accommodationMapId != null) && (accommodationSpotId != null)) {
                 newItem.setAccommodationId(accommodationMapId,accommodationSpotId);
              }
-
+
             // check to see if the related fixed asset is available for rent
             String isAvailable = checkAvailability(product.getString("productId"), quantity, reservStart, reservLength, cart);
             if (isAvailable.compareTo("OK") != 0) {
@@ -544,11 +544,11 @@
                 throw new CartItemModifyException(isAvailable);
             }
         }
-
+
         // set the ship before and after dates (defaults to cart ship before/after dates)
         newItem.setShipBeforeDate(shipBeforeDate != null ? shipBeforeDate : cart.getDefaultShipBeforeDate());
         newItem.setShipAfterDate(shipAfterDate != null ? shipAfterDate : cart.getDefaultShipAfterDate());
-
+
         // set the product unit price as base price
         // if triggerPriceRules is true this price will be overriden
         newItem.setBasePrice(unitPrice);
@@ -612,7 +612,7 @@
         } else {
             cart.addItem(cartLocation.intValue(), newItem);
         }
-
+
         boolean triggerExternalOps = triggerExternalOpsBool == null ? true : triggerExternalOpsBool.booleanValue();
 
         try {
@@ -766,7 +766,7 @@
     public String getExternalId() {
         return this.externalId;
     }
-
+
     /** Sets the user selected amount */
     public void setSelectedAmount(BigDecimal selectedAmount) {
         this.selectedAmount = selectedAmount;
@@ -1191,7 +1191,7 @@
                             this.setDisplayPrice(configWrapper.getTotalPrice());
                         }
                     }
-
+
                     // no try to do a recurring price calculation; not all products have recurring prices so may be null
                     Map recurringPriceContext = FastMap.newInstance();
                     recurringPriceContext.putAll(priceContext);
@@ -1246,7 +1246,7 @@
     public BigDecimal getReservPersons() {
         return this.reservPersons;
     }
-
+
     /** Returns accommodationMapId */
     public String getAccommodationMapId()    {
         return this.accommodationMapId;
@@ -1255,7 +1255,7 @@
     public String getAccommodationSpotId()    {
         return this.accommodationSpotId;
     }
-
+
     public BigDecimal getPromoQuantityUsed() {
         if (this.getIsPromo()) {
             return this.quantity;
@@ -1432,7 +1432,7 @@
     /** Sets the date to ship before */
     public void setShipBeforeDate(Timestamp date) {
         this.shipBeforeDate = date;
-
+
     }
 
     /** Returns the date to ship before */
@@ -1449,17 +1449,17 @@
     public Timestamp getShipAfterDate() {
         return this.shipAfterDate;
     }
-
+
     /** Sets the cancel back order date */
     public void setCancelBackOrderDate(Timestamp date) {
         this.cancelBackOrderDate = date;
     }
-
+
     /** Returns the cancel back order date */
     public Timestamp getCancelBackOrderDate() {
         return this.cancelBackOrderDate;
     }
-
+
     /** Sets the date to EstimatedShipDate */
     public void setEstimatedShipDate(Timestamp date) {
         this.EstimatedShipDate = date;
@@ -1504,7 +1504,7 @@
     public ShoppingCart.ShoppingCartItemGroup getItemGroup() {
         return this.itemGroup;
     }
-
+
     public boolean isInItemGroup(String groupNumber) {
         if (this.itemGroup == null) return false;
         if (this.itemGroup.getGroupNumber().equals(groupNumber)) return true;
@@ -1882,7 +1882,7 @@
         }
         return curBasePrice;
     }
-
+
     public BigDecimal getDisplayPrice() {
         BigDecimal curDisplayPrice;
         if (this.displayPrice == null) {
@@ -1896,21 +1896,21 @@
         }
         return curDisplayPrice;
     }
-
+
     public BigDecimal getSpecialPromoPrice() {
         return this.specialPromoPrice;
     }
 
     public BigDecimal getRecurringBasePrice() {
         if (this.recurringBasePrice == null) return null;
-
+
         if (selectedAmount.compareTo(BigDecimal.ZERO) > 0) {
             return this.recurringBasePrice.multiply(selectedAmount);
         } else {
             return this.recurringBasePrice;
         }
     }
-
+
     public BigDecimal getRecurringDisplayPrice() {
         if (this.recurringDisplayPrice == null) {
             return this.getRecurringBasePrice();
@@ -1922,7 +1922,7 @@
             return this.recurringDisplayPrice;
         }
     }
-
+
     /** Returns the list price. */
     public BigDecimal getListPrice() {
         return listPrice;
@@ -2000,25 +2000,25 @@
     public BigDecimal getDisplayItemSubTotal() {
         return this.getDisplayPrice().multiply(this.getQuantity()).multiply(this.getRentalAdjustment()).add(this.getOtherAdjustments());
     }
-
+
     public BigDecimal getDisplayItemSubTotalNoAdj() {
         return this.getDisplayPrice().multiply(this.getQuantity());
     }
 
     public BigDecimal getDisplayItemRecurringSubTotal() {
         BigDecimal curRecurringDisplayPrice = this.getRecurringDisplayPrice();
-
+
         if (curRecurringDisplayPrice == null) {
             return this.getOtherAdjustmentsRecurring();
         }
-
+
         return curRecurringDisplayPrice.multiply(this.getQuantity()).add(this.getOtherAdjustmentsRecurring());
     }
 
     public BigDecimal getDisplayItemRecurringSubTotalNoAdj() {
         BigDecimal curRecurringDisplayPrice = this.getRecurringDisplayPrice();
         if (curRecurringDisplayPrice == null) return BigDecimal.ZERO;
-
+
         return curRecurringDisplayPrice.multiply(this.getQuantity());
     }
 
@@ -2263,7 +2263,7 @@
     public boolean equals(String productId, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, Map additionalProductFeatureAndAppls, Map attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, BigDecimal selectedAmount) {
         return equals(productId, reservStart, reservLength, reservPersons, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, configWrapper, itemType, itemGroup, false);
     }
-
+
     /** Compares the specified object with this cart item. Defaults isPromo to false. */
     public boolean equals(String productId, Map additionalProductFeatureAndAppls, Map attributes, String prodCatalogId, BigDecimal selectedAmount, String itemType, ShoppingCart.ShoppingCartItemGroup itemGroup, boolean isPromo) {
         return equals(productId, null, BigDecimal.ZERO, BigDecimal.ZERO, null, null, additionalProductFeatureAndAppls, attributes, prodCatalogId, selectedAmount, null, itemType, itemGroup, isPromo);
@@ -2333,7 +2333,7 @@
         if (configWrapper != null && !configWrapper.equals(this.configWrapper)) {
             return false;
         }
-
+
         if (itemType != null && !itemType.equals(this.itemType)) {
             return false;
         }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Fri Mar 27 17:01:06 2009
@@ -209,7 +209,7 @@
         if (orderName != null) {
             cart.setOrderName(orderName);
         }
-
+
         // set the role information
         GenericValue placingParty = orh.getPlacingParty();
         if (placingParty != null) {
@@ -328,12 +328,12 @@
                 if (quantity == null) {
                     quantity = BigDecimal.ZERO;
                 }
-
+
                 BigDecimal unitPrice = null;
                 if ("Y".equals(item.getString("isModifiedPrice"))) {
                     unitPrice = item.getBigDecimal("unitPrice");
                 }
-
+
                 int itemIndex = -1;
                 if (item.get("productId") == null) {
                     // non-product item
@@ -350,14 +350,14 @@
                     // product item
                     String prodCatalogId = item.getString("prodCatalogId");
                     String productId = item.getString("productId");
-
+
                     //prepare the rental data
                     Timestamp reservStart = null;
                     BigDecimal reservLength = null;
                     BigDecimal reservPersons = null;
                     String accommodationMapId = null;
                     String accommodationSpotId = null;
-
+
                     GenericValue workEffort = null;
                     String workEffortId = orh.getCurrentOrderItemWorkEffort(item);
                     if (workEffortId != null) {
@@ -373,9 +373,9 @@
                         reservPersons = workEffort.getBigDecimal("reservPersons");
                         accommodationMapId = workEffort.getString("accommodationMapId");
                         accommodationSpotId = workEffort.getString("accommodationSpotId");
-
+
                     }    //end of rental data
-
+
                     //check for AGGREGATED products
                     ProductConfigWrapper configWrapper = null;
                     String configId = null;
@@ -424,7 +424,7 @@
                 cartItem.setShoppingList(item.getString("shoppingListId"), item.getString("shoppingListItemSeqId"));
                 cartItem.setIsModifiedPrice("Y".equals(item.getString("isModifiedPrice")));
                 cartItem.setName(item.getString("itemDescription"));
-
+
                 // load order item attributes
                 List<GenericValue> orderItemAttributesList = null;
                 try {
@@ -459,7 +459,7 @@
 
                 // set the PO number on the cart
                 cart.setPoNumber(item.getString("correspondingPoId"));
-
+
                 List<GenericValue> itemAdjustments = orh.getOrderItemAdjustments(item);
                 if (itemAdjustments != null) {
                     for(GenericValue itemAdjustment : itemAdjustments) {
@@ -520,7 +520,7 @@
                     itemIndex ++;
                 }
             }
-
+
             // set the item seq in the cart
             if (nextItemSeq > 0) {
                 try {
@@ -538,12 +538,12 @@
             // The cart adjustments are added to the cart
             cart.getAdjustments().addAll(adjustments);
         }
-
+
         Map<String, Object> result = ServiceUtil.returnSuccess();
         result.put("shoppingCart", cart);
         return result;
     }
-
+
     public static Map<String, Object> loadCartFromQuote(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
@@ -554,7 +554,7 @@
         Locale locale = (Locale) context.get("locale");
 
         boolean applyQuoteAdjustments = applyQuoteAdjustmentsString == null || "true".equals(applyQuoteAdjustmentsString);
-
+
         // get the quote header
         GenericValue quote = null;
         try {
@@ -585,7 +585,7 @@
         cart.setQuoteId(quoteId);
         cart.setOrderName(quote.getString("quoteName"));
         cart.setChannelType(quote.getString("salesChannelEnumId"));
-
+
         List<GenericValue>quoteItems = null;
         List<GenericValue>quoteAdjs = null;
         List<GenericValue>quoteRoles = null;
@@ -705,14 +705,14 @@
                     // pass to the cart the quoteUnitPrice/amount value.
                     quoteUnitPrice = quoteUnitPrice.divide(amount, generalRounding);
                 }
-
+
                 //rental product data
                 Timestamp reservStart = quoteItem.getTimestamp("reservStart");
                 BigDecimal reservLength = quoteItem.getBigDecimal("reservLength");
                 BigDecimal reservPersons = quoteItem.getBigDecimal("reservPersons");
                 //String accommodationMapId = quoteItem.getString("accommodationMapId");
                 //String accommodationSpotId = quoteItem.getString("accommodationSpotId");
-
+
                 int itemIndex = -1;
                 if (quoteItem.get("productId") == null) {
                     // non-product item
@@ -733,7 +733,7 @@
                     }
                     try {
                             itemIndex = cart.addItemToEnd(productId, amount, quantity, quoteUnitPrice, reservStart, reservLength, reservPersons,null,null, null, null, null, configWrapper, null, dispatcher, new Boolean(!applyQuoteAdjustments), new Boolean(quoteUnitPrice.compareTo(BigDecimal.ZERO) == 0), Boolean.FALSE, Boolean.FALSE);
-
+
                     } catch (ItemNotFoundException e) {
                         Debug.logError(e, module);
                         return ServiceUtil.returnError(e.getMessage());
@@ -918,7 +918,7 @@
         result.put("shoppingCart", cart);
         return result;
     }
-
+
     public static Map<String, Object>getShoppingCartData(DispatchContext dctx, Map<String, Object> context) {
         Map<String, Object> result = ServiceUtil.returnSuccess();
         Locale locale = (Locale) context.get("locale");
@@ -950,7 +950,7 @@
         }
         return result;
     }
-
+
     public static Map<String, Object>getShoppingCartItemIndex(DispatchContext dctx, Map<String, Object> context) {
         Map<String, Object> result = ServiceUtil.returnSuccess();
         ShoppingCart shoppingCart = (ShoppingCart) context.get("shoppingCart");
@@ -966,7 +966,7 @@
         }
         return result;
     }
-
+
     public static Map<String, Object>resetShipGroupItems(DispatchContext dctx, Map<String, Object> context) {
         Map<String, Object> result = ServiceUtil.returnSuccess();
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
@@ -978,7 +978,7 @@
         }
         return result;
     }
-
+
     public static Map<String, Object>prepareVendorShipGroups(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
@@ -1008,7 +1008,7 @@
             } catch (GenericEntityException e) {
                 Debug.logError(e.toString(), module);
             }
-
+
             if (UtilValidate.isEmpty(vendorProduct)) {
                 if (vendorMap.containsKey("_NA_")) {
                     index = ((Integer) vendorMap.get("_NA_")).intValue();
@@ -1016,7 +1016,7 @@
                 } else {
                     index = cart.addShipInfo();
                     vendorMap.put("_NA_", index);
-
+
                     ShoppingCart.CartShipInfo info = cart.getShipInfo(index);
                     info.setVendorPartyId("_NA_");
                     info.setShipGroupSeqId(UtilFormatOut.formatPaddedNumber(index, 5));
@@ -1031,7 +1031,7 @@
                 } else {
                     index = cart.addShipInfo();
                     vendorMap.put(vendorPartyId, index);
-
+
                     ShoppingCart.CartShipInfo info = cart.getShipInfo(index);
                     info.setVendorPartyId(vendorPartyId);
                     info.setShipGroupSeqId(UtilFormatOut.formatPaddedNumber(index, 5));

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/WebShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/WebShoppingCart.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/WebShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/WebShoppingCart.java Fri Mar 27 17:01:06 2009
@@ -56,7 +56,7 @@
     public WebShoppingCart(HttpServletRequest request) {
         this(request, UtilHttp.getLocale(request), UtilHttp.getCurrencyUom(request));
     }
-
+
     /** Creates a new cloned ShoppingCart Object. */
     public WebShoppingCart(ShoppingCart cart) {
         super(cart);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java?rev=759251&r1=759250&r2=759251&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java Fri Mar 27 17:01:06 2009
@@ -47,13 +47,13 @@
 
 
 public class ProductDisplayWorker {
-
+
     public static final String module = ProductDisplayWorker.class.getName();
 
     /* ========================================================================================*/
-
+
     /* ============================= Special Data Retreival Methods ===========================*/
-
+
     public static List getRandomCartProductAssoc(ServletRequest request, boolean checkViewAllow) {
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         HttpServletRequest httpRequest = (HttpServletRequest) request;
@@ -73,7 +73,7 @@
                 List complementProducts = delegator.findByAndCache("ProductAssoc", UtilMisc.toMap("productId", item.getProductId(), "productAssocTypeId", "PRODUCT_COMPLEMENT"), null);
                 // since ProductAssoc records have a fromDate and thruDate, we can filter by now so that only assocs in the date range are included
                 complementProducts = EntityUtil.filterByDate(complementProducts);
-
+
                 List productsCategories = delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productId", item.getProductId()), null);
                 productsCategories = EntityUtil.filterByDate(productsCategories, true);
                 if (productsCategories != null) {
@@ -126,7 +126,7 @@
                     cartAssocs = new ArrayList(tempList);
                 }
             }
-
+
             if (cartAssocs == null) {
                 cartAssocs = new ArrayList(products.values());
             }
@@ -139,14 +139,14 @@
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
         }
-
+
         if (UtilValidate.isNotEmpty(cartAssocs)) {
             return cartAssocs;
         } else {
             return null;
         }
     }
-
+
     public static Map getQuickReorderProducts(ServletRequest request) {
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         HttpServletRequest httpRequest = (HttpServletRequest) request;
@@ -262,7 +262,7 @@
                     }
                 }
             //}
-
+
             List reorderProds = new ArrayList(products.values());
 
             /*
@@ -300,10 +300,10 @@
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
         }
-
+
         return results;
     }
-
+
     public static List productOrderByMap(Collection values, Map orderByMap, boolean descending) {
         if (values == null)  return null;
         if (values.size() == 0) return UtilMisc.toList(values);