You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2010/05/11 19:11:37 UTC

svn commit: r943182 - in /ofbiz/branches/release10.04: ./ applications/order/src/org/ofbiz/order/order/OrderReadHelper.java applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Author: doogie
Date: Tue May 11 17:11:37 2010
New Revision: 943182

URL: http://svn.apache.org/viewvc?rev=943182&view=rev
Log:
Applied fix from trunk for revision: 941109 
 Add reading of promo use and promo code from the database into the

Modified:
    ofbiz/branches/release10.04/   (props changed)
    ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 11 17:11:37 2010
@@ -1,3 +1,3 @@
 /ofbiz/branches/addbirt:831210-885099,885686-886087
 /ofbiz/branches/multitenant20100310:921280-927264
-/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168
+/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168

Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=943182&r1=943181&r2=943182&view=diff
==============================================================================
--- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Tue May 11 17:11:37 2010
@@ -2198,6 +2198,29 @@ public class OrderReadHelper {
         return EntityUtil.filterByCondition(getOrderItems(), entityCondition);
     }
 
+    public Set<String> getProductPromoCodesEntered() {
+        Delegator delegator = orderHeader.getDelegator();
+        Set<String> productPromoCodesEntered = FastSet.newInstance();
+        try {
+            for (GenericValue orderProductPromoCode: delegator.findByAndCache("OrderProductPromoCode", UtilMisc.toMap("orderId", orderHeader.get("orderId")))) {
+                productPromoCodesEntered.add(orderProductPromoCode.getString("productPromoCodeId"));
+            }
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+        }
+        return productPromoCodesEntered;
+    }
+
+    public List<GenericValue> getProductPromoUse() {
+        Delegator delegator = orderHeader.getDelegator();
+        try {
+            return delegator.findByAndCache("ProductPromoUse", UtilMisc.toMap("orderId", orderHeader.get("orderId")));
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+        }
+        return FastList.newInstance();
+    }
+
     /**
      * Checks to see if this user has read permission on this order
      * @param userLogin The UserLogin value object to check

Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=943182&r1=943181&r2=943182&view=diff
==============================================================================
--- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Tue May 11 17:11:37 2010
@@ -581,6 +581,15 @@ public class ShoppingCartServices {
             }
         }
 
+        if (includePromoItems) {
+            for (String productPromoCode: orh.getProductPromoCodesEntered()) {
+                cart.addProductPromoCode(productPromoCode, dispatcher);
+            }
+            for (GenericValue productPromoUse: orh.getProductPromoUse()) {
+                cart.addProductPromoUse(productPromoUse.getString("productPromoId"), productPromoUse.getString("productPromoCodeId"), productPromoUse.getBigDecimal("totalDiscountAmount"), productPromoUse.getBigDecimal("quantityLeftInActions"));
+            }
+        }
+
         List adjustments = orh.getOrderHeaderAdjustments();
         // If applyQuoteAdjustments is set to false then standard cart adjustments are used.
         if (!adjustments.isEmpty()) {



Re: svn commit: r943182 - in /ofbiz/branches/release10.04: ./ applications/order/src/org/ofbiz/order/order/OrderReadHelper.java applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
On May 11, 2010, at 7:13 PM, Adam Heath wrote:

> This may look like a new feature being added to this branch.  However,
> the feature was actually added before the branch was made, but didn't
> work in all cases.  This is why I applied this change from trunk.
> 

This looks more an enhancement of an existing feature rather than a bug fix... I don't care much and I don't want to be peaky and start a discussion on this.
By the way I am mentioning this because I have noticed a few other recent commits from you to the release branches  that it will be rather difficult to categorize as bug fixes.

Jacopo

Re: svn commit: r943182 - in /ofbiz/branches/release10.04: ./ applications/order/src/org/ofbiz/order/order/OrderReadHelper.java applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Posted by Adam Heath <do...@brainfood.com>.
Tim Ruppert wrote:
> Sounds like a bug fix to me!

Of course; it just might not have been clear by looking at just the
commit itself.  Just wanted to clarify that.

Re: svn commit: r943182 - in /ofbiz/branches/release10.04: ./ applications/order/src/org/ofbiz/order/order/OrderReadHelper.java applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
Sounds like a bug fix to me!

Cheers,
Ruppert

On May 11, 2010, at 11:13 AM, Adam Heath wrote:

> doogie@apache.org wrote:
>> Author: doogie
>> Date: Tue May 11 17:11:37 2010
>> New Revision: 943182
>> 
>> URL: http://svn.apache.org/viewvc?rev=943182&view=rev
>> Log:
>> Applied fix from trunk for revision: 941109 
>> Add reading of promo use and promo code from the database into the
> 
> This may look like a new feature being added to this branch.  However,
> the feature was actually added before the branch was made, but didn't
> work in all cases.  This is why I applied this change from trunk.
> 
> 
>> 
>> Modified:
>>    ofbiz/branches/release10.04/   (props changed)
>>    ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>>    ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
>> 
>> Propchange: ofbiz/branches/release10.04/
>> ------------------------------------------------------------------------------
>> --- svn:mergeinfo (original)
>> +++ svn:mergeinfo Tue May 11 17:11:37 2010
>> @@ -1,3 +1,3 @@
>> /ofbiz/branches/addbirt:831210-885099,885686-886087
>> /ofbiz/branches/multitenant20100310:921280-927264
>> -/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168
>> +/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168
>> 
>> Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=943182&r1=943181&r2=943182&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
>> +++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Tue May 11 17:11:37 2010
>> @@ -2198,6 +2198,29 @@ public class OrderReadHelper {
>>         return EntityUtil.filterByCondition(getOrderItems(), entityCondition);
>>     }
>> 
>> +    public Set<String> getProductPromoCodesEntered() {
>> +        Delegator delegator = orderHeader.getDelegator();
>> +        Set<String> productPromoCodesEntered = FastSet.newInstance();
>> +        try {
>> +            for (GenericValue orderProductPromoCode: delegator.findByAndCache("OrderProductPromoCode", UtilMisc.toMap("orderId", orderHeader.get("orderId")))) {
>> +                productPromoCodesEntered.add(orderProductPromoCode.getString("productPromoCodeId"));
>> +            }
>> +        } catch (GenericEntityException e) {
>> +            Debug.logError(e, module);
>> +        }
>> +        return productPromoCodesEntered;
>> +    }
>> +
>> +    public List<GenericValue> getProductPromoUse() {
>> +        Delegator delegator = orderHeader.getDelegator();
>> +        try {
>> +            return delegator.findByAndCache("ProductPromoUse", UtilMisc.toMap("orderId", orderHeader.get("orderId")));
>> +        } catch (GenericEntityException e) {
>> +            Debug.logError(e, module);
>> +        }
>> +        return FastList.newInstance();
>> +    }
>> +
>>     /**
>>      * Checks to see if this user has read permission on this order
>>      * @param userLogin The UserLogin value object to check
>> 
>> Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=943182&r1=943181&r2=943182&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
>> +++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Tue May 11 17:11:37 2010
>> @@ -581,6 +581,15 @@ public class ShoppingCartServices {
>>             }
>>         }
>> 
>> +        if (includePromoItems) {
>> +            for (String productPromoCode: orh.getProductPromoCodesEntered()) {
>> +                cart.addProductPromoCode(productPromoCode, dispatcher);
>> +            }
>> +            for (GenericValue productPromoUse: orh.getProductPromoUse()) {
>> +                cart.addProductPromoUse(productPromoUse.getString("productPromoId"), productPromoUse.getString("productPromoCodeId"), productPromoUse.getBigDecimal("totalDiscountAmount"), productPromoUse.getBigDecimal("quantityLeftInActions"));
>> +            }
>> +        }
>> +
>>         List adjustments = orh.getOrderHeaderAdjustments();
>>         // If applyQuoteAdjustments is set to false then standard cart adjustments are used.
>>         if (!adjustments.isEmpty()) {
>> 
>> 
> 


Re: svn commit: r943182 - in /ofbiz/branches/release10.04: ./ applications/order/src/org/ofbiz/order/order/OrderReadHelper.java applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Posted by Adam Heath <do...@brainfood.com>.
doogie@apache.org wrote:
> Author: doogie
> Date: Tue May 11 17:11:37 2010
> New Revision: 943182
> 
> URL: http://svn.apache.org/viewvc?rev=943182&view=rev
> Log:
> Applied fix from trunk for revision: 941109 
>  Add reading of promo use and promo code from the database into the

This may look like a new feature being added to this branch.  However,
the feature was actually added before the branch was made, but didn't
work in all cases.  This is why I applied this change from trunk.


> 
> Modified:
>     ofbiz/branches/release10.04/   (props changed)
>     ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>     ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
> 
> Propchange: ofbiz/branches/release10.04/
> ------------------------------------------------------------------------------
> --- svn:mergeinfo (original)
> +++ svn:mergeinfo Tue May 11 17:11:37 2010
> @@ -1,3 +1,3 @@
>  /ofbiz/branches/addbirt:831210-885099,885686-886087
>  /ofbiz/branches/multitenant20100310:921280-927264
> -/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168
> +/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168
> 
> Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=943182&r1=943181&r2=943182&view=diff
> ==============================================================================
> --- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
> +++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Tue May 11 17:11:37 2010
> @@ -2198,6 +2198,29 @@ public class OrderReadHelper {
>          return EntityUtil.filterByCondition(getOrderItems(), entityCondition);
>      }
>  
> +    public Set<String> getProductPromoCodesEntered() {
> +        Delegator delegator = orderHeader.getDelegator();
> +        Set<String> productPromoCodesEntered = FastSet.newInstance();
> +        try {
> +            for (GenericValue orderProductPromoCode: delegator.findByAndCache("OrderProductPromoCode", UtilMisc.toMap("orderId", orderHeader.get("orderId")))) {
> +                productPromoCodesEntered.add(orderProductPromoCode.getString("productPromoCodeId"));
> +            }
> +        } catch (GenericEntityException e) {
> +            Debug.logError(e, module);
> +        }
> +        return productPromoCodesEntered;
> +    }
> +
> +    public List<GenericValue> getProductPromoUse() {
> +        Delegator delegator = orderHeader.getDelegator();
> +        try {
> +            return delegator.findByAndCache("ProductPromoUse", UtilMisc.toMap("orderId", orderHeader.get("orderId")));
> +        } catch (GenericEntityException e) {
> +            Debug.logError(e, module);
> +        }
> +        return FastList.newInstance();
> +    }
> +
>      /**
>       * Checks to see if this user has read permission on this order
>       * @param userLogin The UserLogin value object to check
> 
> Modified: ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=943182&r1=943181&r2=943182&view=diff
> ==============================================================================
> --- ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
> +++ ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Tue May 11 17:11:37 2010
> @@ -581,6 +581,15 @@ public class ShoppingCartServices {
>              }
>          }
>  
> +        if (includePromoItems) {
> +            for (String productPromoCode: orh.getProductPromoCodesEntered()) {
> +                cart.addProductPromoCode(productPromoCode, dispatcher);
> +            }
> +            for (GenericValue productPromoUse: orh.getProductPromoUse()) {
> +                cart.addProductPromoUse(productPromoUse.getString("productPromoId"), productPromoUse.getString("productPromoCodeId"), productPromoUse.getBigDecimal("totalDiscountAmount"), productPromoUse.getBigDecimal("quantityLeftInActions"));
> +            }
> +        }
> +
>          List adjustments = orh.getOrderHeaderAdjustments();
>          // If applyQuoteAdjustments is set to false then standard cart adjustments are used.
>          if (!adjustments.isEmpty()) {
> 
>