Author: hansbak
Date: Wed Jan 25 09:01:53 2012 New Revision: 1235698 URL: http://svn.apache.org/viewvc?rev=1235698&view=rev Log: changes for configurable service product: 1. Display the configuration button on a product on the catalog manager. 2. Check the config if the product is the configurable product service then create new product from config(Do the same step as the configurable product). Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl ofbiz/trunk/applications/product/data/ProductTypeData.xml ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml Wed Jan 25 09:01:53 2012 @@ -351,7 +351,10 @@ under the License. <if> <condition> <and> - <if-compare operator="equals" value="AGGREGATED" field="product.productTypeId"></if-compare> + <or> + <if-compare operator="equals" value="AGGREGATED" field="product.productTypeId"/> + <if-compare operator="equals" value="AGGREGATED_SERVICE" field="product.productTypeId"/> + </or> <not><if-empty field="parameters.configId"></if-empty></not> </and> </condition> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Wed Jan 25 09:01:53 2012 @@ -48,6 +48,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityFunction; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.finaccount.FinAccountHelper; import org.ofbiz.order.order.OrderChangeHelper; @@ -644,7 +645,7 @@ public class CheckOutHelper { GenericValue permUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "system")); GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); - if ("AGGREGATED_CONF".equals(product.getString("productTypeId")) || "AGGREGATEDSERV_CONF".equals(product.getString("productTypeId"))) { + if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { org.ofbiz.product.config.ProductConfigWrapper config = this.cart.findCartItem(counter).getConfigWrapper(); Map<String, Object> inputMap = new HashMap<String, Object>(); inputMap.put("config", config); 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=1235698&r1=1235697&r2=1235698&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 Wed Jan 25 09:01:53 2012 @@ -45,6 +45,7 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.order.shoppingcart.product.ProductPromoWorker; @@ -327,7 +328,7 @@ public class ShoppingCartHelper { BigDecimal amount = orderItem.getBigDecimal("selectedAmount"); ProductConfigWrapper configWrapper = null; String aggregatedProdId = null; - if ("AGGREGATED_CONF".equals(ProductWorker.getProductTypeId(delegator, productId))) { + if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", ProductWorker.getProductTypeId(delegator, productId), "parentTypeId", "AGGREGATED")) { try { GenericValue instanceProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); String configId = instanceProduct.getString("configId"); 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=1235698&r1=1235697&r2=1235698&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 Wed Jan 25 09:01:53 2012 @@ -214,7 +214,7 @@ public class ShoppingCartItem implements // Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); // check to see if the product is fully configured - if ("AGGREGATED".equals(product.getString("productTypeId"))) { + if ("AGGREGATED".equals(product.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(product.getString("productTypeId"))) { if (configWrapper == null || !configWrapper.isCompleted()) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId")); @@ -484,7 +484,7 @@ public class ShoppingCartItem implements */ // check to see if the product is fully configured - if ("AGGREGATED".equals(product.getString("productTypeId"))) { + if ("AGGREGATED".equals(product.getString("productTypeId"))|| "AGGREGATED_SERVICE".equals(product.getString("productTypeId"))) { if (configWrapper == null || !configWrapper.isCompleted()) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId")); 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=1235698&r1=1235697&r2=1235698&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 Wed Jan 25 09:01:53 2012 @@ -43,6 +43,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.order.shoppingcart.ShoppingCart.CartShipInfo; @@ -449,7 +450,7 @@ public class ShoppingCartServices { String configId = null; try { product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); - if ("AGGREGATED_CONF".equals(product.getString("productTypeId"))) { + if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { List<GenericValue>productAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF", "productIdTo", product.getString("productId"))); productAssocs = EntityUtil.filterByDate(productAssocs); if (UtilValidate.isNotEmpty(productAssocs)) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Wed Jan 25 09:01:53 2012 @@ -42,6 +42,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.order.shoppingcart.CartItemModifyException; @@ -333,7 +334,7 @@ public class ShoppingListServices { if (UtilValidate.isNotEmpty(productId)) { Map<String, Object> ctx = UtilMisc.<String, Object>toMap("userLogin", userLogin, "shoppingListId", shoppingListId, "productId", orderItem.get("productId"), "quantity", orderItem.get("quantity")); - if ("AGGREGATED_CONF".equals(ProductWorker.getProductTypeId(delegator, productId))) { + if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", ProductWorker.getProductTypeId(delegator, productId), "parentTypeId", "AGGREGATED")) { try { GenericValue instanceProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId)); String configId = instanceProduct.getString("configId"); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/LookupBulkAddProducts.groovy Wed Jan 25 09:01:53 2012 @@ -38,6 +38,7 @@ if (productId) { // do not include configurable products conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); +conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED_SERVICE")); // no virtual products: note that isVirtual could be null, // we consider those products to be non-virtual and hence addable to the order in bulk Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy Wed Jan 25 09:01:53 2012 @@ -117,7 +117,7 @@ if (product) { } // get aggregated product totalPrice - if ("AGGREGATED".equals(product.productTypeId)) { + if ("AGGREGATED".equals(product.productTypeId)||"AGGREGATED_SERVICE".equals(product.productTypeId)) { configWrapper = ProductConfigWorker.getProductConfigWrapper(productId, cart.getCurrency(), request); if (configWrapper) { configWrapper.setDefaultConfig(); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/compareproducts.ftl Wed Jan 25 09:01:53 2012 @@ -59,7 +59,7 @@ under the License. <#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderRent}...</a> <#-- check to see if it is an aggregated or configurable product; will enter parameters on the detail screen--> - <#elseif product.productTypeId?if_exists == "AGGREGATED"/> + <#elseif product.productTypeId?if_exists == "AGGREGATED" || product.productTypeId?if_exists == "AGGREGATED_SERVICE"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderConfigure}...</a> <#-- check to see if the product is a virtual product --> <#elseif product.isVirtual?exists && product.isVirtual == "Y"/> @@ -163,7 +163,7 @@ under the License. <#elseif product.productTypeId?if_exists == "ASSET_USAGE_OUT_IN"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderRent}...</a> <#-- check to see if it is an aggregated or configurable product; will enter parameters on the detail screen--> - <#elseif product.productTypeId?if_exists == "AGGREGATED"/> + <#elseif product.productTypeId?if_exists == "AGGREGATED" || product.productTypeId?if_exists == "AGGREGATED_SERVICE"/> <a href="javascript:doGetViaParent('${productUrl}');" class="buttontext">${uiLabelMap.OrderConfigure}...</a> <#-- check to see if the product is a virtual product --> <#elseif product.isVirtual?exists && product.isVirtual == "Y"/> Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Wed Jan 25 09:01:53 2012 @@ -502,7 +502,7 @@ under the License. <ProductType description="Fixed Asset Usage For Rental of an asset which is shipped from and returned to inventory" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="ASSET_USAGE_OUT_IN"/> <ProductType description="Service a product using inventory" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="" productTypeId="SERVICE_PRODUCT"/> <ProductType description="Configurable Service using inventory" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="SERVICE_PRODUCT" productTypeId="AGGREGATED_SERVICE"/> - <ProductType description="Configurable Service Configuration" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="AGGREGATED_SERVICE" productTypeId="AGGREGATEDSERV_CONF"/> + <ProductType description="Configurable Service Configuration" isPhysical="Y" isDigital="N" hasTable="N" parentTypeId="AGGREGATED" productTypeId="AGGREGATEDSERV_CONF"/> <EnumerationType description="Product Requirement Method" enumTypeId="PROD_REQ_METHOD" hasTable="N" parentTypeId=""/> <!-- NONE: no requirement is created (default) --> 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?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java Wed Jan 25 09:01:53 2012 @@ -41,6 +41,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.product.config.ProductConfigWrapper; import org.ofbiz.product.config.ProductConfigWrapper.ConfigOption; @@ -146,7 +147,7 @@ public class ProductWorker { public static String getInstanceAggregatedId(Delegator delegator, String instanceProductId) throws GenericEntityException { GenericValue instanceProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", instanceProductId)); - if (UtilValidate.isNotEmpty(instanceProduct) && ("AGGREGATED_CONF".equals(instanceProduct.getString("productTypeId")) || "AGGREGATEDSERV_CONF".equals(instanceProduct.getString("productTypeId")))) { + if (UtilValidate.isNotEmpty(instanceProduct) && EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelatedByAnd("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF")))); if (UtilValidate.isNotEmpty(productAssoc)) { Modified: ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/CatalogMenus.xml Wed Jan 25 09:01:53 2012 @@ -462,7 +462,10 @@ under the License. </menu-item> <menu-item name="EditProductConfigs" title="${uiLabelMap.ProductConfigs}"> <condition> - <if-compare field="product.productTypeId" operator="equals" value="AGGREGATED"/> + <or> + <if-compare field="product.productTypeId" operator="equals" value="AGGREGATED"/> + <if-compare field="product.productTypeId" operator="equals" value="AGGREGATED_SERVICE"/> + </or> </condition> <link target="EditProductConfigs"> <parameter param-name="productId"/> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy Wed Jan 25 09:01:53 2012 @@ -62,7 +62,7 @@ if (miniProduct && productStoreId && pro } // get aggregated product totalPrice - if ("AGGREGATED".equals(miniProduct.productTypeId)) { + if ("AGGREGATED".equals(miniProduct.productTypeId) || "AGGREGATED_SERVICE".equals(miniProduct.productTypeId)) { configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request); if (configWrapper) { configWrapper.setDefaultConfig(); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=1235698&r1=1235697&r2=1235698&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Wed Jan 25 09:01:53 2012 @@ -435,7 +435,7 @@ public class PosTransaction implements S Delegator delegator = cart.getDelegator(); GenericValue product = null; product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId)); - if (UtilValidate.isNotEmpty(product) && "AGGREGATED".equals(product.getString("productTypeId"))) { + if (UtilValidate.isNotEmpty(product) && ("AGGREGATED".equals(product.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(product.getString("productTypeId")))) { return true; } } catch (GenericEntityException e) { @@ -494,7 +494,7 @@ public class PosTransaction implements S GenericValue product = null; ProductConfigWrapper pcw = null; product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId)); - if (UtilValidate.isNotEmpty(product) && "AGGREGATED".equals(product.getString("productTypeId"))) { + if (UtilValidate.isNotEmpty(product) && ("AGGREGATED".equals(product.getString("productTypeId"))||"AGGREGATED_SERVICE".equals(product.getString("productTypeId")))) { // if it's an aggregated item, load the configwrapper and set to defaults pcw = new ProductConfigWrapper(delegator, session.getDispatcher(), productId, null, null, null, null, null, null); pcw.setDefaultConfig(); |
Free forum by Nabble | Edit this page |