Commented out code should always be removed as a general programming guideline
On Sun, Oct 2, 2016 at 1:10 PM, Jacques Le Roux < jacques.le.r...@les7arts.com> wrote: > Hi Ashish, > > I think we should keep this example > > Thanks > > Jacques > > > Le 04/09/2016 à 08:41, ash...@apache.org a écrit : > >> Author: ashish >> Date: Sun Sep 4 06:41:20 2016 >> New Revision: 1759147 >> >> URL: http://svn.apache.org/viewvc?rev=1759147&view=rev >> Log: >> Applied patch from jira issue - OFBIZ-8074 - Clean up commented out code >> in Groovy for Order. Thanks Aman for the contribution. >> >> - /* >> - The following code is commented out because it is just an example >> of the business logic to retrieve products with a similar feature. >> - >> - // get other cross-sell information: product with a common feature >> - commonProductFeatureId = "SYMPTOM"; >> - // does this product have that feature? >> - commonProductFeatureAndAppls = >> delegator.findByAnd("ProductFeatureAndAppl", >> [productId : productId, productFeatureTypeId : commonProductFeatureId], >> ["sequenceNum", "defaultSequenceNum"], false); >> - if (commonProductFeatureAndAppls) { >> - commonProductFeatureIds = EntityUtil.getFieldListFromEnt >> ityList(commonProductFeatureAndAppls, "productFeatureId", true); >> - >> - // now search for other products that have this feature >> - visitId = VisitHandler.getVisitId(session); >> - >> - productSearchConstraintList = []; >> - productSearchConstraintList.add(new >> ProductSearch.FeatureSetConstraint(commonProductFeatureIds)); >> - // make sure the view allow category is included >> - productSearchConstraintList = ProductSearchSession.ensureVie >> wAllowConstraint(productSearchConstraintList, currentCatalogId, >> delegator); >> - >> - // don't care about the sort on this one >> - resultSortOrder = null; >> - >> - commonFeatureResultIdsOrig = >> ProductSearch.searchProducts(productSearchConstraintList, >> resultSortOrder, delegator, visitId); >> - commonFeatureResultIds = []; >> - commonFeatureResultIdIter = commonFeatureResultIdsOrig.ite >> rator(); >> - while (commonFeatureResultIdIter.hasNext()) { >> - commonFeatureResultId = commonFeatureResultIdIter.next(); >> - // filter out the current product >> - if (commonFeatureResultId.equals(productId)) { >> - continue; >> - } >> - // filter out all variants >> - commonProduct = delegator.findOne("Product", [productId : >> commonFeatureResultId], true); >> - if ("Y".equals(commonProduct?.isVariant)) { >> - continue; >> - } >> - commonFeatureResultIds.add(commonFeatureResultId); >> - } >> - if (commonFeatureResultIds) { >> - context.commonFeatureResultIds = commonFeatureResultIds; >> - } >> - } >> - */ >> - >> // get the DIGITAL_DOWNLOAD related Content records to show the >> contentName/description >> > >