danwatford commented on code in PR #517: URL: https://github.com/apache/ofbiz-framework/pull/517#discussion_r1157555615
########## framework/common/groovyScripts/CommonServices.groovy: ########## @@ -350,107 +335,112 @@ def createKeywordThesaurus() { /** * Delete a complete Entry KeywordThesaurus - * @return */ -def deleteKeywordThesaurus() { - GenericValue newEntity = makeValue("KeywordThesaurus") +Map deleteKeywordThesaurus() { + GenericValue newEntity = makeValue('KeywordThesaurus') newEntity.enteredKeyword = parameters.enteredKeyword if (parameters.alternateKeyword) { newEntity.alternateKeyword = parameters.alternateKeyword } - delegator.removeByAnd("KeywordThesaurus", newEntity) + delegator.removeByAnd('KeywordThesaurus', newEntity) return success() } -def createFuturePeriod() { +Map createFuturePeriod() { applTypes = [] grain = null intermediate = null - parties = from('PartyAcctgPreference').where('enableAccounting','Y').queryIterator() - while (party = parties.next()){ + parties = from('PartyAcctgPreference').where('enableAccounting', 'Y').queryIterator() + while (parties.hasNext()) { + party = parties.next() parameters.organizationPartyId = party.partyId createCustomTimePeriod = from('SystemProperty') - .where('systemResourceId','general', 'systemPropertyId','CustomTimePeriod.create').queryOne() - if ("Y".equals(createCustomTimePeriod.systemPropertyValue)) { + .where('systemResourceId', 'general', 'systemPropertyId', 'CustomTimePeriod.create').queryOne() + if (createCustomTimePeriod.systemPropertyValue == 'Y') { // get list of CustomTypePeriod types applTypes = from('SystemProperty') - .where('systemResourceId','general', 'systemPropertyId','CustomTimePeriod.applType').queryOne() - List types = Arrays.asList(applTypes.systemPropertyValue.split("\\s*,\\s*")) - types.each{periodTypeId -> - Calendar periodCal = Calendar.getInstance(); - systemPropertyId = "CustomTimePeriod." + periodTypeId + ".intermediate" + .where('systemResourceId', 'general', 'systemPropertyId', 'CustomTimePeriod.applType').queryOne() + List types = Arrays.asList(applTypes.systemPropertyValue.split('\\s*,\\s*')) + types.each { periodTypeId -> + Calendar periodCal = Calendar.getInstance() + systemPropertyId = 'CustomTimePeriod.' + periodTypeId + '.intermediate' applTypeInter = from('SystemProperty') - .where('systemResourceId','general', 'systemPropertyId',systemPropertyId).queryOne() + .where('systemResourceId', 'general', 'systemPropertyId', systemPropertyId).queryOne() if (applTypeInter) { intermediate = applTypeInter.systemPropertyValue } // get grain for application type - systemPropertyId = "CustomTimePeriod." + periodTypeId + ".grain" + systemPropertyId = 'CustomTimePeriod.' + periodTypeId + '.grain' applTypeGrain = from('SystemProperty') - .where('systemResourceId','general', 'systemPropertyId',systemPropertyId).queryOne() + .where('systemResourceId', 'general', 'systemPropertyId', systemPropertyId).queryOne() if (applTypeGrain) { grain = applTypeGrain.systemPropertyValue - if ("MONTH".equals(grain)) { + if (grain == 'MONTH') { periodCal.add(Calendar.MONTH, 1) - monthName = new SimpleDateFormat("MMM").format(periodCal.getTime()) + monthName = new SimpleDateFormat('MMM', locale).format(periodCal.getTime()) Review Comment: Specifying the locale is a behaviour change. I agree that the new code is probably the right thing to do, but I think the change should be made on a different PR with a corresponding bug report. Perhaps I'm being too pedantic. What do others think? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ofbiz.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org