Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/feedback/FeedbackList.groovy Wed Nov 2 19:09:13 2016 @@ -17,64 +17,64 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; -import java.sql.Timestamp; +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import java.sql.Timestamp partyId = null -resultUser = runService('getEbayStoreUser', ["productStoreId": parameters.productStoreId, "userLogin": context.get("userLogin")]); -ownerUser = resultUser.get("userLoginId"); -userLogin = from("UserLogin").where("userLoginId", ownerUser).queryOne(); +resultUser = runService('getEbayStoreUser', ["productStoreId": parameters.productStoreId, "userLogin": context.get("userLogin")]) +ownerUser = resultUser.get("userLoginId") +userLogin = from("UserLogin").where("userLoginId", ownerUser).queryOne() if (userLogin) { - partyId = userLogin.get("partyId"); + partyId = userLogin.get("partyId") } -expr = []; -cond = null; +expr = [] +cond = null -contentId = request.getParameter("contentId"); -fromDate = request.getParameter("fromDate"); -thruDate = request.getParameter("thruDate"); +contentId = request.getParameter("contentId") +fromDate = request.getParameter("fromDate") +thruDate = request.getParameter("thruDate") if (contentId) { - expr.add(EntityCondition.makeCondition("contentId",EntityOperator.EQUALS, contentId)); + expr.add(EntityCondition.makeCondition("contentId",EntityOperator.EQUALS, contentId)) } if (fromDate && thruDate) { - exprSub = []; - condSub = null; - exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))); - exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))); - condSub = EntityCondition.makeCondition(exprSub, EntityOperator.AND); - expr.add(condSub); + exprSub = [] + condSub = null + exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))) + exprSub.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))) + condSub = EntityCondition.makeCondition(exprSub, EntityOperator.AND) + expr.add(condSub) } else if (fromDate && !thruDate) { - expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))); + expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.GREATER_THAN, UtilDateTime.getDayStart(Timestamp.valueOf(fromDate + " 00:00:00.000")))) } else if (!fromDate && thruDate) { - expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))); + expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999")))) } -contentRoles = from("ContentRole").where("roleTypeId","OWNER", "partyId", partyId).queryList(); -contentIds = []; +contentRoles = from("ContentRole").where("roleTypeId","OWNER", "partyId", partyId).queryList() +contentIds = [] contentRoles.each{ content -> - contentIds.add(content.getString("contentId")); + contentIds.add(content.getString("contentId")) } -expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds)); -contents = from("Content").where(expr).queryList(); +expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds)) +contents = from("Content").where(expr).queryList() -recentFeedbackList = []; -ownerUser = null; -commentator = null; +recentFeedbackList = [] +ownerUser = null +commentator = null contents.each{ content -> - commentatorContents = from("ContentRole").where("contentId",content.contentId, "roleTypeId","COMMENTATOR").queryList(); + commentatorContents = from("ContentRole").where("contentId",content.contentId, "roleTypeId","COMMENTATOR").queryList() if(commentatorContents){ - commentatorPartyId = commentatorContents.get(0).get("partyId"); - commentatorUsers = from("UserLogin").where("partyId", commentatorPartyId).queryList(); + commentatorPartyId = commentatorContents.get(0).get("partyId") + commentatorUsers = from("UserLogin").where("partyId", commentatorPartyId).queryList() if(commentatorUsers){ - commentator = commentatorUsers.get(0).get("userLoginId"); + commentator = commentatorUsers.get(0).get("userLoginId") } } entry = [contentId : content.contentId, dataResourceId : content.dataResourceId, createdDate : content.createdDate, ownerUser : ownerUser, - commentator : commentator]; - recentFeedbackList.add(entry); + commentator : commentator] + recentFeedbackList.add(entry) } -context.recentFeedbackList = recentFeedbackList; +context.recentFeedbackList = recentFeedbackList Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/CheckOrderStatus.groovy Wed Nov 2 19:09:13 2016 @@ -16,14 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.util.EntityUtil -context.importStatus = "NOT_IMPORT"; -orderHeaders = from("OrderHeader").where("externalId", externalId).queryList(); +context.importStatus = "NOT_IMPORT" +orderHeaders = from("OrderHeader").where("externalId", externalId).queryList() if (orderHeaders.size() > 0) { - orderHeader = EntityUtil.getFirst(orderHeaders); - context.orderId = orderHeader.get("orderId"); + orderHeader = EntityUtil.getFirst(orderHeaders) + context.orderId = orderHeader.get("orderId") if ("ORDER_APPROVED".equals(orderHeader.get("statusId").toString())) { - context.importStatus = "IMPORTED"; + context.importStatus = "IMPORTED" } } Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListParameters.groovy Wed Nov 2 19:09:13 2016 @@ -17,9 +17,9 @@ * under the License. */ - session.setAttribute("shippingAddressCtx", shippingAddressCtx); - session.setAttribute("shippingServiceSelectedCtx", shippingServiceSelectedCtx); - session.setAttribute("shippingDetailsCtx", shippingDetailsCtx); - session.setAttribute("checkoutStatusCtx", checkoutStatusCtx); - session.setAttribute("externalTransactionCtx", externalTransactionCtx); - session.setAttribute("orderItemList", orderItemList); + session.setAttribute("shippingAddressCtx", shippingAddressCtx) + session.setAttribute("shippingServiceSelectedCtx", shippingServiceSelectedCtx) + session.setAttribute("shippingDetailsCtx", shippingDetailsCtx) + session.setAttribute("checkoutStatusCtx", checkoutStatusCtx) + session.setAttribute("externalTransactionCtx", externalTransactionCtx) + session.setAttribute("orderItemList", orderItemList) Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/OrderListPrepare.groovy Wed Nov 2 19:09:13 2016 @@ -17,59 +17,59 @@ * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.util.EntityUtil -orderLists = []; +orderLists = [] if (orderList) { for (orderCount = 0; orderCount < orderList.size(); orderCount++) { - orderItem = orderList[orderCount]; - orderId = null; - orderHeaders = from("OrderHeader").where("externalId", orderItem.("externalId")).queryList(); + orderItem = orderList[orderCount] + orderId = null + orderHeaders = from("OrderHeader").where("externalId", orderItem.("externalId")).queryList() if (orderHeaders.size() > 0) { - orderHeader = EntityUtil.getFirst(orderHeaders); - orderId = orderHeader.get("orderId").toString(); + orderHeader = EntityUtil.getFirst(orderHeaders) + orderId = orderHeader.get("orderId").toString() } - checkoutStatus = orderItem.get("checkoutStatusCtx"); - paymentMethodUsed = null; + checkoutStatus = orderItem.get("checkoutStatusCtx") + paymentMethodUsed = null if (checkoutStatus) { - paymentMethodUsed = checkoutStatus.get("paymentMethodUsed"); + paymentMethodUsed = checkoutStatus.get("paymentMethodUsed") } - //orderLists.add(orderMap); - items = orderItem.get("orderItemList"); + //orderLists.add(orderMap) + items = orderItem.get("orderItemList") for (itemCount = 0; itemCount < items.size(); itemCount++) { - item = items[itemCount]; - title = null; + item = items[itemCount] + title = null if (!(item.get("title"))) { - product = from("Product").where("productId", item.get("productId")).cache(true).queryOne(); - title = product.get("internalName"); + product = from("Product").where("productId", item.get("productId")).cache(true).queryOne() + title = product.get("internalName") } - orderMap = [:]; - orderMap.put("orderId", orderId); - orderMap.put("externalId", orderItem.get("externalId")); - orderMap.put("amountPaid", orderItem.get("amountPaid")); - orderMap.put("createdDate", orderItem.get("createdDate")); - orderMap.put("ebayUserIdBuyer", orderItem.get("ebayUserIdBuyer")); - orderMap.put("paymentMethodUsed", paymentMethodUsed); - orderMap.put("itemId", item.get("itemId")); - orderMap.put("quantity", item.get("quantity")); - orderMap.put("productId", item.get("productId")); - orderMap.put("transactionPrice", item.get("transactionPrice")); - orderMap.put("title", title); - orderMap.put("closedDate", item.get("closedDate")); + orderMap = [:] + orderMap.put("orderId", orderId) + orderMap.put("externalId", orderItem.get("externalId")) + orderMap.put("amountPaid", orderItem.get("amountPaid")) + orderMap.put("createdDate", orderItem.get("createdDate")) + orderMap.put("ebayUserIdBuyer", orderItem.get("ebayUserIdBuyer")) + orderMap.put("paymentMethodUsed", paymentMethodUsed) + orderMap.put("itemId", item.get("itemId")) + orderMap.put("quantity", item.get("quantity")) + orderMap.put("productId", item.get("productId")) + orderMap.put("transactionPrice", item.get("transactionPrice")) + orderMap.put("title", title) + orderMap.put("closedDate", item.get("closedDate")) - orderMap.put("shippingAddressCtx", orderItem.get("shippingAddressCtx")); - orderMap.put("shippingServiceSelectedCtx", orderItem.get("shippingServiceSelectedCtx")); - orderMap.put("shippingDetailsCtx", orderItem.get("shippingDetailsCtx")); - orderMap.put("checkoutStatusCtx", orderItem.get("checkoutStatusCtx")); - orderMap.put("externalTransactionCtx", orderItem.get("externalTransactionCtx")); - orderMap.put("orderItemList", orderItem.get("orderItemList")); - orderMap.put("paidTime", orderItem.get("paidTime")); - orderMap.put("shippedTime", orderItem.get("shippedTime")); - orderMap.put("paidTime", orderItem.get("paidTime")); - orderMap.put("emailBuyer", orderItem.get("emailBuyer")); + orderMap.put("shippingAddressCtx", orderItem.get("shippingAddressCtx")) + orderMap.put("shippingServiceSelectedCtx", orderItem.get("shippingServiceSelectedCtx")) + orderMap.put("shippingDetailsCtx", orderItem.get("shippingDetailsCtx")) + orderMap.put("checkoutStatusCtx", orderItem.get("checkoutStatusCtx")) + orderMap.put("externalTransactionCtx", orderItem.get("externalTransactionCtx")) + orderMap.put("orderItemList", orderItem.get("orderItemList")) + orderMap.put("paidTime", orderItem.get("paidTime")) + orderMap.put("shippedTime", orderItem.get("shippedTime")) + orderMap.put("paidTime", orderItem.get("paidTime")) + orderMap.put("emailBuyer", orderItem.get("emailBuyer")) - orderLists.add(orderMap); + orderLists.add(orderMap) } } } -context.orderLists = orderLists; +context.orderLists = orderLists Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/PrepareProductListing.groovy Wed Nov 2 19:09:13 2016 @@ -17,166 +17,166 @@ * under the License. */ - import org.apache.ofbiz.product.product.ProductContentWrapper; - import org.apache.ofbiz.product.catalog.CatalogWorker; - import org.apache.ofbiz.ebaystore.EbayStoreHelper; - import com.ebay.sdk.ApiContext; - import com.ebay.sdk.call.AddItemCall; - import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType; - import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType; - import com.ebay.soap.eBLBaseComponents.SiteCodeType; - import org.apache.ofbiz.ebaystore.EbayEvents; + import org.apache.ofbiz.product.product.ProductContentWrapper + import org.apache.ofbiz.product.catalog.CatalogWorker + import org.apache.ofbiz.ebaystore.EbayStoreHelper + import com.ebay.sdk.ApiContext + import com.ebay.sdk.call.AddItemCall + import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType + import com.ebay.soap.eBLBaseComponents.ItemSpecificsEnabledCodeType + import com.ebay.soap.eBLBaseComponents.SiteCodeType + import org.apache.ofbiz.ebaystore.EbayEvents //set the content path prefix - contentPathPrefix = CatalogWorker.getContentPathPrefix(request); - productStoreId = parameters.productStoreId; - search_CategoryId = parameters.search_CategoryId; + contentPathPrefix = CatalogWorker.getContentPathPrefix(request) + productStoreId = parameters.productStoreId + search_CategoryId = parameters.search_CategoryId //Get the addItemList and Prepare details - apiContext = EbayEvents.getApiContext(request); - addItemObj = EbayEvents.getAddItemListingObject(request, apiContext); - contents = []; + apiContext = EbayEvents.getApiContext(request) + addItemObj = EbayEvents.getAddItemListingObject(request, apiContext) + contents = [] if (addItemObj) { - site = (SiteCodeType)apiContext.getSite(); - isExportValid = "false"; - context.site = site; - context.siteCode = apiContext.getSite().value(); - context.siteCode_Ebay_Motors = SiteCodeType.E_BAY_MOTORS.value(); - addItems = addItemObj.itemListing; + site = (SiteCodeType)apiContext.getSite() + isExportValid = "false" + context.site = site + context.siteCode = apiContext.getSite().value() + context.siteCode_Ebay_Motors = SiteCodeType.E_BAY_MOTORS.value() + addItems = addItemObj.itemListing addItems.each{ addItemMap -> - addItem = addItemMap.addItemCall; - content = [:]; - item = addItem.getItem(); - productId = item.getSKU(); - product = from("Product").where("productId", productId).cache(true).queryOne(); - contentWrapper = new ProductContentWrapper(product, request); - content.productContentWrapper = contentWrapper; - content.product = product; - contents.add(content); + addItem = addItemMap.addItemCall + content = [:] + item = addItem.getItem() + productId = item.getSKU() + product = from("Product").where("productId", productId).cache(true).queryOne() + contentWrapper = new ProductContentWrapper(product, request) + content.productContentWrapper = contentWrapper + content.product = product + contents.add(content) if (addItemMap.isVerify == "Y") { - isExportValid = "true"; + isExportValid = "true" } else { - isExportValid = "false"; + isExportValid = "false" } } - context.isExportValid = isExportValid; + context.isExportValid = isExportValid - request.setAttribute("productStoreId", productStoreId); - categories = EbayEvents.getChildCategories(request); - context.categories = categories; - storeCategories = EbayEvents.getStoreChildCategories(request); - context.storeCategories = storeCategories; + request.setAttribute("productStoreId", productStoreId) + categories = EbayEvents.getChildCategories(request) + context.categories = categories + storeCategories = EbayEvents.getStoreChildCategories(request) + context.storeCategories = storeCategories // point product tab id - productId = null; + productId = null if (request.getAttribute("isProductId") || parameters.isProductId) { if (request.getAttribute("isProductId")) { - productId = request.getAttribute("isProductId"); + productId = request.getAttribute("isProductId") } else { - productId = parameters.isProductId; + productId = parameters.isProductId } - context.isProductId = productId; + context.isProductId = productId // get product default price form product price - productPrices = from("ProductPrice").where("productId", productId, "productPricePurposeId", "EBAY").queryList(); + productPrices = from("ProductPrice").where("productId", productId, "productPricePurposeId", "EBAY").queryList() if (productPrices) { - context.productPrices = productPrices; + context.productPrices = productPrices } //Is it reserve on eBayInventory - isReserve = EbayStoreHelper.isReserveInventory(delegator, productStoreId, productId); - context.isReserve = isReserve; + isReserve = EbayStoreHelper.isReserveInventory(delegator, productStoreId, productId) + context.isReserve = isReserve // get category detail - pkCateId = null; - stCate1ID = null; - stCate2ID = null; + pkCateId = null + stCate1ID = null + stCate2ID = null addItems.each{ addItemMap -> - addItem = addItemMap.addItemCall; - item = addItem.getItem(); + addItem = addItemMap.addItemCall + item = addItem.getItem() if (productId == item.getSKU()) { - primaryCate = item.getPrimaryCategory(); - storeFront = item.getStorefront(); + primaryCate = item.getPrimaryCategory() + storeFront = item.getStorefront() if (storeFront) { - stCate1ID = storeFront.getStoreCategoryID(); - stCate2ID = storeFront.getStoreCategory2ID(); - context.storeFront = storeFront; + stCate1ID = storeFront.getStoreCategoryID() + stCate2ID = storeFront.getStoreCategory2ID() + context.storeFront = storeFront } - if (primaryCate) pkCateId = primaryCate.getCategoryID(); + if (primaryCate) pkCateId = primaryCate.getCategoryID() } } - categorySpecificObject = EbayEvents.categorySpecifics(pkCateId, request); + categorySpecificObject = EbayEvents.categorySpecifics(pkCateId, request) if(categorySpecificObject) { - Map<String, List> categorySpecificMap = categorySpecificObject.get("categorySpecifics"); - int checkNameSpecific = null; - int checkValueSpecific = null; - Iterator<String> specificIterator = categorySpecificMap.keySet().iterator(); + Map<String, List> categorySpecificMap = categorySpecificObject.get("categorySpecifics") + int checkNameSpecific = null + int checkValueSpecific = null + Iterator<String> specificIterator = categorySpecificMap.keySet().iterator() while(specificIterator.hasNext()){ - String name = specificIterator.next(); - List<String> valueList = categorySpecificMap.get(name); - checkValueSpecific = (valueList) ? 1 : 0 ; - } - checkNameSpecific = categorySpecificMap.size(); - String checkSpecific = ((checkNameSpecific > 0) && (checkValueSpecific == 1)) ? "true" : "false"; - context.checkSpecific = checkSpecific; - context.categorySpecifix = categorySpecificObject; + String name = specificIterator.next() + List<String> valueList = categorySpecificMap.get(name) + checkValueSpecific = (valueList) ? 1 : 0 + } + checkNameSpecific = categorySpecificMap.size() + String checkSpecific = ((checkNameSpecific > 0) && (checkValueSpecific == 1)) ? "true" : "false" + context.checkSpecific = checkSpecific + context.categorySpecifix = categorySpecificObject } - context.stCate1ID = stCate1ID; - context.stCate2ID = stCate2ID; + context.stCate1ID = stCate1ID + context.stCate2ID = stCate2ID if (pkCateId) { - refName = "itemCateFacade_" + pkCateId; + refName = "itemCateFacade_" + pkCateId if (addItemObj.get(refName)) { - cf = addItemObj.get(refName); + cf = addItemObj.get(refName) if (cf) { - listingTypes = []; - listingDurationReferenceMap = cf.getListingDurationReferenceMap(); - listingDurationMap = cf.getListingDurationMap(); + listingTypes = [] + listingDurationReferenceMap = cf.getListingDurationReferenceMap() + listingDurationMap = cf.getListingDurationMap() if (listingDurationReferenceMap && listingDurationMap) { - Iterator keys = listingDurationReferenceMap.keySet().iterator(); + Iterator keys = listingDurationReferenceMap.keySet().iterator() while (keys.hasNext()) { - listingTypeMap = [:]; - String key = keys.next(); - listingTypeMap.type = key; - listingTypeMap.durations = listingDurationMap.get(new Integer(listingDurationReferenceMap.get(key))); - listingTypes.add(listingTypeMap); + listingTypeMap = [:] + String key = keys.next() + listingTypeMap.type = key + listingTypeMap.durations = listingDurationMap.get(new Integer(listingDurationReferenceMap.get(key))) + listingTypes.add(listingTypeMap) } } - context.listingTypes = listingTypes; - buyerPaymentMethods = cf.getPaymentMethods(); + context.listingTypes = listingTypes + buyerPaymentMethods = cf.getPaymentMethods() if (buyerPaymentMethods) { - context.paymentMethods = buyerPaymentMethods; - context.buyerPayMethCode_PAY_PAL = BuyerPaymentMethodCodeType.PAY_PAL; + context.paymentMethods = buyerPaymentMethods + context.buyerPayMethCode_PAY_PAL = BuyerPaymentMethodCodeType.PAY_PAL } // load item specifices and custom if both item attributes and item specifics are supported, we only use item specifics if (cf.getItemSpecificEnabled()) { if (ItemSpecificsEnabledCodeType.ENABLED.equals(cf.getItemSpecificEnabled())) { } else if (cf.AttributesEnabled()) { //show attributes input page - String attributesHtml = attrMaster.renderHtml(cf.getJoinedAttrSets(), null); - context.AttributesHtml = attributesHtml; + String attributesHtml = attrMaster.renderHtml(cf.getJoinedAttrSets(), null) + context.AttributesHtml = attributesHtml } else {//show return policy input page - sf = EbayEvents.getSiteFacade(apiContext,request); - details = sf.getEBayDetailsMap().get(apiContext.getSite()); - returnPolicyEnabled = cf.getRetPolicyEnabled(); + sf = EbayEvents.getSiteFacade(apiContext,request) + details = sf.getEBayDetailsMap().get(apiContext.getSite()) + returnPolicyEnabled = cf.getRetPolicyEnabled() - context.EBayDetails = details; - context.ReturnPolicyEnabled = returnPolicyEnabled; + context.EBayDetails = details + context.ReturnPolicyEnabled = returnPolicyEnabled } } // load shipping services detail - eBayDetailsMap = sf.getEBayDetailsMap(); + eBayDetailsMap = sf.getEBayDetailsMap() if (eBayDetailsMap) { - eBayDetails = eBayDetailsMap.get(site); - shippingServiceDetails = eBayDetails.getShippingServiceDetails(); - shippingServiceDetails = EbayEvents.filterShippingService(shippingServiceDetails); - context.shippingServiceDetails = shippingServiceDetails; - shippingLocationDetails = eBayDetails.getShippingLocationDetails(); - context.shippingLocationDetails = shippingLocationDetails; + eBayDetails = eBayDetailsMap.get(site) + shippingServiceDetails = eBayDetails.getShippingServiceDetails() + shippingServiceDetails = EbayEvents.filterShippingService(shippingServiceDetails) + context.shippingServiceDetails = shippingServiceDetails + shippingLocationDetails = eBayDetails.getShippingLocationDetails() + context.shippingLocationDetails = shippingLocationDetails } // load AdItemTemplates if (cf.getAdItemTemplates()) { - context.adItemTemplates = cf.getAdItemTemplates(); + context.adItemTemplates = cf.getAdItemTemplates() } } } } } } - context.addItemObj = addItemObj; - context.contentList = contents; + context.addItemObj = addItemObj + context.contentList = contents Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/RetrieveStoreOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,49 +17,49 @@ * under the License. */ -productStoreId = parameters.productStoreId; -storeThemeId = null; +productStoreId = parameters.productStoreId +storeThemeId = null if (parameters.ebayStore) { - ebayStore = parameters.get("ebayStore"); - storeThemeId = ebayStore.get("storeThemeId"); + ebayStore = parameters.get("ebayStore") + storeThemeId = ebayStore.get("storeThemeId") } if (productStoreId != null) { - flag = null; - storeBasicThemes = null; - resultsBasicThemes = runService('retrieveBasicThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]); + flag = null + storeBasicThemes = null + resultsBasicThemes = runService('retrieveBasicThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]) if(resultsBasicThemes){ - storeBasicThemes = resultsBasicThemes.get("storeThemeList"); + storeBasicThemes = resultsBasicThemes.get("storeThemeList") //check what kind of theme? - context.put("storeThemeOptList",storeBasicThemes); + context.put("storeThemeOptList",storeBasicThemes) if (storeThemeId != null && storeBasicThemes != null) { storeBasicThemes.each { storeTheme -> if (storeThemeId == storeTheme.storeThemeId) { - flag = "Basic"; + flag = "Basic" } } } } - storeAdvanceThemes = null; - storeAdvancedThemeColorOptList = null; - resultsAdvanceThemes = runService('retrieveAdvancedThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]); + storeAdvanceThemes = null + storeAdvancedThemeColorOptList = null + resultsAdvanceThemes = runService('retrieveAdvancedThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]) if (resultsAdvanceThemes) { - storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList"); - storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList"); - context.put("storeAdvanceThemeOptList",storeAdvanceThemes); - context.put("storeAdvancedThemeColorOptList",storeAdvancedThemeColorOptList); + storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList") + storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList") + context.put("storeAdvanceThemeOptList",storeAdvanceThemes) + context.put("storeAdvancedThemeColorOptList",storeAdvancedThemeColorOptList) if (storeThemeId != null && storeAdvanceThemes != null) { storeAdvanceThemes.each { storeAdvanceTheme -> if(storeThemeId == storeAdvanceTheme.storeThemeId){ - flag = "Advanced"; + flag = "Advanced" } } } } - resultsFontTheme = runService('retrieveStoreFontTheme',["productStoreId":productStoreId, "userLogin": userLogin]); + resultsFontTheme = runService('retrieveStoreFontTheme',["productStoreId":productStoreId, "userLogin": userLogin]) if (resultsFontTheme) { - storeFontTheme = resultsFontTheme.get("advanceFontTheme"); - context.put("storeFontTheme",storeFontTheme); + storeFontTheme = resultsFontTheme.get("advanceFontTheme") + context.put("storeFontTheme",storeFontTheme) } - context.put("themeType",flag); + context.put("themeType",flag) } Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/SoldAction.groovy Wed Nov 2 19:09:13 2016 @@ -17,24 +17,24 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; +import org.apache.ofbiz.base.util.* -actionList = []; -hasAction = false; +actionList = [] +hasAction = false //Unpaid Item Dispute if (unpaidItemStatus == null && paidTime == null && checkoutStatus != "CheckoutComplete") { - inMap = [:]; - inMap.put("action","openUnpaid"); - inMap.put("actionName","Open Unpaid"); - actionList.add(inMap); - hasAction = true; + inMap = [:] + inMap.put("action","openUnpaid") + inMap.put("actionName","Open Unpaid") + actionList.add(inMap) + hasAction = true } //Second Chance Offer -inMap = [:]; -inMap.put("action","makeSecondChanceOffer"); -inMap.put("actionName","Make Second Chance Offer"); -actionList.add(inMap); -hasAction = true; +inMap = [:] +inMap.put("action","makeSecondChanceOffer") +inMap.put("actionName","Make Second Chance Offer") +actionList.add(inMap) +hasAction = true -context.actionList = actionList; -context.hasAction = hasAction; +context.actionList = actionList +context.hasAction = hasAction Modified: ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy (original) +++ ofbiz/trunk/specialpurpose/ebaystore/groovyScripts/store/StoreAccount.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; +import org.apache.ofbiz.base.util.* -results = []; -ebayAccountList = from("PartyRoleAndPartyDetail").where("roleTypeId", "EBAY_ACCOUNT").queryList(); -productStoreRoles = from("ProductStoreRole").where("roleTypeId", "EBAY_ACCOUNT").queryList(); +results = [] +ebayAccountList = from("PartyRoleAndPartyDetail").where("roleTypeId", "EBAY_ACCOUNT").queryList() +productStoreRoles = from("ProductStoreRole").where("roleTypeId", "EBAY_ACCOUNT").queryList() if (productStoreRoles != null && ebayAccountList != null) { ebayAccountList.each{ebayAccount-> - partyId = ebayAccount.partyId; + partyId = ebayAccount.partyId productStoreRoles.each{productStoreRole -> if(partyId.equals(productStoreRole.partyId)){ - storeMap = [:]; - storeMap.partyId = ebayAccount.partyId; - storeMap.firstName = ebayAccount.firstName; - storeMap.lastName = ebayAccount.lastName; - storeMap.productStoreId = productStoreRole.productStoreId; - results.add(storeMap); + storeMap = [:] + storeMap.partyId = ebayAccount.partyId + storeMap.firstName = ebayAccount.firstName + storeMap.lastName = ebayAccount.lastName + storeMap.productStoreId = productStoreRole.productStoreId + results.add(storeMap) } } } - context.put("stores",results); + context.put("stores",results) } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/EcommerceSetup.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import java.util.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.product.catalog.CatalogWorker; -import org.apache.ofbiz.product.store.ProductStoreWorker; -import org.apache.ofbiz.common.CommonWorkers; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.webapp.control.*; +import java.util.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.product.catalog.CatalogWorker +import org.apache.ofbiz.product.store.ProductStoreWorker +import org.apache.ofbiz.common.CommonWorkers +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.webapp.control.* -productStore = ProductStoreWorker.getProductStore(request); +productStore = ProductStoreWorker.getProductStore(request) -prodCatalog = CatalogWorker.getProdCatalog(request); +prodCatalog = CatalogWorker.getProdCatalog(request) if (prodCatalog) { - catalogStyleSheet = prodCatalog.styleSheet; - if (catalogStyleSheet) globalContext.catalogStyleSheet = catalogStyleSheet; - catalogHeaderLogo = prodCatalog.headerLogo; - if (catalogHeaderLogo) globalContext.catalogHeaderLogo = catalogHeaderLogo; + catalogStyleSheet = prodCatalog.styleSheet + if (catalogStyleSheet) globalContext.catalogStyleSheet = catalogStyleSheet + catalogHeaderLogo = prodCatalog.headerLogo + if (catalogHeaderLogo) globalContext.catalogHeaderLogo = catalogHeaderLogo } -globalContext.productStore = productStore; -globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin"); -globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request); +globalContext.productStore = productStore +globalContext.checkLoginUrl = LoginWorker.makeLoginUrl(request, "checkLogin") +globalContext.catalogQuickaddUse = CatalogWorker.getCatalogQuickaddUse(request) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Login.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Login.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Login.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Login.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.common.CommonWorkers; -import org.apache.ofbiz.webapp.control.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.common.CommonWorkers +import org.apache.ofbiz.webapp.control.* -context.autoUserLogin = session.getAttribute("autoUserLogin"); -context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout"); +context.autoUserLogin = session.getAttribute("autoUserLogin") +context.autoLogoutUrl = LoginWorker.makeLoginUrl(request, "autoLogout") -previousParams = session.getAttribute("_PREVIOUS_PARAMS_"); +previousParams = session.getAttribute("_PREVIOUS_PARAMS_") if (previousParams) { - previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["USERNAME", "PASSWORD"]); - previousParams = "?" + previousParams; + previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["USERNAME", "PASSWORD"]) + previousParams = "?" + previousParams } else { - previousParams = ""; + previousParams = "" } -context.previousParams = previousParams; +context.previousParams = previousParams Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Main.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Main.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Main.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/Main.groovy Wed Nov 2 19:09:13 2016 @@ -17,13 +17,13 @@ * under the License. */ -import org.apache.ofbiz.product.catalog.*; +import org.apache.ofbiz.product.catalog.* -catalogId = CatalogWorker.getCurrentCatalogId(request); -promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, catalogId); -request.setAttribute("productCategoryId", promoCat); +catalogId = CatalogWorker.getCurrentCatalogId(request) +promoCat = CatalogWorker.getCatalogPromotionsCategoryId(request, catalogId) +request.setAttribute("productCategoryId", promoCat) -/* NOTE DEJ20070220 woah, this is doing weird stuff like always showing the last viewed category when going to the main page; +/* NOTE DEJ20070220 woah, this is doing weird stuff like always showing the last viewed category when going to the main page * It appears this was done for to make it go back to the desired category after logging in, but this is NOT the place to do that, * and IMO this is an unacceptable side-effect. * @@ -33,10 +33,10 @@ request.setAttribute("productCategoryId" * * NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after. * -productCategoryId = session.getAttribute("productCategoryId"); +productCategoryId = session.getAttribute("productCategoryId") if (!productCategoryId) { - request.setAttribute("productCategoryId", promoCat); + request.setAttribute("productCategoryId", promoCat) } else { - request.setAttribute("productCategoryId", productCategoryId); + request.setAttribute("productCategoryId", productCategoryId) } */ Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/ProcessPaymentSettings.groovy Wed Nov 2 19:09:13 2016 @@ -17,68 +17,68 @@ * under the License. */ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.entity.Delegator; -import org.apache.ofbiz.entity.GenericValue; -import org.apache.ofbiz.order.shoppingcart.CheckOutHelper; -import org.apache.ofbiz.order.shoppingcart.ShoppingCart; -import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents; -import org.apache.ofbiz.service.LocalDispatcher; -import org.apache.ofbiz.service.ModelService; -import org.apache.ofbiz.service.ServiceUtil; - -cart = ShoppingCartEvents.getCartObject(request); -dispatcher = request.getAttribute("dispatcher"); -delegator = request.getAttribute("delegator"); -checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart); -paramMap = UtilHttp.getParameterMap(request); - -paymentMethodTypeId = paramMap.paymentMethodTypeId; -errorMessages = []; -errorMaps = [:]; +import java.util.ArrayList +import java.util.HashMap +import java.util.List +import java.util.Map + +import org.apache.ofbiz.base.util.UtilHttp +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.entity.Delegator +import org.apache.ofbiz.entity.GenericValue +import org.apache.ofbiz.order.shoppingcart.CheckOutHelper +import org.apache.ofbiz.order.shoppingcart.ShoppingCart +import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents +import org.apache.ofbiz.service.LocalDispatcher +import org.apache.ofbiz.service.ModelService +import org.apache.ofbiz.service.ServiceUtil + +cart = ShoppingCartEvents.getCartObject(request) +dispatcher = request.getAttribute("dispatcher") +delegator = request.getAttribute("delegator") +checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart) +paramMap = UtilHttp.getParameterMap(request) + +paymentMethodTypeId = paramMap.paymentMethodTypeId +errorMessages = [] +errorMaps = [:] if (paymentMethodTypeId) { - paymentMethodId = request.getAttribute("paymentMethodId"); + paymentMethodId = request.getAttribute("paymentMethodId") if ("EXT_OFFLINE".equals(paymentMethodTypeId)) { - paymentMethodId = "EXT_OFFLINE"; + paymentMethodId = "EXT_OFFLINE" } - singleUsePayment = paramMap.singleUsePayment; - appendPayment = paramMap.appendPayment; - isSingleUsePayment = "Y".equalsIgnoreCase(singleUsePayment) ?: false; - doAppendPayment = "Y".equalsIgnoreCase(appendPayment) ?: false; - callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, isSingleUsePayment, doAppendPayment); - cpi = cart.getPaymentInfo(paymentMethodId, null, null, null, true); - cpi.securityCode = paramMap.cardSecurityCode; - ServiceUtil.addErrors(errorMessages, errorMaps, callResult); + singleUsePayment = paramMap.singleUsePayment + appendPayment = paramMap.appendPayment + isSingleUsePayment = "Y".equalsIgnoreCase(singleUsePayment) ?: false + doAppendPayment = "Y".equalsIgnoreCase(appendPayment) ?: false + callResult = checkOutHelper.finalizeOrderEntryPayment(paymentMethodId, null, isSingleUsePayment, doAppendPayment) + cpi = cart.getPaymentInfo(paymentMethodId, null, null, null, true) + cpi.securityCode = paramMap.cardSecurityCode + ServiceUtil.addErrors(errorMessages, errorMaps, callResult) } if (!errorMessages && !errorMaps) { - selPaymentMethods = null; - addGiftCard = paramMap.addGiftCard; + selPaymentMethods = null + addGiftCard = paramMap.addGiftCard if ("Y".equalsIgnoreCase(addGiftCard)) { - selPaymentMethods = [paymentMethodTypeId : null]; - callResult = checkOutHelper.checkGiftCard(paramMap, selPaymentMethods); - ServiceUtil.addErrors(errorMessages, errorMaps, callResult); + selPaymentMethods = [paymentMethodTypeId : null] + callResult = checkOutHelper.checkGiftCard(paramMap, selPaymentMethods) + ServiceUtil.addErrors(errorMessages, errorMaps, callResult) if (!errorMessages && !errorMaps) { - gcPaymentMethodId = callResult.paymentMethodId; - giftCardAmount = callResult.amount; - gcCallRes = checkOutHelper.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true); - ServiceUtil.addErrors(errorMessages, errorMaps, gcCallRes); + gcPaymentMethodId = callResult.paymentMethodId + giftCardAmount = callResult.amount + gcCallRes = checkOutHelper.finalizeOrderEntryPayment(gcPaymentMethodId, giftCardAmount, true, true) + ServiceUtil.addErrors(errorMessages, errorMaps, gcCallRes) } } } //See whether we need to return an error or not -callResult = ServiceUtil.returnSuccess(); +callResult = ServiceUtil.returnSuccess() if (errorMessages || errorMaps) { - request.setAttribute(ModelService.ERROR_MESSAGE_LIST, errorMessages); - request.setAttribute(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - return "error"; + request.setAttribute(ModelService.ERROR_MESSAGE_LIST, errorMessages) + request.setAttribute(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR) + return "error" } -return "success"; +return "success" Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowCart.groovy Wed Nov 2 19:09:13 2016 @@ -17,62 +17,62 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.product.catalog.CatalogWorker; -import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker; -import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents; -import org.apache.ofbiz.product.store.ProductStoreWorker; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.product.catalog.CatalogWorker +import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker +import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents +import org.apache.ofbiz.product.store.ProductStoreWorker +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.EntityUtil // Get the Cart and Prepare Size -shoppingCart = ShoppingCartEvents.getCartObject(request); -context.shoppingCartSize = shoppingCart?.size() ?: 0; -context.shoppingCart = shoppingCart; +shoppingCart = ShoppingCartEvents.getCartObject(request) +context.shoppingCartSize = shoppingCart?.size() ?: 0 +context.shoppingCart = shoppingCart -context.productStore = ProductStoreWorker.getProductStore(request); +context.productStore = ProductStoreWorker.getProductStore(request) if (parameters.add_product_id) { // check if a parameter is passed - add_product_id = parameters.add_product_id; - product = from("Product").where("productId", add_product_id).cache(true).queryOne(); - context.product = product; + add_product_id = parameters.add_product_id + product = from("Product").where("productId", add_product_id).cache(true).queryOne() + context.product = product } // get all the possible gift wrap options -allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList(); -context.allgiftWraps = allgiftWraps; +allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList() +context.allgiftWraps = allgiftWraps // get the shopping lists for the logged in user if (userLogin) { allShoppingLists = from("ShoppingList").where(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId), - EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")).orderBy("listName").queryList(); - context.shoppingLists = allShoppingLists; + EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")).orderBy("listName").queryList() + context.shoppingLists = allShoppingLists } // Get Cart Associated Products Data -associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true); -context.associatedProducts = associatedProducts; +associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true) +context.associatedProducts = associatedProducts -context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request); +context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request) //Get Cart Items -shoppingCartItems = shoppingCart.items(); +shoppingCartItems = shoppingCart.items() if(shoppingCartItems) { shoppingCartItems.each { shoppingCartItem -> if (shoppingCartItem.getProductId()) { if (shoppingCartItem.getParentProductId()) { - parentProductId = shoppingCartItem.getParentProductId(); + parentProductId = shoppingCartItem.getParentProductId() } else { - parentProductId = shoppingCartItem.getProductId(); + parentProductId = shoppingCartItem.getProductId() } - context.parentProductId = parentProductId; + context.parentProductId = parentProductId } - productCategoryMembers = from("ProductCategoryMember").where("productId", parentProductId).queryList(); + productCategoryMembers = from("ProductCategoryMember").where("productId", parentProductId).queryList() if (productCategoryMembers) { - productCategoryMember = EntityUtil.getFirst(productCategoryMembers); - productCategory = productCategoryMember.getRelatedOne("ProductCategory", false); - context.productCategory = productCategory; + productCategoryMember = EntityUtil.getFirst(productCategoryMembers) + productCategory = productCategoryMember.getRelatedOne("ProductCategory", false) + context.productCategory = productCategory } } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/cart/ShowPromoText.groovy Wed Nov 2 19:09:13 2016 @@ -17,42 +17,42 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker; +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker -promoShowLimit = 3; +promoShowLimit = 3 //Get Promo Text Data -productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request); +productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request) //Make sure that at least one promo has non-empty promoText -showPromoText = false; -promoToShow = 0; -productPromosAllShowable = new ArrayList(productPromosAll.size()); +showPromoText = false +promoToShow = 0 +productPromosAllShowable = new ArrayList(productPromosAll.size()) productPromosAll.each { productPromo -> - promoText = productPromo.promoText; + promoText = productPromo.promoText if (promoText && !"N".equals(productPromo.showToCustomer)) { - showPromoText = true; - promoToShow++; - productPromosAllShowable.add(productPromo); + showPromoText = true + promoToShow++ + productPromosAllShowable.add(productPromo) } } // now slim it down to promoShowLimit -productPromosRandomTemp = new ArrayList(productPromosAllShowable); -productPromos = null; +productPromosRandomTemp = new ArrayList(productPromosAllShowable) +productPromos = null if (productPromosRandomTemp.size() > promoShowLimit) { - productPromos = new ArrayList(promoShowLimit); + productPromos = new ArrayList(promoShowLimit) for (i = 0; i < promoShowLimit; i++) { - randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int; - productPromos.add(productPromosRandomTemp.remove(randomIndex)); + randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int + productPromos.add(productPromosRandomTemp.remove(randomIndex)) } } else { - productPromos = productPromosRandomTemp; + productPromos = productPromosRandomTemp } -context.promoShowLimit = promoShowLimit; -context.productPromosAllShowable = productPromosAllShowable; -context.productPromos = productPromos; -context.showPromoText = showPromoText; -context.promoToShow = promoToShow; +context.promoShowLimit = promoShowLimit +context.productPromosAllShowable = productPromosAllShowable +context.productPromos = productPromos +context.showPromoText = showPromoText +context.promoToShow = promoToShow Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/AjaxBreadcrumbs.groovy Wed Nov 2 19:09:13 2016 @@ -16,34 +16,34 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.product.product.ProductContentWrapper; -import org.apache.ofbiz.product.category.*; -import org.apache.ofbiz.base.util.UtilValidate; +import org.apache.ofbiz.product.product.ProductContentWrapper +import org.apache.ofbiz.product.category.* +import org.apache.ofbiz.base.util.UtilValidate -parentCategoryStr = parameters.parentCategoryStr; +parentCategoryStr = parameters.parentCategoryStr if(!UtilValidate.isEmpty(parentCategoryStr)) { - pathList = parentCategoryStr.split('/'); - cateList = []; - pathTemp = ''; + pathList = parentCategoryStr.split('/') + cateList = [] + pathTemp = '' for(path in pathList) { - cateMap = [:]; - category = from("ProductCategory").where("productCategoryId", path).queryOne(); - categoryContentWrapper = new CategoryContentWrapper(category, request); + cateMap = [:] + category = from("ProductCategory").where("productCategoryId", path).queryOne() + categoryContentWrapper = new CategoryContentWrapper(category, request) - pathTemp = pathTemp + path; - cateMap.title = categoryContentWrapper.get("DESCRIPTION", "html"); - cateMap.productCategoryId = category.productCategoryId; - cateMap.parentCategory = pathTemp; + pathTemp = pathTemp + path + cateMap.title = categoryContentWrapper.get("DESCRIPTION", "html") + cateMap.productCategoryId = category.productCategoryId + cateMap.parentCategory = pathTemp - cateList.add(cateMap); + cateList.add(cateMap) - pathTemp = pathTemp + '/'; + pathTemp = pathTemp + '/' } - context.productCategoryTrail = cateList; + context.productCategoryTrail = cateList } -currentCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne(); -currentCategoryContentWrapper = new CategoryContentWrapper(currentCategory, request); -context.currentCategoryName = currentCategoryContentWrapper.get("CATEGORY_NAME", "html"); -context.currentCategoryDescription = currentCategoryContentWrapper.get("DESCRIPTION", "html"); -context.currentCategoryId = productCategoryId; +currentCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne() +currentCategoryContentWrapper = new CategoryContentWrapper(currentCategory, request) +context.currentCategoryName = currentCategoryContentWrapper.get("CATEGORY_NAME", "html") +context.currentCategoryDescription = currentCategoryContentWrapper.get("DESCRIPTION", "html") +context.currentCategoryId = productCategoryId Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/BestSellingCategory.groovy Wed Nov 2 19:09:13 2016 @@ -17,26 +17,26 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilValidate; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.product.category.*; +import org.apache.ofbiz.base.util.UtilValidate +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.category.* -catalogId = CatalogWorker.getCurrentCatalogId(request); -bestSellerCates = []; +catalogId = CatalogWorker.getCurrentCatalogId(request) +bestSellerCates = [] if (UtilValidate.isNotEmpty(catalogId)) { - prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL"); + prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL") if (prodCatalogCategoryList.size() > 0) { for (int i = 0; i < prodCatalogCategoryList.size(); i++) { - prodCatalogCategory = prodCatalogCategoryList[i]; - productCategoryId = prodCatalogCategory.getString("productCategoryId"); - childCategoryList = CategoryWorker.getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true); + prodCatalogCategory = prodCatalogCategoryList[i] + productCategoryId = prodCatalogCategory.getString("productCategoryId") + childCategoryList = CategoryWorker.getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true) if (childCategoryList.size() > 0) { - bestSellerCates.add(childCategoryList); + bestSellerCates.add(childCategoryList) } } } } -context.productCategoryList = bestSellerCates; +context.productCategoryList = bestSellerCates Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/LayeredNavigation.groovy Wed Nov 2 19:09:13 2016 @@ -17,122 +17,122 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.product.catalog.CatalogWorker; -import org.apache.ofbiz.product.category.CategoryContentWrapper; -import org.apache.ofbiz.product.category.CategoryWorker; -import org.apache.ofbiz.product.product.ProductSearch; -import org.apache.ofbiz.product.product.ProductSearchSession; +import org.apache.ofbiz.base.util.UtilHttp +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.product.catalog.CatalogWorker +import org.apache.ofbiz.product.category.CategoryContentWrapper +import org.apache.ofbiz.product.category.CategoryWorker +import org.apache.ofbiz.product.product.ProductSearch +import org.apache.ofbiz.product.product.ProductSearchSession -searchCategoryId = parameters.searchCategoryId; +searchCategoryId = parameters.searchCategoryId if (!searchCategoryId) { - searchCategoryId = context.productCategoryId; + searchCategoryId = context.productCategoryId } if (searchCategoryId) { - currentSearchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne(); - CategoryWorker.getRelatedCategories(request, "subCategoryList", searchCategoryId, false); - subCategoryList = request.getAttribute("subCategoryList"); - CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(currentSearchCategory, request); - context.currentSearchCategory = currentSearchCategory; - context.categoryContentWrapper = categoryContentWrapper; + currentSearchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne() + CategoryWorker.getRelatedCategories(request, "subCategoryList", searchCategoryId, false) + subCategoryList = request.getAttribute("subCategoryList") + CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(currentSearchCategory, request) + context.currentSearchCategory = currentSearchCategory + context.categoryContentWrapper = categoryContentWrapper } -productCategoryId = context.productCategoryId; +productCategoryId = context.productCategoryId if (productCategoryId) { - context.productCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne(); - parameters.SEARCH_CATEGORY_ID = productCategoryId; + context.productCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne() + parameters.SEARCH_CATEGORY_ID = productCategoryId } if (!parameters.clearSearch || !"N".equals(parameters.clearSearch)) { - ProductSearchSession.searchClear(session); + ProductSearchSession.searchClear(session) } -ProductSearchSession.processSearchParameters(parameters, request); -prodCatalogId = CatalogWorker.getCurrentCatalogId(request); -result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId); +ProductSearchSession.processSearchParameters(parameters, request) +prodCatalogId = CatalogWorker.getCurrentCatalogId(request) +result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId) -context.index = ProductSearchSession.getCategoryCostraintIndex(session); +context.index = ProductSearchSession.getCategoryCostraintIndex(session) -searchConstraintList = ProductSearchSession.getProductSearchOptions(session).getConstraintList(); +searchConstraintList = ProductSearchSession.getProductSearchOptions(session).getConstraintList() if (searchCategoryId) { - productCategoryRollups = from("ProductCategoryRollup").where("productCategoryId", searchCategoryId).filterByDate().queryList(); - previousCategoryId = null; + productCategoryRollups = from("ProductCategoryRollup").where("productCategoryId", searchCategoryId).filterByDate().queryList() + previousCategoryId = null if (productCategoryRollups) { for (categoryRollup in productCategoryRollups) { - categoryConstraint = new ProductSearch.CategoryConstraint(categoryRollup.parentProductCategoryId, true, false); + categoryConstraint = new ProductSearch.CategoryConstraint(categoryRollup.parentProductCategoryId, true, false) if (searchConstraintList.contains(categoryConstraint)) { - previousCategoryId = categoryRollup.parentProductCategoryId; - context.previousCategoryId = previousCategoryId; + previousCategoryId = categoryRollup.parentProductCategoryId + context.previousCategoryId = previousCategoryId } } } } -context.showSubCats = true; +context.showSubCats = true if (subCategoryList) { - thisSubCategoryList = []; + thisSubCategoryList = [] subCategoryList.each { subCategory -> - categoryCount = ProductSearchSession.getCountForProductCategory(subCategory.productCategoryId, session, delegator); + categoryCount = ProductSearchSession.getCountForProductCategory(subCategory.productCategoryId, session, delegator) if (categoryCount > 0) { - subCategoryContentWrapper = new CategoryContentWrapper(subCategory, request); - thisSubCategoryList.add([productCategoryId: subCategory.productCategoryId, categoryName: subCategory.categoryName, count: categoryCount, categoryContentWrapper: subCategoryContentWrapper]); + subCategoryContentWrapper = new CategoryContentWrapper(subCategory, request) + thisSubCategoryList.add([productCategoryId: subCategory.productCategoryId, categoryName: subCategory.categoryName, count: categoryCount, categoryContentWrapper: subCategoryContentWrapper]) } } if (thisSubCategoryList) { - context.subCategoryList = thisSubCategoryList; + context.subCategoryList = thisSubCategoryList } else { - context.showSubCats = false; + context.showSubCats = false } } else { - context.showSubCats = false; + context.showSubCats = false } -context.showColors = true; -colors = ProductSearchSession.listCountByFeatureForType("COLOR", session, delegator); -colorFeatureType = from("ProductFeatureType").where("productFeatureTypeId", "COLOR").queryOne(); +context.showColors = true +colors = ProductSearchSession.listCountByFeatureForType("COLOR", session, delegator) +colorFeatureType = from("ProductFeatureType").where("productFeatureTypeId", "COLOR").queryOne() if (colors) { colors.each { color -> - featureConstraint = new ProductSearch.FeatureConstraint(color.productFeatureId, false); + featureConstraint = new ProductSearch.FeatureConstraint(color.productFeatureId, false) if (searchConstraintList.contains(featureConstraint)) { - context.showColors=false; + context.showColors=false } } } else { - context.showColors = false; + context.showColors = false } if (context.showColors) { - context.colors = colors; - context.colorFeatureType = colorFeatureType; + context.colors = colors + context.colorFeatureType = colorFeatureType } -availablePriceRangeList = [[low: "0", high: "10"], [low: "10", high: "20"], [low: "20", high: "30"], [low: "30", high: "40"], [low: "40", high: "50"], [low: "50", high: "60"], [low: "60", high: "70"], [low: "70", high: "80"], [low: "80", high: "90"], [low: "90", high: "100"]]; -priceRangeList = []; -context.showPriceRange = true; +availablePriceRangeList = [[low: "0", high: "10"], [low: "10", high: "20"], [low: "20", high: "30"], [low: "30", high: "40"], [low: "40", high: "50"], [low: "50", high: "60"], [low: "60", high: "70"], [low: "70", high: "80"], [low: "80", high: "90"], [low: "90", high: "100"]] +priceRangeList = [] +context.showPriceRange = true availablePriceRangeList.each { priceRange -> - priceRangeConstraint = new ProductSearch.ListPriceRangeConstraint(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), UtilHttp.getCurrencyUom(request)); + priceRangeConstraint = new ProductSearch.ListPriceRangeConstraint(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), UtilHttp.getCurrencyUom(request)) if (searchConstraintList.contains(priceRangeConstraint)) { - context.showPriceRange = false; + context.showPriceRange = false } else { - priceRangeCount = ProductSearchSession.getCountForListPriceRange(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), session, delegator); + priceRangeCount = ProductSearchSession.getCountForListPriceRange(new BigDecimal(priceRange.low), new BigDecimal(priceRange.high), session, delegator) if (priceRangeCount != 0) { - priceRangeList.add([low: priceRange.low, high: priceRange.high, count: priceRangeCount]); + priceRangeList.add([low: priceRange.low, high: priceRange.high, count: priceRangeCount]) } } } if (!priceRangeList) { - context.showPriceRange = false; + context.showPriceRange = false } if (context.showPriceRange) { - context.priceRangeList = priceRangeList; + context.priceRangeList = priceRangeList } -context.productIds = result.productIds; -context.viewIndex = result.viewIndex; -context.viewSize = result.viewSize; -context.listSize = result.listSize; -context.lowIndex = result.lowIndex; -context.highIndex = result.highIndex; -context.paging = result.paging; -context.previousViewSize = result.previousViewSize; -context.searchConstraintStrings = result.searchConstraintStrings; +context.productIds = result.productIds +context.viewIndex = result.viewIndex +context.viewSize = result.viewSize +context.listSize = result.listSize +context.lowIndex = result.lowIndex +context.highIndex = result.highIndex +context.paging = result.paging +context.previousViewSize = result.previousViewSize +context.searchConstraintStrings = result.searchConstraintStrings Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniProductSummary.groovy Wed Nov 2 19:09:13 2016 @@ -17,29 +17,29 @@ * under the License. */ -import java.math.BigDecimal; -import java.util.Map; +import java.math.BigDecimal +import java.util.Map -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.product.product.ProductContentWrapper; -import org.apache.ofbiz.product.config.ProductConfigWorker; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.product.store.*; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.webapp.website.WebSiteWorker; - -miniProduct = request.getAttribute("miniProduct"); -optProductId = request.getAttribute("optProductId"); -webSiteId = WebSiteWorker.getWebSiteId(request); -prodCatalogId = CatalogWorker.getCurrentCatalogId(request); -productStoreId = ProductStoreWorker.getProductStoreId(request); -cart = ShoppingCartEvents.getCartObject(request); -context.remove("totalPrice"); +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.product.product.ProductContentWrapper +import org.apache.ofbiz.product.config.ProductConfigWorker +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.store.* +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.webapp.website.WebSiteWorker + +miniProduct = request.getAttribute("miniProduct") +optProductId = request.getAttribute("optProductId") +webSiteId = WebSiteWorker.getWebSiteId(request) +prodCatalogId = CatalogWorker.getCurrentCatalogId(request) +productStoreId = ProductStoreWorker.getProductStoreId(request) +cart = ShoppingCartEvents.getCartObject(request) +context.remove("totalPrice") if (optProductId) { - miniProduct = from("Product").where("productId", optProductId).queryOne(); + miniProduct = from("Product").where("productId", optProductId).queryOne() } if (miniProduct && productStoreId && prodCatalogId ) { @@ -49,43 +49,43 @@ if (miniProduct && productStoreId && pro webSiteId : webSiteId, currencyUomId : cart.getCurrency(), autoUserLogin : autoUserLogin, - productStoreId : productStoreId]; - if (userLogin) priceParams.partyId = userLogin.partyId; - priceResult = runService('calculateProductPrice', priceParams); + productStoreId : productStoreId] + if (userLogin) priceParams.partyId = userLogin.partyId + priceResult = runService('calculateProductPrice', priceParams) // returns: isSale, price, orderItemPriceInfos - context.priceResult = priceResult; + context.priceResult = priceResult // Check if Price has to be displayed with tax if (productStore.get("showPricesWithVatTax").equals("Y")) { - Map priceMap = runServic('calcTaxForDisplay', ["basePrice": priceResult.get("price"), "locale": locale, "productId": optProductId, "productStoreId": productStoreId]); - context.price = priceMap.get("priceWithTax"); + Map priceMap = runServic('calcTaxForDisplay', ["basePrice": priceResult.get("price"), "locale": locale, "productId": optProductId, "productStoreId": productStoreId]) + context.price = priceMap.get("priceWithTax") } else { - context.price = priceResult.get("price"); + context.price = priceResult.get("price") } // get aggregated product totalPrice if ("AGGREGATED".equals(miniProduct.productTypeId) || "AGGREGATED_SERVICE".equals(miniProduct.productTypeId)) { - configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request); + configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request) if (configWrapper) { - configWrapper.setDefaultConfig(); + configWrapper.setDefaultConfig() // Check if Config Price has to be displayed with tax if (productStore.get("showPricesWithVatTax").equals("Y")) { - BigDecimal totalPriceNoTax = configWrapper.getTotalPrice(); - Map totalPriceMap = runService('calcTaxForDisplay', ["basePrice": totalPriceNoTax, "locale": locale, "productId": optProductId, "productStoreId": productStoreId]); - context.totalPrice = totalPriceMap.get("priceWithTax"); + BigDecimal totalPriceNoTax = configWrapper.getTotalPrice() + Map totalPriceMap = runService('calcTaxForDisplay', ["basePrice": totalPriceNoTax, "locale": locale, "productId": optProductId, "productStoreId": productStoreId]) + context.totalPrice = totalPriceMap.get("priceWithTax") } else { - context.totalPrice = configWrapper.getTotalPrice(); + context.totalPrice = configWrapper.getTotalPrice() } } } - context.miniProduct = miniProduct; - context.nowTimeLong = nowTimestamp.getTime(); + context.miniProduct = miniProduct + context.nowTimeLong = nowTimestamp.getTime() - context.miniProdFormName = request.getAttribute("miniProdFormName"); - context.miniProdQuantity = request.getAttribute("miniProdQuantity"); + context.miniProdFormName = request.getAttribute("miniProdFormName") + context.miniProdQuantity = request.getAttribute("miniProdQuantity") // make the miniProductContentWrapper - ProductContentWrapper miniProductContentWrapper = new ProductContentWrapper(miniProduct, request); - context.miniProductContentWrapper = miniProductContentWrapper; + ProductContentWrapper miniProductContentWrapper = new ProductContentWrapper(miniProduct, request) + context.miniProductContentWrapper = miniProductContentWrapper } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/MiniReorderProds.groovy Wed Nov 2 19:09:13 2016 @@ -17,8 +17,8 @@ * under the License. */ -import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker; +import org.apache.ofbiz.order.shoppingcart.product.ProductDisplayWorker -reorderProductResults = ProductDisplayWorker.getQuickReorderProducts(request); -context.reorderProducts = reorderProductResults.products; -context.reorderQuantities = reorderProductResults.quantities; +reorderProductResults = ProductDisplayWorker.getQuickReorderProducts(request) +context.reorderProducts = reorderProductResults.products +context.reorderQuantities = reorderProductResults.quantities Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/PopularTags.groovy Wed Nov 2 19:09:13 2016 @@ -17,66 +17,66 @@ * under the License. */ -import java.util.List; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.util.EntityUtil; +import java.util.List +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.util.EntityUtil import org.apache.ofbiz.entity.transaction.* -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.base.util.string.*; -import org.apache.ofbiz.content.content.*; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.ofbiz.entity.util.EntityUtilProperties; - -int minFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.min.fontsize", 0).intValue(); -int maxFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.max.fontsize", 0).intValue(); -int limitTagCloud = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.limit", 0).intValue(); +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.base.util.string.* +import org.apache.ofbiz.content.content.* +import org.apache.commons.lang.StringEscapeUtils +import org.apache.ofbiz.entity.util.EntityUtilProperties + +int minFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.min.fontsize", 0).intValue() +int maxFontSize = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.max.fontsize", 0).intValue() +int limitTagCloud = EntityUtilProperties.getPropertyAsInteger("ecommerce", "tagcloud.limit", 0).intValue() -tagCloudList = [] as LinkedList; -tagList = [] as LinkedList; +tagCloudList = [] as LinkedList +tagList = [] as LinkedList productKeywords = select("keyword", "keywordTypeId", "statusId") .from("ProductKeyword") .where(keywordTypeId : "KWT_TAG", statusId : "KW_APPROVED") .orderBy("keyword") .distinct(true) - .queryList(); + .queryList() if (UtilValidate.isNotEmpty(productKeywords)) { productKeywords.each { productKeyword -> - productTags = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryList(); - searchResult = [:]; - searchResult.tag = productKeyword.keyword; - searchResult.countTag = productTags.size(); - tagList.add(searchResult); + productTags = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryList() + searchResult = [:] + searchResult.tag = productKeyword.keyword + searchResult.countTag = productTags.size() + tagList.add(searchResult) } } if (tagList) { - int tag = 0; - tagList.sort{ a,b -> b.countTag <=> a.countTag }; + int tag = 0 + tagList.sort{ a,b -> b.countTag <=> a.countTag } if (tagList.size() < limitTagCloud) { - limitTagCloud = tagList.size(); + limitTagCloud = tagList.size() } - int maxResult = tagList[0].countTag; - int minResult = tagList[limitTagCloud - 1].countTag; + int maxResult = tagList[0].countTag + int minResult = tagList[limitTagCloud - 1].countTag tagList.each { tagCloud -> if (tag < limitTagCloud) { - tagCloudOfbizInfo = [:]; - double weight = 0; + tagCloudOfbizInfo = [:] + double weight = 0 if ((maxResult - minResult) > 0) { - weight = (tagCloud.countTag - minResult) / (maxResult - minResult); + weight = (tagCloud.countTag - minResult) / (maxResult - minResult) } - double fontSize = minFontSize + ((maxFontSize - minFontSize) * weight); - tagCloudOfbizInfo.tag = tagCloud.tag; - tagCloudOfbizInfo.fontSize = fontSize; - tagCloudList.add(tagCloudOfbizInfo); - tag++; + double fontSize = minFontSize + ((maxFontSize - minFontSize) * weight) + tagCloudOfbizInfo.tag = tagCloud.tag + tagCloudOfbizInfo.fontSize = fontSize + tagCloudList.add(tagCloudOfbizInfo) + tag++ } } } tagCloudList = tagCloudList.sort{it.tag} -context.tagCloudList = tagCloudList; +context.tagCloudList = tagCloudList |
Free forum by Nabble | Edit this page |