You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/04/27 10:32:51 UTC
svn commit: r533014 - in /ofbiz/trunk/applications/product:
data/ProductTypeData.xml src/org/ofbiz/product/product/ProductWorker.java
Author: jacopoc
Date: Fri Apr 27 01:32:49 2007
New Revision: 533014
URL: http://svn.apache.org/viewvc?view=rev&rev=533014
Log:
Expanded seed data (ProductGeo) and ProductWorker method to determine if a product can be sold or can be shipped to a given address.
Modified:
ofbiz/trunk/applications/product/data/ProductTypeData.xml
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?view=diff&rev=533014&r1=533013&r2=533014
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Fri Apr 27 01:32:49 2007
@@ -185,6 +185,8 @@
<EnumerationType description="Product Geo Data" enumTypeId="PROD_GEO" hasTable="N" parentTypeId=""/>
<Enumeration description="Purchase Include Geo" enumCode="PURCHASE_INCLUDE" enumId="PG_PURCH_INCLUDE" sequenceId="01" enumTypeId="PROD_GEO"/>
<Enumeration description="Purchase Exclude Geo" enumCode="PURCHASE_EXCLUDE" enumId="PG_PURCH_EXCLUDE" sequenceId="02" enumTypeId="PROD_GEO"/>
+ <Enumeration description="Shipment Include Geo" enumCode="SHIPMENT_INCLUDE" enumId="PG_SHIP_INCLUDE" sequenceId="03" enumTypeId="PROD_GEO"/>
+ <Enumeration description="Shipment Exclude Geo" enumCode="SHIPMENT_EXCLUDE" enumId="PG_SHIP_EXCLUDE" sequenceId="04" enumTypeId="PROD_GEO"/>
<ProductCategoryContentType description="Category Name" hasTable="N" parentTypeId="" prodCatContentTypeId="CATEGORY_NAME"/>
<ProductCategoryContentType description="Description" hasTable="N" parentTypeId="" prodCatContentTypeId="DESCRIPTION"/>
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?view=diff&rev=533014&r1=533013&r2=533014
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Fri Apr 27 01:32:49 2007
@@ -78,7 +78,13 @@
}
}
+ public static boolean isBillableToAddress(GenericValue product, GenericValue postalAddress) {
+ return isAllowedToAddress(product, postalAddress, "PG_PURCH_");
+ }
public static boolean isShippableToAddress(GenericValue product, GenericValue postalAddress) {
+ return isAllowedToAddress(product, postalAddress, "PG_SHIP_");
+ }
+ private static boolean isAllowedToAddress(GenericValue product, GenericValue postalAddress, String productGeoPrefix) {
if (UtilValidate.isNotEmpty(product) && UtilValidate.isNotEmpty(postalAddress)) {
GenericDelegator delegator = product.getDelegator();
List productGeos = null;
@@ -91,8 +97,8 @@
// If no GEOs are configured the default is TRUE
return true;
}
- List excludeGeos = EntityUtil.filterByAnd(productGeos, UtilMisc.toMap("productGeoEnumId", "PG_PURCH_EXCLUDE"));
- List includeGeos = EntityUtil.filterByAnd(productGeos, UtilMisc.toMap("productGeoEnumId", "PG_PURCH_INCLUDE"));
+ List excludeGeos = EntityUtil.filterByAnd(productGeos, UtilMisc.toMap("productGeoEnumId", productGeoPrefix + "EXCLUDE"));
+ List includeGeos = EntityUtil.filterByAnd(productGeos, UtilMisc.toMap("productGeoEnumId", productGeoPrefix + "INCLUDE"));
Iterator productGeosIt = null;
// exclusion
productGeosIt = excludeGeos.iterator();