gilPts commented on code in PR #517: URL: https://github.com/apache/ofbiz-framework/pull/517#discussion_r1158201088
########## 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: Even if i agree with you, this edit is to comply the codenarc SimpleDateFormatMissingLocale rule. So i guess we should keep it Be sure to specify a Locale when creating a new instance of SimpleDateFormat; the class is locale-sensitive. If you instantiate SimpleDateFormat without a Locale parameter, it will format the date and time according to the default Locale. Both the pattern and the Locale determine the format. For the same pattern, SimpleDateFormat may format a date and time differently if the Locale varies -- 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