Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/catalog/ProductCategories.groovy Wed Nov 2 19:09:13 2016 @@ -21,74 +21,74 @@ * This script is also referenced by the ecommerce's screens and * should not contain order component's specific code. */ -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.util.EntityUtil -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.product.category.*; -import org.apache.ofbiz.entity.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.category.* +import org.apache.ofbiz.entity.* List fillTree(rootCat ,CatLvl, parentCategoryId) { if(rootCat) { rootCat.sort{ it.productCategoryId } - def listTree = []; + def listTree = [] for(root in rootCat) { - preCatChilds = from("ProductCategoryRollup").where("parentProductCategoryId", root.productCategoryId).queryList(); - catChilds = EntityUtil.getRelated("CurrentProductCategory",null,preCatChilds,false); - def childList = []; + preCatChilds = from("ProductCategoryRollup").where("parentProductCategoryId", root.productCategoryId).queryList() + catChilds = EntityUtil.getRelated("CurrentProductCategory",null,preCatChilds,false) + def childList = [] // CatLvl uses for identify the Category level for display different css class if(catChilds) { if(CatLvl==2) - childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+'/'+root.productCategoryId); + childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+'/'+root.productCategoryId) // replaceAll and '/' uses for fix bug in the breadcrum for href of category else if(CatLvl==1) - childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+root.productCategoryId); + childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+root.productCategoryId) else - childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId); + childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId) } - productsInCat = from("ProductCategoryAndMember").where("productCategoryId", root.productCategoryId).queryList(); + productsInCat = from("ProductCategoryAndMember").where("productCategoryId", root.productCategoryId).queryList() // Display the category if this category containing products or contain the category that's containing products if(productsInCat || childList) { - def rootMap = [:]; - category = from("ProductCategory").where("productCategoryId", root.productCategoryId).queryOne(); - categoryContentWrapper = new CategoryContentWrapper(category, request); - context.title = categoryContentWrapper.get("CATEGORY_NAME", "html"); - categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html"); + def rootMap = [:] + category = from("ProductCategory").where("productCategoryId", root.productCategoryId).queryOne() + categoryContentWrapper = new CategoryContentWrapper(category, request) + context.title = categoryContentWrapper.get("CATEGORY_NAME", "html") + categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html") if(categoryContentWrapper.get("CATEGORY_NAME", "html").toString()) - rootMap["categoryName"] = categoryContentWrapper.get("CATEGORY_NAME", "html"); + rootMap["categoryName"] = categoryContentWrapper.get("CATEGORY_NAME", "html") else - rootMap["categoryName"] = root.categoryName; + rootMap["categoryName"] = root.categoryName if(categoryContentWrapper.get("DESCRIPTION", "html").toString()) - rootMap["categoryDescription"] = categoryContentWrapper.get("DESCRIPTION", "html"); + rootMap["categoryDescription"] = categoryContentWrapper.get("DESCRIPTION", "html") else - rootMap["categoryDescription"] = root.description; + rootMap["categoryDescription"] = root.description - rootMap["productCategoryId"] = root.productCategoryId; - rootMap["parentCategoryId"] = parentCategoryId; - rootMap["child"] = childList; + rootMap["productCategoryId"] = root.productCategoryId + rootMap["parentCategoryId"] = parentCategoryId + rootMap["child"] = childList - listTree.add(rootMap); + listTree.add(rootMap) } } - return listTree; + return listTree } } -CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true); -curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: ""; -request.setAttribute("curCategoryId", curCategoryId); -CategoryWorker.setTrail(request, curCategoryId); +CategoryWorker.getRelatedCategories(request, "topLevelList", CatalogWorker.getCatalogTopCategoryId(request, CatalogWorker.getCurrentCatalogId(request)), true) +curCategoryId = parameters.category_id ?: parameters.CATEGORY_ID ?: "" +request.setAttribute("curCategoryId", curCategoryId) +CategoryWorker.setTrail(request, curCategoryId) -categoryList = request.getAttribute("topLevelList"); +categoryList = request.getAttribute("topLevelList") if (categoryList) { - catContentWrappers = [:]; - CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request); - context.catContentWrappers = catContentWrappers; - completedTree = fillTree(categoryList, 1, ""); - context.completedTree = completedTree; + catContentWrappers = [:] + CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request) + context.catContentWrappers = catContentWrappers + completedTree = fillTree(categoryList, 1, "") + context.completedTree = completedTree } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/AdvancedSearchPrep.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.product.catalog.*; -import org.apache.ofbiz.product.feature.*; -import org.apache.ofbiz.product.product.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.feature.* +import org.apache.ofbiz.product.product.* -productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000); -productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet())); +productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000) +productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet())) -searchOperator = parameters.SEARCH_OPERATOR; +searchOperator = parameters.SEARCH_OPERATOR if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) { - searchOperator = "OR"; + searchOperator = "OR" } -searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator); -searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request); +searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator) +searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request) -context.productFeaturesByTypeMap = productFeaturesByTypeMap; -context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered; -context.searchOperator = searchOperator; -context.searchConstraintStrings = searchConstraintStrings; -context.searchSortOrderString = searchSortOrderString; +context.productFeaturesByTypeMap = productFeaturesByTypeMap +context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered +context.searchOperator = searchOperator +context.searchConstraintStrings = searchConstraintStrings +context.searchSortOrderString = searchSortOrderString Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/ContentPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,4 +17,4 @@ * under the License. */ -context.contentId = parameters.cid ?: parameters.contentId; +context.contentId = parameters.cid ?: parameters.contentId Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Mrv.groovy Wed Nov 2 19:09:13 2016 @@ -17,54 +17,54 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.base.util.collections.LifoSet; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.base.util.collections.LifoSet -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -entityName = "ContentDataResourceView"; -lookupCaches = session.getAttribute("lookupCaches"); +entityName = "ContentDataResourceView" +lookupCaches = session.getAttribute("lookupCaches") if (!lookupCaches) { - lookupCaches = [:]; - session.setAttribute("lookupCaches", lookupCaches); + lookupCaches = [:] + session.setAttribute("lookupCaches", lookupCaches) } -lifoSet = lookupCaches[entityName]; +lifoSet = lookupCaches[entityName] if (!lifoSet) { - lifoSet = new LifoSet(10); - lookupCaches.ContentAssocDataResourceViewFrom = lifoSet; + lifoSet = new LifoSet(10) + lookupCaches.ContentAssocDataResourceViewFrom = lifoSet } -sz = lifoSet.size(); -contentIdKey = null; -mrvList = []; +sz = lifoSet.size() +contentIdKey = null +mrvList = [] lifoSet.each { pk0 -> - pk = pk0.getPrimaryKey(); - gv = from(pk.getEntityName()).where(pk).cache(true).queryOne(); + pk = pk0.getPrimaryKey() + gv = from(pk.getEntityName()).where(pk).cache(true).queryOne() if (gv) { - arr = [gv.contentId, gv.contentName] as String[]; - mrvList.add(arr); + arr = [gv.contentId, gv.contentName] as String[] + mrvList.add(arr) } else { // should handle errors in some other way; this does not provide any tracing; impossible to locat // where the error actually occurred - //Debug.logError("findOne on " + pk + " returned null"); + //Debug.logError("findOne on " + pk + " returned null") } } -context.put("mrvList", mrvList); +context.put("mrvList", mrvList) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Search.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Search.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Search.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/content/Search.groovy Wed Nov 2 19:09:13 2016 @@ -31,74 +31,74 @@ import org.apache.lucene.search.* import org.apache.lucene.index.DirectoryReader import org.apache.lucene.store.Directory -paramMap = UtilHttp.getParameterMap(request); -queryLine = paramMap.queryLine.toString(); -//Debug.logInfo("in search, queryLine:" + queryLine, ""); - -siteId = paramMap.siteId ?: "WebStoreCONTENT"; -//Debug.logInfo("in search, siteId:" + siteId, ""); -featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap); -//Debug.logInfo("in search, featureIdByType:" + featureIdByType, ""); - -combQuery = new BooleanQuery(); -Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath()); -DirectoryReader reader = DirectoryReader.open(directory); -IndexSearcher searcher = null; -Analyzer analyzer = null; +paramMap = UtilHttp.getParameterMap(request) +queryLine = paramMap.queryLine.toString() +//Debug.logInfo("in search, queryLine:" + queryLine, "") + +siteId = paramMap.siteId ?: "WebStoreCONTENT" +//Debug.logInfo("in search, siteId:" + siteId, "") +featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap) +//Debug.logInfo("in search, featureIdByType:" + featureIdByType, "") + +combQuery = new BooleanQuery() +Directory directory = FSDirectory.open(new File(SearchWorker.getIndexPath("content")).toPath()) +DirectoryReader reader = DirectoryReader.open(directory) +IndexSearcher searcher = null +Analyzer analyzer = null try { - searcher = new IndexSearcher(reader); - analyzer = new StandardAnalyzer(); + searcher = new IndexSearcher(reader) + analyzer = new StandardAnalyzer() } catch (java.io.FileNotFoundException e) { - Debug.logError(e, "Search.groovy"); - request.setAttribute("errorMsgReq", "No index file exists."); + Debug.logError(e, "Search.groovy") + request.setAttribute("errorMsgReq", "No index file exists.") } -termQuery = new TermQuery(new Term("site", siteId.toString())); -combQuery.add(termQuery, BooleanClause.Occur.MUST); -//Debug.logInfo("in search, termQuery:" + termQuery.toString(), ""); +termQuery = new TermQuery(new Term("site", siteId.toString())) +combQuery.add(termQuery, BooleanClause.Occur.MUST) +//Debug.logInfo("in search, termQuery:" + termQuery.toString(), "") -//Debug.logInfo("in search, combQuery(1):" + combQuery, ""); +//Debug.logInfo("in search, combQuery(1):" + combQuery, "") if (queryLine && analyzer) { - Query query = null; - QueryParser parser = new QueryParser("content", analyzer); - query = parser.parse(queryLine); - combQuery.add(query, BooleanClause.Occur.MUST); + Query query = null + QueryParser parser = new QueryParser("content", analyzer) + query = parser.parse(queryLine) + combQuery.add(query, BooleanClause.Occur.MUST) } if (featureIdByType) { - featureQuery = new BooleanQuery(); - featuresRequired = BooleanClause.Occur.MUST; + featureQuery = new BooleanQuery() + featuresRequired = BooleanClause.Occur.MUST if ("any".equals(paramMap.anyOrAll)) { - featuresRequired = BooleanClause.Occur.SHOULD; + featuresRequired = BooleanClause.Occur.SHOULD } if (featureIdByType) { featureIdByType.each { key, value -> - termQuery = new TermQuery(new Term("feature", value)); - featureQuery.add(termQuery, featuresRequired); - //Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), ""); + termQuery = new TermQuery(new Term("feature", value)) + featureQuery.add(termQuery, featuresRequired) + //Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), "") } } - combQuery.add(featureQuery, featuresRequired); + combQuery.add(featureQuery, featuresRequired) } if (searcher) { - Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), ""); - TopScoreDocCollector collector = TopScoreDocCollector.create(100); //defaulting to 100 results - searcher.search(combQuery, collector); - ScoreDoc[] hits = collector.topDocs().scoreDocs; - Debug.logInfo("in search, hits:" + collector.getTotalHits(), ""); + Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), "") + TopScoreDocCollector collector = TopScoreDocCollector.create(100) //defaulting to 100 results + searcher.search(combQuery, collector) + ScoreDoc[] hits = collector.topDocs().scoreDocs + Debug.logInfo("in search, hits:" + collector.getTotalHits(), "") - contentList = [] as ArrayList; - hitSet = [:] as HashSet; + contentList = [] as ArrayList + hitSet = [:] as HashSet for (int start = 0; start < collector.getTotalHits(); start++) { Document doc = searcher.doc(hits[start].doc) - contentId = doc.get("contentId"); - content = from("Content").where("contentId", contentId).cache(true).queryOne(); + contentId = doc.get("contentId") + content = from("Content").where("contentId", contentId).cache(true).queryOne() if (!hitSet.contains(contentId)) { - contentList.add(content); - hitSet.add(contentId); + contentList.add(content) + hitSet.add(contentId) } } - context.queryResults = contentList; + context.queryResults = contentList } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ChangePassword.groovy Wed Nov 2 19:09:13 2016 @@ -17,21 +17,21 @@ * under the License. */ -import java.util.HashMap; -import org.apache.ofbiz.base.util.UtilHttp; +import java.util.HashMap +import org.apache.ofbiz.base.util.UtilHttp -tryEntity = true; -errorMessage = parameters._ERROR_MESSAGE_; +tryEntity = true +errorMessage = parameters._ERROR_MESSAGE_ if (errorMessage) { - tryEntity = false; + tryEntity = false } -donePage = parameters.DONE_PAGE ?: "viewprofile"; +donePage = parameters.DONE_PAGE ?: "viewprofile" -userLoginData = userLogin; -if (!tryEntity) userLoginData = UtilHttp.getParameterMap(request); -if (!userLoginData) userLoginData = [:]; +userLoginData = userLogin +if (!tryEntity) userLoginData = UtilHttp.getParameterMap(request) +if (!userLoginData) userLoginData = [:] -context.donePage = donePage; -context.userLoginData = userLoginData; +context.donePage = donePage +context.userLoginData = userLoginData Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ContactList.groovy Wed Nov 2 19:09:13 2016 @@ -17,44 +17,44 @@ * under the License. */ -import java.lang.*; -import java.util.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.party.contact.ContactMechWorker; -import org.apache.ofbiz.product.store.ProductStoreWorker; -import org.apache.ofbiz.webapp.website.WebSiteWorker; -import org.apache.ofbiz.accounting.payment.PaymentWorker; +import java.lang.* +import java.util.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.party.contact.ContactMechWorker +import org.apache.ofbiz.product.store.ProductStoreWorker +import org.apache.ofbiz.webapp.website.WebSiteWorker +import org.apache.ofbiz.accounting.payment.PaymentWorker -/*publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"], false); +/*publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"], false) context.publicEmailContactLists = publicEmailContactLists;*/ -webSiteId = WebSiteWorker.getWebSiteId(request); -exprList = []; -exprListThruDate = []; -exprList.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId)); -exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)); -exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.nowTimestamp())); -orCond = EntityCondition.makeCondition(exprListThruDate, EntityOperator.OR); -exprList.add(orCond); -webSiteContactList = from("WebSiteContactList").where(exprList).queryList(); +webSiteId = WebSiteWorker.getWebSiteId(request) +exprList = [] +exprListThruDate = [] +exprList.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId)) +exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)) +exprListThruDate.add(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, UtilDateTime.nowTimestamp())) +orCond = EntityCondition.makeCondition(exprListThruDate, EntityOperator.OR) +exprList.add(orCond) +webSiteContactList = from("WebSiteContactList").where(exprList).queryList() -publicEmailContactLists = []; +publicEmailContactLists = [] webSiteContactList.each { webSiteContactList -> - contactList = webSiteContactList.getRelatedOne("ContactList", false); - contactListType = contactList.getRelatedOne("ContactListType", false); - temp = [:]; - temp.contactList = contactList; - temp.contactListType = contactListType; - publicEmailContactLists.add(temp); + contactList = webSiteContactList.getRelatedOne("ContactList", false) + contactListType = contactList.getRelatedOne("ContactListType", false) + temp = [:] + temp.contactList = contactList + temp.contactListType = contactListType + publicEmailContactLists.add(temp) } -context.publicEmailContactLists = publicEmailContactLists; +context.publicEmailContactLists = publicEmailContactLists if (userLogin) { - partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId, "contactMechTypeId", "EMAIL_ADDRESS").orderBy("-fromDate").filterByDate().queryList(); - context.partyAndContactMechList = partyAndContactMechList; + partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId, "contactMechTypeId", "EMAIL_ADDRESS").orderBy("-fromDate").filterByDate().queryList() + context.partyAndContactMechList = partyAndContactMechList } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerReviews.groovy Wed Nov 2 19:09:13 2016 @@ -22,7 +22,7 @@ import org.apache.ofbiz.entity.condition // get the product review(s) for the given user if (userLogin) { - reviews = from("ProductReview").where("userLoginId", userLogin.userLoginId).cache(true).queryList(); + reviews = from("ProductReview").where("userLoginId", userLogin.userLoginId).cache(true).queryList() - context.reviews = reviews; + context.reviews = reviews } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/CustomerSurvey.groovy Wed Nov 2 19:09:13 2016 @@ -17,30 +17,30 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.Delegator; -import org.apache.ofbiz.entity.GenericValue; -import org.apache.ofbiz.product.store.ProductStoreSurveyWrapper; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.Delegator +import org.apache.ofbiz.entity.GenericValue +import org.apache.ofbiz.product.store.ProductStoreSurveyWrapper -partyId = userLogin.partyId; -paramMap = UtilHttp.getParameterMap(request); +partyId = userLogin.partyId +paramMap = UtilHttp.getParameterMap(request) -productStoreSurveyId = parameters.productStoreSurveyId; +productStoreSurveyId = parameters.productStoreSurveyId -surveyAppl = from("ProductStoreSurveyAppl").where("productStoreSurveyId", productStoreSurveyId).queryOne(); +surveyAppl = from("ProductStoreSurveyAppl").where("productStoreSurveyId", productStoreSurveyId).queryOne() if (surveyAppl) { - survey = surveyAppl.getRelatedOne("Survey", false); - context.survey = survey; + survey = surveyAppl.getRelatedOne("Survey", false) + context.survey = survey if (!parameters._ERROR_MESSAGE_) { - paramMap = [productStoreSurveyId : productStoreSurveyId]; + paramMap = [productStoreSurveyId : productStoreSurveyId] } - wrapper = new ProductStoreSurveyWrapper(surveyAppl, partyId, paramMap); - context.surveyWrapper = wrapper; + wrapper = new ProductStoreSurveyWrapper(surveyAppl, partyId, paramMap) + context.surveyWrapper = wrapper - surveyResp = parameters.surveyResponseId; + surveyResp = parameters.surveyResponseId if (surveyResp) { - wrapper.setThisResponseId(surveyResp); - wrapper.callResult(true); + wrapper.setThisResponseId(surveyResp) + wrapper.callResult(true) } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditBillingAddress.groovy Wed Nov 2 19:09:13 2016 @@ -17,67 +17,67 @@ * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.party.contact.ContactHelper; -import org.apache.ofbiz.entity.condition.EntityCondition; +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.party.contact.ContactHelper +import org.apache.ofbiz.entity.condition.EntityCondition if (userLogin) { - party = userLogin.getRelatedOne("Party", false); - contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "BILLING_LOCATION", "POSTAL_ADDRESS", false)); + party = userLogin.getRelatedOne("Party", false) + contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "BILLING_LOCATION", "POSTAL_ADDRESS", false)) if (contactMech) { - postalAddress = contactMech.getRelatedOne("PostalAddress", false); - billToContactMechId = postalAddress.contactMechId; - context.billToContactMechId = billToContactMechId; - context.billToName = postalAddress.toName; - context.billToAttnName = postalAddress.attnName; - context.billToAddress1 = postalAddress.address1; - context.billToAddress2 = postalAddress.address2; - context.billToCity = postalAddress.city; - context.billToPostalCode = postalAddress.postalCode; - context.billToStateProvinceGeoId = postalAddress.stateProvinceGeoId; - context.billToCountryGeoId = postalAddress.countryGeoId; - billToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne(); + postalAddress = contactMech.getRelatedOne("PostalAddress", false) + billToContactMechId = postalAddress.contactMechId + context.billToContactMechId = billToContactMechId + context.billToName = postalAddress.toName + context.billToAttnName = postalAddress.attnName + context.billToAddress1 = postalAddress.address1 + context.billToAddress2 = postalAddress.address2 + context.billToCity = postalAddress.city + context.billToPostalCode = postalAddress.postalCode + context.billToStateProvinceGeoId = postalAddress.stateProvinceGeoId + context.billToCountryGeoId = postalAddress.countryGeoId + billToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne() if (billToStateProvinceGeo) { - context.billToStateProvinceGeo = billToStateProvinceGeo.geoName; + context.billToStateProvinceGeo = billToStateProvinceGeo.geoName } - billToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne(); + billToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne() if (billToCountryProvinceGeo) { - context.billToCountryProvinceGeo = billToCountryProvinceGeo.geoName; + context.billToCountryProvinceGeo = billToCountryProvinceGeo.geoName } - creditCards = []; - paymentMethod = from("PaymentMethod").where("partyId", party.partyId, "paymentMethodTypeId", "CREDIT_CARD").orderBy("fromDate").filterByDate().queryFirst(); + creditCards = [] + paymentMethod = from("PaymentMethod").where("partyId", party.partyId, "paymentMethodTypeId", "CREDIT_CARD").orderBy("fromDate").filterByDate().queryFirst() if (paymentMethod) { - creditCard = paymentMethod.getRelatedOne("CreditCard", false); - context.paymentMethodTypeId = "CREDIT_CARD"; - context.cardNumber = creditCard.cardNumber; - context.cardType = creditCard.cardType; - context.paymentMethodId = creditCard.paymentMethodId; - context.firstNameOnCard = creditCard.firstNameOnCard; - context.lastNameOnCard = creditCard.lastNameOnCard; - context.expMonth = (creditCard.expireDate).substring(0, 2); - context.expYear = (creditCard.expireDate).substring(3); + creditCard = paymentMethod.getRelatedOne("CreditCard", false) + context.paymentMethodTypeId = "CREDIT_CARD" + context.cardNumber = creditCard.cardNumber + context.cardType = creditCard.cardType + context.paymentMethodId = creditCard.paymentMethodId + context.firstNameOnCard = creditCard.firstNameOnCard + context.lastNameOnCard = creditCard.lastNameOnCard + context.expMonth = (creditCard.expireDate).substring(0, 2) + context.expYear = (creditCard.expireDate).substring(3) } if (shipToContactMechId) { if (billToContactMechId && billToContactMechId.equals(shipToContactMechId)) { - context.useShippingAddressForBilling = "Y"; + context.useShippingAddressForBilling = "Y" } } } billToContactMechList = ContactHelper.getContactMech(party, "PHONE_BILLING", "TELECOM_NUMBER", false) if (billToContactMechList) { - billToTelecomNumber = (EntityUtil.getFirst(billToContactMechList)).getRelatedOne("TelecomNumber", false); - pcm = EntityUtil.getFirst(billToTelecomNumber.getRelated("PartyContactMech", null, null, false)); - context.billToTelecomNumber = billToTelecomNumber; - context.billToExtension = pcm.extension; + billToTelecomNumber = (EntityUtil.getFirst(billToContactMechList)).getRelatedOne("TelecomNumber", false) + pcm = EntityUtil.getFirst(billToTelecomNumber.getRelated("PartyContactMech", null, null, false)) + context.billToTelecomNumber = billToTelecomNumber + context.billToExtension = pcm.extension } billToFaxNumberList = ContactHelper.getContactMech(party, "FAX_BILLING", "TELECOM_NUMBER", false) if (billToFaxNumberList) { - billToFaxNumber = (EntityUtil.getFirst(billToFaxNumberList)).getRelatedOne("TelecomNumber", false); - faxPartyContactMech = EntityUtil.getFirst(billToFaxNumber.getRelated("PartyContactMech", null, null, false)); - context.billToFaxNumber = billToFaxNumber; - context.billToFaxExtension = faxPartyContactMech.extension; + billToFaxNumber = (EntityUtil.getFirst(billToFaxNumberList)).getRelatedOne("TelecomNumber", false) + faxPartyContactMech = EntityUtil.getFirst(billToFaxNumber.getRelated("PartyContactMech", null, null, false)) + context.billToFaxNumber = billToFaxNumber + context.billToFaxExtension = faxPartyContactMech.extension } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditContactMech.groovy Wed Nov 2 19:09:13 2016 @@ -17,87 +17,87 @@ * under the License. */ -import java.util.HashMap; -import org.apache.ofbiz.party.contact.ContactMechWorker; -import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.base.util.UtilMisc; +import java.util.HashMap +import org.apache.ofbiz.party.contact.ContactMechWorker +import org.apache.ofbiz.base.util.UtilHttp +import org.apache.ofbiz.base.util.UtilMisc /* puts the following in the context: "contactMech", "contactMechId", "partyContactMech", "partyContactMechPurposes", "contactMechTypeId", "contactMechType", "purposeTypes", "postalAddress", "telecomNumber", "requestName", "donePage", "tryEntity", "contactMechTypes" */ -target = [:]; -ContactMechWorker.getContactMechAndRelated(request, userLogin.partyId, target); -context.putAll(target); +target = [:] +ContactMechWorker.getContactMechAndRelated(request, userLogin.partyId, target) +context.putAll(target) if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && !context.partyContactMech && context.contactMech) { - context.canNotView = true; + context.canNotView = true } else { - context.canNotView = false; + context.canNotView = false } -preContactMechTypeId = parameters.preContactMechTypeId; -if (preContactMechTypeId) context.preContactMechTypeId = preContactMechTypeId; +preContactMechTypeId = parameters.preContactMechTypeId +if (preContactMechTypeId) context.preContactMechTypeId = preContactMechTypeId -paymentMethodId = parameters.paymentMethodId; -if (paymentMethodId) context.paymentMethodId = paymentMethodId; +paymentMethodId = parameters.paymentMethodId +if (paymentMethodId) context.paymentMethodId = paymentMethodId -cmNewPurposeTypeId = parameters.contactMechPurposeTypeId; +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId if (cmNewPurposeTypeId) { - contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne(); + contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne() if (contactMechPurposeType) { - context.contactMechPurposeType = contactMechPurposeType; + context.contactMechPurposeType = contactMechPurposeType } else { - cmNewPurposeTypeId = null; + cmNewPurposeTypeId = null } - context.cmNewPurposeTypeId = cmNewPurposeTypeId; + context.cmNewPurposeTypeId = cmNewPurposeTypeId } -tryEntity = context.tryEntity; +tryEntity = context.tryEntity -contactMechData = context.contactMech; -if (!tryEntity) contactMechData = parameters; -if (!contactMechData) contactMechData = [:]; -if (contactMechData) context.contactMechData = contactMechData; - -partyContactMechData = context.partyContactMech; -if (!tryEntity) partyContactMechData = parameters; -if (!partyContactMechData) partyContactMechData = [:]; -if (partyContactMechData) context.partyContactMechData = partyContactMechData; - -postalAddressData = context.postalAddress; -if (!tryEntity) postalAddressData = parameters; -if (!postalAddressData) postalAddressData = [:]; -if (postalAddressData) context.postalAddressData = postalAddressData; - -telecomNumberData = context.telecomNumber; -if (!tryEntity) telecomNumberData = parameters; -if (!telecomNumberData) telecomNumberData = [:]; -if (telecomNumberData) context.telecomNumberData = telecomNumberData; +contactMechData = context.contactMech +if (!tryEntity) contactMechData = parameters +if (!contactMechData) contactMechData = [:] +if (contactMechData) context.contactMechData = contactMechData + +partyContactMechData = context.partyContactMech +if (!tryEntity) partyContactMechData = parameters +if (!partyContactMechData) partyContactMechData = [:] +if (partyContactMechData) context.partyContactMechData = partyContactMechData + +postalAddressData = context.postalAddress +if (!tryEntity) postalAddressData = parameters +if (!postalAddressData) postalAddressData = [:] +if (postalAddressData) context.postalAddressData = postalAddressData + +telecomNumberData = context.telecomNumber +if (!tryEntity) telecomNumberData = parameters +if (!telecomNumberData) telecomNumberData = [:] +if (telecomNumberData) context.telecomNumberData = telecomNumberData // load the geo names for selected countries and states/regions if (parameters.countryGeoId) { - geoValue = from("Geo").where("geoId", parameters.countryGeoId).cache(true).queryOne(); + geoValue = from("Geo").where("geoId", parameters.countryGeoId).cache(true).queryOne() if (geoValue) { - context.selectedCountryName = geoValue.geoName; + context.selectedCountryName = geoValue.geoName } } else if (postalAddressData?.countryGeoId) { - geoValue = from("Geo").where("geoId", postalAddressData.countryGeoId).cache(true).queryOne(); + geoValue = from("Geo").where("geoId", postalAddressData.countryGeoId).cache(true).queryOne() if (geoValue) { - context.selectedCountryName = geoValue.geoName; + context.selectedCountryName = geoValue.geoName } } if (parameters.stateProvinceGeoId) { - geoValue = from("Geo").where("geoId", parameters.stateProvinceGeoId).cache(true).queryOne(); + geoValue = from("Geo").where("geoId", parameters.stateProvinceGeoId).cache(true).queryOne() if (geoValue) { - context.selectedStateName = geoValue.geoId; + context.selectedStateName = geoValue.geoId } } else if (postalAddressData?.stateProvinceGeoId) { - geoValue = from("Geo").where("geoId", postalAddressData.stateProvinceGeoId).cache(true).queryOne(); + geoValue = from("Geo").where("geoId", postalAddressData.stateProvinceGeoId).cache(true).queryOne() if (geoValue) { - context.selectedStateName = geoValue.geoId; + context.selectedStateName = geoValue.geoId } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditEmailAndTelecomNumber.groovy Wed Nov 2 19:09:13 2016 @@ -17,28 +17,28 @@ * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.party.contact.ContactHelper; +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.party.contact.ContactHelper if (userLogin) { - party = userLogin.getRelatedOne("Party", false); + party = userLogin.getRelatedOne("Party", false) - contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false)); + contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false)) if (contactMech) { - context.emailContactMechId = contactMech.contactMechId; - context.emailAddress = contactMech.infoString; + context.emailContactMechId = contactMech.contactMechId + context.emailAddress = contactMech.infoString } - contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false)); + contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false)) if (contactMech) { - partyContactMech = from("PartyContactMech").where("partyId", party.partyId, "contactMechId", contactMech.contactMechId).filterByDate().queryFirst(); + partyContactMech = from("PartyContactMech").where("partyId", party.partyId, "contactMechId", contactMech.contactMechId).filterByDate().queryFirst() if (partyContactMech) { - telecomNumber = partyContactMech.getRelatedOne("TelecomNumber", false); - context.phoneContactMechId = telecomNumber.contactMechId; - context.countryCode = telecomNumber.countryCode; - context.areaCode = telecomNumber.areaCode; - context.contactNumber = telecomNumber.contactNumber; - context.extension = partyContactMech.extension; + telecomNumber = partyContactMech.getRelatedOne("TelecomNumber", false) + context.phoneContactMechId = telecomNumber.contactMechId + context.countryCode = telecomNumber.countryCode + context.areaCode = telecomNumber.areaCode + context.contactNumber = telecomNumber.contactNumber + context.extension = partyContactMech.extension } } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPaymentMethod.groovy Wed Nov 2 19:09:13 2016 @@ -17,48 +17,48 @@ * under the License. */ -import java.util.HashMap; -import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.accounting.payment.PaymentWorker; -import org.apache.ofbiz.party.contact.ContactMechWorker; +import java.util.HashMap +import org.apache.ofbiz.base.util.UtilHttp +import org.apache.ofbiz.accounting.payment.PaymentWorker +import org.apache.ofbiz.party.contact.ContactMechWorker -paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, userLogin.partyId); +paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, userLogin.partyId) //returns the following: "paymentMethod", "creditCard", "giftCard", "eftAccount", "paymentMethodId", "curContactMechId", "donePage", "tryEntity" -context.putAll(paymentResults); +context.putAll(paymentResults) -curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, userLogin.partyId, paymentResults.curContactMechId); +curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, userLogin.partyId, paymentResults.curContactMechId) //returns the following: "curPartyContactMech", "curContactMech", "curPostalAddress", "curPartyContactMechPurposes" -context.putAll(curPostalAddressResults); +context.putAll(curPostalAddressResults) -postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, userLogin.partyId, paymentResults.curContactMechId); -context.put("postalAddressInfos", postalAddressInfos); +postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, userLogin.partyId, paymentResults.curContactMechId) +context.put("postalAddressInfos", postalAddressInfos) //prepare "Data" maps for filling form input boxes -tryEntity = paymentResults.tryEntity; +tryEntity = paymentResults.tryEntity -creditCardData = paymentResults.creditCard; -if (!tryEntity) creditCardData = parameters; -if (!creditCardData) creditCardData = [:]; -if (creditCardData) context.creditCardData = creditCardData; - -giftCardData = paymentResults.giftCard; -if (!tryEntity) giftCardData = parameters; -if (!giftCardData) giftCardData = [:]; -if (giftCardData) context.giftCardData = giftCardData; - -eftAccountData = paymentResults.eftAccount; -if (!tryEntity) eftAccountData = parameters; -if (!eftAccountData) eftAccountData = [:]; -if (eftAccountData) context.eftAccountData = eftAccountData; - -paymentMethodData = paymentResults.paymentMethod; -if (!tryEntity) paymentMethodData = parameters; -if (!paymentMethodData) paymentMethodData = [:]; -if (paymentMethodData) context.paymentMethodData = paymentMethodData; +creditCardData = paymentResults.creditCard +if (!tryEntity) creditCardData = parameters +if (!creditCardData) creditCardData = [:] +if (creditCardData) context.creditCardData = creditCardData + +giftCardData = paymentResults.giftCard +if (!tryEntity) giftCardData = parameters +if (!giftCardData) giftCardData = [:] +if (giftCardData) context.giftCardData = giftCardData + +eftAccountData = paymentResults.eftAccount +if (!tryEntity) eftAccountData = parameters +if (!eftAccountData) eftAccountData = [:] +if (eftAccountData) context.eftAccountData = eftAccountData + +paymentMethodData = paymentResults.paymentMethod +if (!tryEntity) paymentMethodData = parameters +if (!paymentMethodData) paymentMethodData = [:] +if (paymentMethodData) context.paymentMethodData = paymentMethodData //prepare security flag if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && (context.creditCard || context.giftCard || context.eftAccount) && context.paymentMethod && !userLogin.partyId.equals(context.paymentMethod.partyId)) { - context.canNotView = true; + context.canNotView = true } else { - context.canNotView = false; + context.canNotView = false } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditPerson.groovy Wed Nov 2 19:09:13 2016 @@ -17,16 +17,16 @@ * under the License. */ -import java.util.HashMap; -import org.apache.ofbiz.base.util.UtilHttp; +import java.util.HashMap +import org.apache.ofbiz.base.util.UtilHttp -tryEntity = true; -errorMessage = parameters._ERROR_MESSAGE_; +tryEntity = true +errorMessage = parameters._ERROR_MESSAGE_ if (errorMessage) { - tryEntity = false; + tryEntity = false } -personData = person; -if (!tryEntity) personData = UtilHttp.getParameterMap(request); -if (!personData) personData = [:]; +personData = person +if (!tryEntity) personData = UtilHttp.getParameterMap(request) +if (!personData) personData = [:] -context.personData = personData; +context.personData = personData Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/EditShippingAddress.groovy Wed Nov 2 19:09:13 2016 @@ -17,60 +17,60 @@ * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.party.contact.ContactHelper; +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.party.contact.ContactHelper if (userLogin) { - party = userLogin.getRelatedOne("Party", false); + party = userLogin.getRelatedOne("Party", false) context.partyId = party.partyId if ("PERSON".equals(party.partyTypeId)) { - person = from("Person").where("partyId", party.partyId).queryOne(); - context.firstName = person.firstName; - context.lastName = person.lastName; + person = from("Person").where("partyId", party.partyId).queryOne() + context.firstName = person.firstName + context.lastName = person.lastName } else { - group = from("PartyGroup").where("partyId", party.partyId).queryOne(); - context.firstName = group.groupName; - context.lastName = ""; + group = from("PartyGroup").where("partyId", party.partyId).queryOne() + context.firstName = group.groupName + context.lastName = "" } - contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)); + contactMech = EntityUtil.getFirst(ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)) if (contactMech) { - postalAddress = contactMech.getRelatedOne("PostalAddress", false); - context.shipToContactMechId = postalAddress.contactMechId; + postalAddress = contactMech.getRelatedOne("PostalAddress", false) + context.shipToContactMechId = postalAddress.contactMechId - context.shipToName = postalAddress.toName; - context.shipToAttnName = postalAddress.attnName; - context.shipToAddress1 = postalAddress.address1; - context.shipToAddress2 = postalAddress.address2; - context.shipToCity = postalAddress.city; - context.shipToPostalCode = postalAddress.postalCode; - context.shipToStateProvinceGeoId = postalAddress.stateProvinceGeoId; - context.shipToCountryGeoId = postalAddress.countryGeoId; - shipToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne(); + context.shipToName = postalAddress.toName + context.shipToAttnName = postalAddress.attnName + context.shipToAddress1 = postalAddress.address1 + context.shipToAddress2 = postalAddress.address2 + context.shipToCity = postalAddress.city + context.shipToPostalCode = postalAddress.postalCode + context.shipToStateProvinceGeoId = postalAddress.stateProvinceGeoId + context.shipToCountryGeoId = postalAddress.countryGeoId + shipToStateProvinceGeo = from("Geo").where("geoId", postalAddress.stateProvinceGeoId).queryOne() if (shipToStateProvinceGeo) { - context.shipToStateProvinceGeo = shipToStateProvinceGeo.geoName; + context.shipToStateProvinceGeo = shipToStateProvinceGeo.geoName } - shipToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne(); + shipToCountryProvinceGeo = from("Geo").where("geoId", postalAddress.countryGeoId).queryOne() if (shipToCountryProvinceGeo) { - context.shipToCountryProvinceGeo = shipToCountryProvinceGeo.geoName; + context.shipToCountryProvinceGeo = shipToCountryProvinceGeo.geoName } } else { - context.shipToContactMechId = null; + context.shipToContactMechId = null } shipToContactMechList = ContactHelper.getContactMech(party, "PHONE_SHIPPING", "TELECOM_NUMBER", false) if (shipToContactMechList) { - shipToTelecomNumber = (EntityUtil.getFirst(shipToContactMechList)).getRelatedOne("TelecomNumber", false); - pcm = EntityUtil.getFirst(shipToTelecomNumber.getRelated("PartyContactMech", null, null, false)); - context.shipToTelecomNumber = shipToTelecomNumber; - context.shipToExtension = pcm.extension; + shipToTelecomNumber = (EntityUtil.getFirst(shipToContactMechList)).getRelatedOne("TelecomNumber", false) + pcm = EntityUtil.getFirst(shipToTelecomNumber.getRelated("PartyContactMech", null, null, false)) + context.shipToTelecomNumber = shipToTelecomNumber + context.shipToExtension = pcm.extension } shipToFaxNumberList = ContactHelper.getContactMech(party, "FAX_SHIPPING", "TELECOM_NUMBER", false) if (shipToFaxNumberList) { - shipToFaxNumber = (EntityUtil.getFirst(shipToFaxNumberList)).getRelatedOne("TelecomNumber", false); - faxPartyContactMech = EntityUtil.getFirst(shipToFaxNumber.getRelated("PartyContactMech", null, null, false)); - context.shipToFaxNumber = shipToFaxNumber; - context.shipToFaxExtension = faxPartyContactMech.extension; + shipToFaxNumber = (EntityUtil.getFirst(shipToFaxNumberList)).getRelatedOne("TelecomNumber", false) + faxPartyContactMech = EntityUtil.getFirst(shipToFaxNumber.getRelated("PartyContactMech", null, null, false)) + context.shipToFaxNumber = shipToFaxNumber + context.shipToFaxExtension = faxPartyContactMech.extension } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardBalance.groovy Wed Nov 2 19:09:13 2016 @@ -17,5 +17,5 @@ * under the License. */ - import org.apache.ofbiz.product.store.*; - context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true); + import org.apache.ofbiz.product.store.* + context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/GiftCardLink.groovy Wed Nov 2 19:09:13 2016 @@ -17,17 +17,17 @@ * under the License. */ -import org.apache.ofbiz.product.store.*; +import org.apache.ofbiz.product.store.* -processResult = parameters.processResult; +processResult = parameters.processResult if (processResult != null) { if (!processResult) { - request.setAttribute("_ERROR_MESSAGE_", "<li>There was a problem linking your cards. Please check the numbers and try again.</li>"); - request.removeAttribute("_EVENT_MESSAGE_"); + request.setAttribute("_ERROR_MESSAGE_", "<li>There was a problem linking your cards. Please check the numbers and try again.</li>") + request.removeAttribute("_EVENT_MESSAGE_") } else { - request.setAttribute("_EVENT_MESSAGE_", "<li>Thank-you. Your gift card account is now linked.</li>"); + request.setAttribute("_EVENT_MESSAGE_", "<li>Thank-you. Your gift card account is now linked.</li>") } } -context.userLogin = userLogin; -context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true); +context.userLogin = userLogin +context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/NewCustomer.groovy Wed Nov 2 19:09:13 2016 @@ -17,42 +17,42 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilProperties; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.product.store.ProductStoreWorker; - -productStore = ProductStoreWorker.getProductStore(request); -context.productStoreId = productStore.productStoreId; -context.productStore = productStore; +import org.apache.ofbiz.base.util.UtilProperties +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.product.store.ProductStoreWorker + +productStore = ProductStoreWorker.getProductStore(request) +context.productStoreId = productStore.productStoreId +context.productStore = productStore -context.createAllowPassword = "Y".equals(productStore.allowPassword); -context.getUsername = !"Y".equals(productStore.usePrimaryEmailUsername); +context.createAllowPassword = "Y".equals(productStore.allowPassword) +context.getUsername = !"Y".equals(productStore.usePrimaryEmailUsername) -previousParams = parameters._PREVIOUS_PARAMS_; +previousParams = parameters._PREVIOUS_PARAMS_ if (previousParams) { - previousParams = "?" + previousParams; + previousParams = "?" + previousParams } else { - previousParams = ""; + previousParams = "" } -context.previousParams = previousParams; +context.previousParams = previousParams //the parameters from janrain -userInfoMap = request.getAttribute("userInfoMap"); +userInfoMap = request.getAttribute("userInfoMap") if (!userInfoMap) { - userInfoMap = request.getSession().getAttribute("userInfoMap"); + userInfoMap = request.getSession().getAttribute("userInfoMap") } if (userInfoMap) { if (userInfoMap.givenName && userInfoMap.familyName) { - requestParameters.USER_FIRST_NAME = userInfoMap.givenName; - requestParameters.USER_LAST_NAME = userInfoMap.familyName; + requestParameters.USER_FIRST_NAME = userInfoMap.givenName + requestParameters.USER_LAST_NAME = userInfoMap.familyName } else if (userInfoMap.formatted) { - requestParameters.USER_FIRST_NAME = userInfoMap.formatted; + requestParameters.USER_FIRST_NAME = userInfoMap.formatted } - requestParameters.CUSTOMER_EMAIL = userInfoMap.email; - requestParameters.preferredUsername = userInfoMap.preferredUsername; - requestParameters.USERNAME = userInfoMap.preferredUsername; - request.getSession().setAttribute("userInfoMap", userInfoMap); + requestParameters.CUSTOMER_EMAIL = userInfoMap.email + requestParameters.preferredUsername = userInfoMap.preferredUsername + requestParameters.USERNAME = userInfoMap.preferredUsername + request.getSession().setAttribute("userInfoMap", userInfoMap) } donePage = "main;" + parameters.visit.sessionId -context.donePage = donePage; +context.donePage = donePage Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/OnePageCheckoutOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,11 +17,11 @@ * under the License. */ - import org.apache.ofbiz.order.shoppingcart.shipping.*; + import org.apache.ofbiz.order.shoppingcart.shipping.* -shoppingCart = session.getAttribute("shoppingCart"); +shoppingCart = session.getAttribute("shoppingCart") // Reassign items requiring drop-shipping to new or existing drop-ship groups if (shoppingCart) { - shoppingCart.createDropShipGroups(dispatcher); + shoppingCart.createDropShipGroups(dispatcher) } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy Wed Nov 2 19:09:13 2016 @@ -17,85 +17,85 @@ * under the License. */ -import java.lang.*; -import java.util.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.party.contact.ContactMechWorker; -import org.apache.ofbiz.product.store.ProductStoreWorker; -import org.apache.ofbiz.accounting.payment.PaymentWorker; +import java.lang.* +import java.util.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.party.contact.ContactMechWorker +import org.apache.ofbiz.product.store.ProductStoreWorker +import org.apache.ofbiz.accounting.payment.PaymentWorker -productStoreId = ProductStoreWorker.getProductStoreId(request); -context.productStoreId = productStoreId; +productStoreId = ProductStoreWorker.getProductStoreId(request) +context.productStoreId = productStoreId if (userLogin) { - profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).queryOne(); + profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).queryOne() - showOld = "true".equals(parameters.SHOW_OLD); + showOld = "true".equals(parameters.SHOW_OLD) - partyContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, userLogin.partyId, showOld); - paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, userLogin.partyId, showOld); + partyContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, userLogin.partyId, showOld) + paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, userLogin.partyId, showOld) - context.profiledefs = profiledefs; - context.showOld = showOld; - context.partyContactMechValueMaps = partyContactMechValueMaps; - context.paymentMethodValueMaps = paymentMethodValueMaps; + context.profiledefs = profiledefs + context.showOld = showOld + context.partyContactMechValueMaps = partyContactMechValueMaps + context.paymentMethodValueMaps = paymentMethodValueMaps // shipping methods - for default selection if (profiledefs?.defaultShipAddr) { - shipAddress = from("PostalAddress").where("contactMechId", profiledefs.defaultShipAddr).queryOne(); + shipAddress = from("PostalAddress").where("contactMechId", profiledefs.defaultShipAddr).queryOne() if (shipAddress) { - carrierShipMeths = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId, shipAddress, [1], null, 0, 1); - context.carrierShipMethods = carrierShipMeths; + carrierShipMeths = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId, shipAddress, [1], null, 0, 1) + context.carrierShipMethods = carrierShipMeths } } - profileSurveys = ProductStoreWorker.getProductSurveys(delegator, productStoreId, null, "CUSTOMER_PROFILE"); - context.surveys = profileSurveys; + profileSurveys = ProductStoreWorker.getProductSurveys(delegator, productStoreId, null, "CUSTOMER_PROFILE") + context.surveys = profileSurveys - exprs = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)]; - exprs.add(EntityCondition.makeCondition("roleStatusId", EntityOperator.NOT_EQUAL, "COM_ROLE_READ")); - messages = from("CommunicationEventAndRole").where(exprs).orderBy("-entryDate").maxRows(5).queryList(); - context.messages = messages; - context.profileMessages = true; + exprs = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId)] + exprs.add(EntityCondition.makeCondition("roleStatusId", EntityOperator.NOT_EQUAL, "COM_ROLE_READ")) + messages = from("CommunicationEventAndRole").where(exprs).orderBy("-entryDate").maxRows(5).queryList() + context.messages = messages + context.profileMessages = true - partyContent = from("ContentRole").where("partyId", partyId, "roleTypeId", "OWNER").filterByDate().queryList(); - context.partyContent = partyContent; + partyContent = from("ContentRole").where("partyId", partyId, "roleTypeId", "OWNER").filterByDate().queryList() + context.partyContent = partyContent - mimeTypes = from("MimeType").orderBy("description", "mimeTypeId").queryList(); - context.mimeTypes = mimeTypes; + mimeTypes = from("MimeType").orderBy("description", "mimeTypeId").queryList() + context.mimeTypes = mimeTypes - partyContentTypes = from("PartyContentType").orderBy("description").queryList(); - context.partyContentTypes = partyContentTypes; + partyContentTypes = from("PartyContentType").orderBy("description").queryList() + context.partyContentTypes = partyContentTypes // call the getOrderedSummaryInformation service to get the sub-total of valid orders in last X months - monthsToInclude = 12; - result = runService('getOrderedSummaryInformation', [partyId : partyId, roleTypeId : "PLACING_CUSTOMER", orderTypeId : "SALES_ORDER", statusId : "ORDER_COMPLETED", monthsToInclude : monthsToInclude, userLogin : userLogin]); - context.monthsToInclude = monthsToInclude; - context.totalSubRemainingAmount = result.totalSubRemainingAmount; - context.totalOrders = result.totalOrders; - - contactListPartyList = from("ContactListParty").where("partyId", partyId).orderBy("-fromDate").queryList(); - // show all, including history, ie don't filter: contactListPartyList = EntityUtil.filterByDate(contactListPartyList, true); - context.contactListPartyList = contactListPartyList; + monthsToInclude = 12 + result = runService('getOrderedSummaryInformation', [partyId : partyId, roleTypeId : "PLACING_CUSTOMER", orderTypeId : "SALES_ORDER", statusId : "ORDER_COMPLETED", monthsToInclude : monthsToInclude, userLogin : userLogin]) + context.monthsToInclude = monthsToInclude + context.totalSubRemainingAmount = result.totalSubRemainingAmount + context.totalOrders = result.totalOrders + + contactListPartyList = from("ContactListParty").where("partyId", partyId).orderBy("-fromDate").queryList() + // show all, including history, ie don't filter: contactListPartyList = EntityUtil.filterByDate(contactListPartyList, true) + context.contactListPartyList = contactListPartyList - publicContactLists = from("ContactList").where("isPublic", "Y").orderBy("contactListName").queryList(); - context.publicContactLists = publicContactLists; + publicContactLists = from("ContactList").where("isPublic", "Y").orderBy("contactListName").queryList() + context.publicContactLists = publicContactLists - partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId).orderBy("-fromDate").filterByDate().queryList(); - context.partyAndContactMechList = partyAndContactMechList; + partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId).orderBy("-fromDate").filterByDate().queryList() + context.partyAndContactMechList = partyAndContactMechList // state/province & country's name if (partyContactMechValueMaps) { partyContactMechValueMaps.each { if (it.postalAddress) { - postalAddress = it.postalAddress; - countryGeo = postalAddress.getRelatedOne("CountryGeo", false); - if (countryGeo) it.countryGeoName = countryGeo.getString("geoName"); - stateProvinceGeo = postalAddress.getRelatedOne("StateProvinceGeo", false); - if (stateProvinceGeo) it.stateProvinceGeoName = stateProvinceGeo.getString("geoName"); + postalAddress = it.postalAddress + countryGeo = postalAddress.getRelatedOne("CountryGeo", false) + if (countryGeo) it.countryGeoName = countryGeo.getString("geoName") + stateProvinceGeo = postalAddress.getRelatedOne("StateProvinceGeo", false) + if (stateProvinceGeo) it.stateProvinceGeoName = stateProvinceGeo.getString("geoName") } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentAddPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,77 +17,77 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.securityext.login.*; -import org.apache.ofbiz.common.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.ContentManagementWorker; -import org.apache.ofbiz.content.content.ContentWorker; - -import freemarker.template.SimpleHash; -import freemarker.template.SimpleSequence; - -import javax.servlet.*; -import javax.servlet.http.*; - -singleWrapper = context.singleWrapper; -singleWrapper.putInContext("contentPurposeTypeId", page.contentPurposeTypeId); -singleWrapper.putInContext("contentAssocTypeId", page.contentAssocTypeId); -rootPubPt = parameters.webSiteId; -paramMap = UtilHttp.getParameterMap(request); -contentIdTo = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context); -context.contentIdTo = contentIdTo; -//Debug.logInfo("in contentaddprep, contentIdTo:" + contentIdTo,""); -//Debug.logInfo("in contentaddprep, paramMap:" + paramMap,""); -attrList = from("ContentAttribute").where("contentId", contentIdTo, "attrName", "publishOperation").cache(true).queryList(); -publishOperation = null; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.securityext.login.* +import org.apache.ofbiz.common.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.ContentManagementWorker +import org.apache.ofbiz.content.content.ContentWorker + +import freemarker.template.SimpleHash +import freemarker.template.SimpleSequence + +import javax.servlet.* +import javax.servlet.http.* + +singleWrapper = context.singleWrapper +singleWrapper.putInContext("contentPurposeTypeId", page.contentPurposeTypeId) +singleWrapper.putInContext("contentAssocTypeId", page.contentAssocTypeId) +rootPubPt = parameters.webSiteId +paramMap = UtilHttp.getParameterMap(request) +contentIdTo = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context) +context.contentIdTo = contentIdTo +//Debug.logInfo("in contentaddprep, contentIdTo:" + contentIdTo,"") +//Debug.logInfo("in contentaddprep, paramMap:" + paramMap,"") +attrList = from("ContentAttribute").where("contentId", contentIdTo, "attrName", "publishOperation").cache(true).queryList() +publishOperation = null if (attrList) { - contentAttribute = attrList.get(0); - publishOperation = contentAttribute.attrValue; - //Debug.logInfo("in contentaddprep, publishOperation:" + publishOperation,""); + contentAttribute = attrList.get(0) + publishOperation = contentAttribute.attrValue + //Debug.logInfo("in contentaddprep, publishOperation:" + publishOperation,"") } -singleWrapper.putInContext("publishOperation", publishOperation); -singleWrapper.putInContext("contentIdTo", contentIdTo); -//singleWrapper.putInContext("ownerContentId", contentIdTo); -summaryDataResourceTypeId = page.summaryDataResourceTypeId; -singleWrapper.putInContext("summaryDataResourceTypeId", summaryDataResourceTypeId); -targetOperation = page.targetOperation ?: "CONTENT_CREATE"; - -singleWrapper.putInContext("targetOperation", targetOperation); -singleWrapper.putInContext("contentTypeId", "DOCUMENT"); -contentPurpose = page.contentPurpose ?: "ARTICLE"; +singleWrapper.putInContext("publishOperation", publishOperation) +singleWrapper.putInContext("contentIdTo", contentIdTo) +//singleWrapper.putInContext("ownerContentId", contentIdTo) +summaryDataResourceTypeId = page.summaryDataResourceTypeId +singleWrapper.putInContext("summaryDataResourceTypeId", summaryDataResourceTypeId) +targetOperation = page.targetOperation ?: "CONTENT_CREATE" + +singleWrapper.putInContext("targetOperation", targetOperation) +singleWrapper.putInContext("contentTypeId", "DOCUMENT") +contentPurpose = page.contentPurpose ?: "ARTICLE" -singleWrapper.putInContext("contentPurpose", contentPurpose); -singleWrapper.putInContext("forumId", contentIdTo); +singleWrapper.putInContext("contentPurpose", contentPurpose) +singleWrapper.putInContext("forumId", contentIdTo) -forumContent = from("Content").where("contentId", contentIdTo).cache(true).queryOne(); -statusId = "CTNT_PUBLISHED"; +forumContent = from("Content").where("contentId", contentIdTo).cache(true).queryOne() +statusId = "CTNT_PUBLISHED" if (forumContent) { - statusId = forumContent.statusId; + statusId = forumContent.statusId if (!statusId) { - statusId = page.statusId; + statusId = page.statusId } if (!statusId) { - statusId = "CTNT_PUBLISHED"; + statusId = "CTNT_PUBLISHED" } } -singleWrapper.putInContext("statusId", statusId); +singleWrapper.putInContext("statusId", statusId) -siteAncestorList = []; -siteAncestorList.add(contentIdTo); -context.siteAncestorList = siteAncestorList; -//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,""); +siteAncestorList = [] +siteAncestorList.add(contentIdTo) +context.siteAncestorList = siteAncestorList +//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"") Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ContentPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,113 +17,113 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.base.util.template.FreeMarkerWorker; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler; -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.content.ContentManagementWorker; - -import java.io.StringWriter; -import freemarker.template.SimpleHash; -import freemarker.template.WrappingTemplateModel; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.base.util.template.FreeMarkerWorker +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.content.ContentManagementWorker + +import java.io.StringWriter +import freemarker.template.SimpleHash +import freemarker.template.WrappingTemplateModel -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* // load edit or create Content form -rootPubPt = parameters.webSiteId; -//Debug.logInfo("in contentprep, security:" + security, ""); +rootPubPt = parameters.webSiteId +//Debug.logInfo("in contentprep, security:" + security, "") -singleWrapper = context.singleWrapper; +singleWrapper = context.singleWrapper -paramMap = UtilHttp.getParameterMap(request); -contentId = ""; -contentId = ContentManagementWorker.getFromSomewhere("masterContentId", paramMap, request, context); +paramMap = UtilHttp.getParameterMap(request) +contentId = "" +contentId = ContentManagementWorker.getFromSomewhere("masterContentId", paramMap, request, context) if (!contentId) - contentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context); + contentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context) if (!contentId) - contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context); + contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context) -//Debug.logInfo("in contentprep, contentId(1):" + contentId, ""); -currentValue = parameters.currentValue; -//Debug.logInfo("in contentprep, currentValue(0):" + currentValue, ""); +//Debug.logInfo("in contentprep, contentId(1):" + contentId, "") +currentValue = parameters.currentValue +//Debug.logInfo("in contentprep, currentValue(0):" + currentValue, "") if (!contentId && currentValue) { - contentId = currentValue.contentId; + contentId = currentValue.contentId } if (contentId && !currentValue) { - currentValue = from("Content").where("contentId", contentId).cache(true).queryOne(); + currentValue = from("Content").where("contentId", contentId).cache(true).queryOne() } -//Debug.logInfo("in contentprep, currentValue(1):" + currentValue, ""); -//Debug.logInfo("in contentprep, contentId(4):" + contentId, ""); +//Debug.logInfo("in contentprep, currentValue(1):" + currentValue, "") +//Debug.logInfo("in contentprep, contentId(4):" + contentId, "") if (currentValue) { - dataResourceId = currentValue.dataResourceId; - context.contentId = contentId; - context.contentName = currentValue.contentName; - context.description = currentValue.description; - context.statusId = currentValue.statusId; - - mimeTypeId = currentValue.mimeTypeId; - rootDir = request.getSession().getServletContext().getRealPath("/"); - wrapper = FreeMarkerWorker.getDefaultOfbizWrapper(); - WrappingTemplateModel.setDefaultObjectWrapper(wrapper); - //templateRoot = new SimpleHash(wrapper); - templateRoot = [:]; - FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response); + dataResourceId = currentValue.dataResourceId + context.contentId = contentId + context.contentName = currentValue.contentName + context.description = currentValue.description + context.statusId = currentValue.statusId + + mimeTypeId = currentValue.mimeTypeId + rootDir = request.getSession().getServletContext().getRealPath("/") + wrapper = FreeMarkerWorker.getDefaultOfbizWrapper() + WrappingTemplateModel.setDefaultObjectWrapper(wrapper) + //templateRoot = new SimpleHash(wrapper) + templateRoot = [:] + FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response) - ctx = [:]; - ctx.rootDir = rootDir; + ctx = [:] + ctx.rootDir = rootDir // webSiteId and https need to go here, too - templateRoot.context = ctx; - fromDate = nowTimestamp; - assocTypes = null; - //assocTypes = ["SUB_CONTENT"]; - subContentDataResourceView = ContentWorker.getSubContent(delegator, contentId, "ARTICLE", null, userLogin, assocTypes, fromDate); + templateRoot.context = ctx + fromDate = nowTimestamp + assocTypes = null + //assocTypes = ["SUB_CONTENT"] + subContentDataResourceView = ContentWorker.getSubContent(delegator, contentId, "ARTICLE", null, userLogin, assocTypes, fromDate) if (subContentDataResourceView) { - out = new StringWriter(); - ContentWorker.renderContentAsText(dispatcher, delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId, true); - textData = out.toString(); - context.txtContentId = subContentDataResourceView.contentId; - context.txtDataResourceId = subContentDataResourceView.dataResourceId; - context.textData = textData; - //Debug.logInfo("textId:" + txtContentId, ""); - //Debug.logInfo("textData:" + textData, ""); + out = new StringWriter() + ContentWorker.renderContentAsText(dispatcher, delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId, true) + textData = out.toString() + context.txtContentId = subContentDataResourceView.contentId + context.txtDataResourceId = subContentDataResourceView.dataResourceId + context.textData = textData + //Debug.logInfo("textId:" + txtContentId, "") + //Debug.logInfo("textData:" + textData, "") if (singleWrapper) { - //Debug.logInfo("textData:" + textData, ""); - singleWrapper.putInContext("textData", textData); + //Debug.logInfo("textData:" + textData, "") + singleWrapper.putInContext("textData", textData) } } - subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "SUMMARY", null, userLogin, assocTypes, fromDate, true); + subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "SUMMARY", null, userLogin, assocTypes, fromDate, true) if (subContentDataResourceView) { - out = new StringWriter(); - ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId); - summaryData = out.toString(); - context.sumContentId = subContentDataResourceView.contentId; - context.sumDataResourceId = subContentDataResourceView.dataResourceId; - context.summaryData = summaryData; - //Debug.logInfo("sumId:" + sumContentId, ""); - //Debug.logInfo("summaryData:" + summaryData, ""); + out = new StringWriter() + ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId) + summaryData = out.toString() + context.sumContentId = subContentDataResourceView.contentId + context.sumDataResourceId = subContentDataResourceView.dataResourceId + context.summaryData = summaryData + //Debug.logInfo("sumId:" + sumContentId, "") + //Debug.logInfo("summaryData:" + summaryData, "") if (singleWrapper) { - //Debug.logInfo("summaryData:" + summaryData, ""); - singleWrapper.putInContext("summaryData", summaryData); + //Debug.logInfo("summaryData:" + summaryData, "") + singleWrapper.putInContext("summaryData", summaryData) } } - subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "IMAGE", null, userLogin, assocTypes, fromDate, true); + subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "IMAGE", null, userLogin, assocTypes, fromDate, true) if (subContentDataResourceView) { - out = new StringWriter(); - ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId); - imageData = out.toString(); - context.imgContentId = subContentDataResourceView.contentId; - context.imgDataResourceId = subContentDataResourceView.dataResourceId; - context.imageData = imageData; + out = new StringWriter() + ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId) + imageData = out.toString() + context.imgContentId = subContentDataResourceView.contentId + context.imgDataResourceId = subContentDataResourceView.dataResourceId + context.imageData = imageData } } |
Free forum by Nabble | Edit this page |