Author: jonesde
Date: Sat Jan 17 23:44:05 2009
New Revision: 735396
URL:
http://svn.apache.org/viewvc?rev=735396&view=revLog:
Changed to honor the WebSite.allowProductStoreChange field again
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java
ofbiz/trunk/applications/product/entitydef/entitymodel.xml
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java?rev=735396&r1=735395&r2=735396&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java Sat Jan 17 23:44:05 2009
@@ -32,6 +32,7 @@
import org.ofbiz.order.shoppingcart.ShoppingCartEvents;
import org.ofbiz.order.shoppingcart.WebShoppingCart;
import org.ofbiz.product.store.ProductStoreWorker;
+import org.ofbiz.webapp.website.WebSiteWorker;
/**
* ProductStoreWorker - Worker class for store related functionality
@@ -77,6 +78,16 @@
throw new IllegalArgumentException("Cannot set session ProductStore, passed productStoreId [" + productStoreId + "] is not valid/not found.");
}
+ // make sure ProductStore change is allowed for the WebSite
+ GenericValue webSite = WebSiteWorker.getWebSite(request);
+ if (productStore == null) {
+ throw new IllegalArgumentException("Cannot set session ProductStore, could not find WebSite record based on web.xml setting.");
+ }
+ String allowProductStoreChange = webSite.getString("allowProductStoreChange");
+ if (!"Y".equals(allowProductStoreChange)) {
+ throw new IllegalArgumentException("Cannot set session ProductStore, changing ProductStore not allowed for WebSite [" + webSite.getString("webSite") + "].");
+ }
+
// set the productStoreId in the session (we know is different by this point)
session.setAttribute("productStoreId", productStoreId);
Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=735396&r1=735395&r2=735396&view=diff==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Sat Jan 17 23:44:05 2009
@@ -4056,7 +4056,7 @@
</entity>
<extend-entity entity-name="WebSite">
<field name="productStoreId" type="id"></field>
- <field name="allowProductStoreChange" type="indicator"></field>
+ <field name="allowProductStoreChange" type="indicator"><description>Allow change of ProductStore for this WebSite (webapp). Defaults to N (no).</description></field>
<relation type="one" fk-name="WEB_SITE_PRDS" rel-entity-name="ProductStore">
<key-map field-name="productStoreId"/>
</relation>