Author: jleroux
Date: Tue Jan 25 13:35:19 2011
New Revision: 1063273
URL: http://svn.apache.org/viewvc?rev=1063273&view=rev
Log:
A patch from Leon "Shopping Cart Item, treat items contains same product but
with or without comment as same shopping cart item"
(https://issues.apache.org/jira/browse/OFBIZ-4134) - OFBIZ-4134
In "add order item" page, you select a product and leave other field empty,
submit. Then you select same product but input some comment, after submit, you
can only get one item in shopping cart item list with its order quantity
increased but the comment
written in second time is discard.
The reason for this issue is because ShoppingCartItem.equals method return true
if the attribute of either cart item or new item is empty.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
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=1063273&r1=1063272&r2=1063273&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
Tue Jan 25 13:35:19 2011
@@ -2378,15 +2378,16 @@ public class ShoppingCartItem implements
return false;
}
- if ((UtilValidate.isNotEmpty(this.additionalProductFeatureAndAppls) &&
UtilValidate.isNotEmpty(additionalProductFeatureAndAppls)) &&
- (this.additionalProductFeatureAndAppls.size() !=
additionalProductFeatureAndAppls.size()) &&
-
!(this.additionalProductFeatureAndAppls.equals(additionalProductFeatureAndAppls)))
{
+ if ((this.additionalProductFeatureAndAppls == null &&
UtilValidate.isNotEmpty(additionalProductFeatureAndAppls)) ||
+
(UtilValidate.isNotEmpty(this.additionalProductFeatureAndAppls) &&
additionalProductFeatureAndAppls == null) ||
+ (this.additionalProductFeatureAndAppls != null &&
additionalProductFeatureAndAppls != null &&
+ (this.additionalProductFeatureAndAppls.size() !=
additionalProductFeatureAndAppls.size() ||
+
!(this.additionalProductFeatureAndAppls.equals(additionalProductFeatureAndAppls)))))
{
return false;
}
- if ((UtilValidate.isNotEmpty(this.attributes) &&
UtilValidate.isNotEmpty(attributes)) &&
- ((this.attributes.size() != attributes.size()) ||
- !(this.attributes.equals(attributes)))) {
+ if ((this.attributes == null && UtilValidate.isNotEmpty(attributes))
|| (UtilValidate.isNotEmpty(this.attributes) && attributes == null) ||
+ (this.attributes != null && attributes != null &&
(this.attributes.size() != attributes.size() ||
!(this.attributes.equals(attributes))))) {
return false;
}