This is an automated email from the ASF dual-hosted git repository. nmalin pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push: new 172516e763 Implemented: Fix all codenarc violation (OFBIZ-13228) 172516e763 is described below commit 172516e7632b3aa4ffd278b93f89981122b530aa Author: Nicolas Malin <nicolas.ma...@nereide.fr> AuthorDate: Mon Apr 28 11:44:50 2025 +0200 Implemented: Fix all codenarc violation (OFBIZ-13228) Fix codenarc violation lvl 2 : * AssignmentInConditional * LineLength * PackageName Fix codenarc violation lvl 3 : * BlockStartsWithBlankLine * ConsecutiveBlankLines * FileEndsWithoutNewline * ImportFromSamePackage * JavadocEmptyReturnTag * JavadocMissingParamDescription * SpaceAfterComma * SpaceAfterOpeningBrace * SpaceAroundMapEntryColon * SpaceBeforeClosingBrace * UnnecessaryGString * UnusedImport --- .../ofbiz/accounting/period/GPeriodServices.groovy | 3 +- .../content/content/ContentSearchOptions.groovy | 1 - .../content/content/ContentSearchResults.groovy | 21 ++- .../content/content/ContentServicesScript.groovy | 184 ++++++++++----------- .../ofbiz/content/survey/EditSurveyResponse.groovy | 1 - .../content/survey/ViewSurveyResponses.groovy | 2 - .../ofbiz/manufacturing/bom/BomSimulation.groovy | 4 +- .../jobshopmgt/ProductionRunAllFixedAssets.groovy | 2 - .../jobshopmgt/ProductionRunDeclaration.groovy | 1 - .../jobshopmgt/ProductionRunServicesScript.groovy | 1 - .../jobshopmgt/ProductionRunTaskParties.groovy | 2 - .../jobshopmgt/ProductionRunTasks.groovy | 2 - .../jobshopmgt/ViewProductionRun.groovy | 2 - .../jobshopmgt/WorkWithShipmentPlans.groovy | 2 - .../ofbiz/order/customer/CheckoutMapProcs.groovy | 2 +- .../apache/ofbiz/order/entry/BillSettings.groovy | 45 +++-- .../apache/ofbiz/order/order/CompanyHeader.groovy | 23 ++- .../ofbiz/order/order/FilterOrderList.groovy | 2 - .../org/apache/ofbiz/order/order/OrderList.groovy | 1 - .../org/apache/ofbiz/order/order/OrderView.groovy | 1 - .../ofbiz/order/order/OrderViewWebSecure.groovy | 2 - .../org/apache/ofbiz/order/order/ViewImage.groovy | 2 - .../QuickReturn.groovy | 2 +- .../ReturnHeader.groovy | 2 +- .../ReturnHistory.groovy | 2 +- .../ReturnItems.groovy | 2 +- .../order/widget/ordermgr/OrderPrintScreens.xml | 4 +- .../order/widget/ordermgr/OrderReturnScreens.xml | 18 +- .../ofbiz/party/party/EditShoppingList.groovy | 2 +- .../apache/ofbiz/party/party/FindMatches.groovy | 2 - .../party/party/PartyInvitationServices.groovy | 2 - .../ofbiz/party/party/PartyServicesScript.groovy | 1 - .../ImageManagementServicesScript.groovy | 34 ++-- build.gradle | 4 +- .../ofbiz/common/CommonServicesScript.groovy | 8 +- .../webapp/test/OfbizPathShortenerTests.groovy | 4 +- .../ofbiz/webtools/entity/FindGeneric.groovy | 2 +- .../webtools/labelmanager/LabelManager.groovy | 3 - .../webtools/labelmanager/UpdateManager.groovy | 2 - .../webtools/labelmanager/ViewReferences.groovy | 3 - .../webtools/service/SetServiceParameters.groovy | 1 - 41 files changed, 178 insertions(+), 226 deletions(-) diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/period/GPeriodServices.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/period/GPeriodServices.groovy index 1c08c0e9ee..2419eea7b0 100644 --- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/period/GPeriodServices.groovy +++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/period/GPeriodServices.groovy @@ -52,7 +52,6 @@ Map findCustomTimePeriods() { OR { EQUALS(organizationPartyId: null) EQUALS(organizationPartyId: '_NA_') - } LESS_THAN(fromDate: parameters.findDate) OR { @@ -87,4 +86,4 @@ Map getPreviousTimePeriod() { return success([previousTimePeriod: previousTimePeriod]) } return success() -} \ No newline at end of file +} diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchOptions.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchOptions.groovy index 975a5e5dfc..0c8c837527 100644 --- a/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchOptions.groovy +++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchOptions.groovy @@ -19,7 +19,6 @@ package org.apache.ofbiz.content.content import java.sql.Timestamp -import org.apache.ofbiz.content.content.ContentSearchSession searchOperator = parameters.get('SEARCH_OPERATOR') if ('AND' != searchOperator && 'OR' != searchOperator) { diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchResults.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchResults.groovy index 39013fedaf..3e51797ee0 100644 --- a/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchResults.groovy +++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchResults.groovy @@ -18,18 +18,17 @@ */ package org.apache.ofbiz.content.content -import org.apache.ofbiz.content.content.ContentSearchSession -import org.apache.ofbiz.content.content.ContentSearchEvents - // note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again ContentSearchSession.processSearchParameters(parameters, request) Map result = ContentSearchEvents.getContentSearchResult(request, delegator) -context.put('contentIds', result.get('contentIds')) -context.put('viewIndex', result.get('viewIndex')) -context.put('viewSize', result.get('viewSize')) -context.put('listSize', result.get('listSize')) -context.put('lowIndex', result.get('lowIndex')) -context.put('highIndex', result.get('highIndex')) -context.put('searchConstraintStrings', result.get('searchConstraintStrings')) -context.put('searchSortOrderString', result.get('searchSortOrderString')) +context.with { + contentIds = result.get('contentIds') + viewIndex = result.get('viewIndex') + viewSize = result.get('viewSize') + listSize = result.get('listSize') + lowIndex = result.get('lowIndex') + highIndex = result.get('highIndex') + searchConstraintStrings = result.get('searchConstraintStrings') + searchSortOrderString = result.get('searchSortOrderString') +} diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentServicesScript.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentServicesScript.groovy index 4320c09bc1..dcb8d2ac11 100644 --- a/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentServicesScript.groovy +++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentServicesScript.groovy @@ -18,20 +18,16 @@ */ package org.apache.ofbiz.content.content +import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.base.util.UtilProperties - -import org.apache.ofbiz.content.content.ContentKeywordIndex import org.apache.ofbiz.common.UrlServletHelper +import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityConditionBuilder -import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.entity.condition.EntityOperator -import org.apache.ofbiz.entity.util.EntityListIterator import org.apache.ofbiz.service.GenericServiceException - import org.apache.ofbiz.service.ModelService import org.apache.ofbiz.service.ServiceUtil -import org.apache.ofbiz.base.util.UtilDateTime Map createTextAndUploadedContent() { Map result = success() @@ -128,12 +124,11 @@ Map createContentAlternativeUrl() { //create Content Alternative URLs. String contentCreated = 'N' defaultLocaleString = parameters.locale ?: 'en' - EntityListIterator contents EntityCondition entryExprs EntityCondition contentTypeExprs = EntityCondition.makeCondition(EntityOperator.OR, - 'contentTypeId', 'DOCUMENT', - 'contentTypeId', 'WEB_SITE_PUB_PT') + 'contentTypeId', 'DOCUMENT', + 'contentTypeId', 'WEB_SITE_PUB_PT') if (parameters.contentId) { entryExprs = new EntityConditionBuilder().AND(contentTypeExprs) { NOT_EQUAL(contentName: null) @@ -145,84 +140,83 @@ Map createContentAlternativeUrl() { } } - contents = select('contentId', 'contentName', 'localeString') + select('contentId', 'contentName', 'localeString') .from('Content') .where(entryExprs) - .queryIterator() - - GenericValue content - while (content = contents.next()) { - String localeString = content.localeString ?: defaultLocaleString - List contentAssocDataResources = select('contentIdStart', 'dataResourceId', 'localeString', 'drObjectInfo', 'caFromDate', 'caThruDate') - .from('ContentAssocDataResourceViewTo') - .where(caContentAssocTypeId: 'ALTERNATIVE_URL', - contentIdStart: content.contentId, - localeString: localeString.toString()) - .filterByDate('caFromDate', 'caThruDate') - .queryList() - if (contentAssocDataResources) { - if (contentAssocDataResources - && contentAssocDataResources[0].drObjectInfo - && content.contentName) { - String uri = UrlServletHelper.invalidCharacter(content.contentName) - if (uri) { - try { - serviceResult = run service: 'updateDataResource', with: [dataResourceId: contentAssocDataResources[0].dataResourceId, - objectInfo: "/${uri}'${content.contentId}-content"] - if (ServiceUtil.isSuccess(serviceResult)) { - contentIdTo = serviceResult.contentId - } - } catch (GenericServiceException e) { - logError(e.getMessage()) - } - contentCreated = 'Y' - } - } - } else { - if (content.contentName) { - String uri = UrlServletHelper.invalidCharacter(content.contentName) - if (uri) { - try { - Map serviceResult = run service: 'createDataResource', with: [dataResourceId: delegator.getNextSeqId('DataResource'), - dataResourceTypeId: 'URL_RESOURCE', - localeString: localeString.toString(), - objectInfo: "${uri}-${content.contentId}-content", - statusId: 'CTNT_IN_PROGRESS'] - if (ServiceUtil.isSuccess(serviceResult)) { - dataResourceId = serviceResult.dataResourceId - } - } catch (GenericServiceException e) { - logError(e.getMessage()) - } - if (dataResourceId) { - try { - serviceResult = run service: 'createContent', with: [dataResourceId: dataResourceId, - localeString: localeString.toString(), - statusId: 'CTNT_IN_PROGRESS'] - if (ServiceUtil.isSuccess(serviceResult)) { - contentIdTo = serviceResult.contentId + .queryList() + .each { content -> + String localeString = content.localeString ?: defaultLocaleString + List contentAssocDataResources = select('contentIdStart', 'dataResourceId', + 'localeString', 'drObjectInfo', 'caFromDate', 'caThruDate') + .from('ContentAssocDataResourceViewTo') + .where(caContentAssocTypeId: 'ALTERNATIVE_URL', + contentIdStart: content.contentId, + localeString: localeString.toString()) + .filterByDate('caFromDate', 'caThruDate') + .queryList() + if (contentAssocDataResources) { + if (contentAssocDataResources + && contentAssocDataResources[0].drObjectInfo + && content.contentName) { + String uri = UrlServletHelper.invalidCharacter(content.contentName) + if (uri) { + try { + serviceResult = run service: 'updateDataResource', with: [dataResourceId: contentAssocDataResources[0].dataResourceId, + objectInfo: "/${uri}'${content.contentId}-content"] + if (ServiceUtil.isSuccess(serviceResult)) { + contentIdTo = serviceResult.contentId + } + } catch (GenericServiceException e) { + logError(e.getMessage()) } - } catch (GenericServiceException e) { - logError(e.getMessage()) + contentCreated = 'Y' } - if (contentIdTo) { + } + } else { + if (content.contentName) { + String uri = UrlServletHelper.invalidCharacter(content.contentName) + if (uri) { try { - serviceResult = run service: 'createContentAssoc', with: [contentId: content.contentId, - contentIdTo: contentIdTo, - contentAssocTypeId: 'ALTERNATIVE_URL'] + Map serviceResult = run service: 'createDataResource', with: [dataResourceId: delegator.getNextSeqId('DataResource'), + dataResourceTypeId: 'URL_RESOURCE', + localeString: localeString.toString(), + objectInfo: "${uri}-${content.contentId}-content", + statusId: 'CTNT_IN_PROGRESS'] if (ServiceUtil.isSuccess(serviceResult)) { - contentIdTo = serviceResult.contentId + dataResourceId = serviceResult.dataResourceId } } catch (GenericServiceException e) { logError(e.getMessage()) } + if (dataResourceId) { + try { + serviceResult = run service: 'createContent', with: [dataResourceId: dataResourceId, + localeString: localeString.toString(), + statusId: 'CTNT_IN_PROGRESS'] + if (ServiceUtil.isSuccess(serviceResult)) { + contentIdTo = serviceResult.contentId + } + } catch (GenericServiceException e) { + logError(e.getMessage()) + } + if (contentIdTo) { + try { + serviceResult = run service: 'createContentAssoc', with: [contentId: content.contentId, + contentIdTo: contentIdTo, + contentAssocTypeId: 'ALTERNATIVE_URL'] + if (ServiceUtil.isSuccess(serviceResult)) { + contentIdTo = serviceResult.contentId + } + } catch (GenericServiceException e) { + logError(e.getMessage()) + } + } + } + contentCreated = 'Y' } } - contentCreated = 'Y' } } - } - } return [*: success(), contentCreated: contentCreated] } @@ -402,8 +396,9 @@ Map createDownloadContent() { Map updateDownloadContent() { if (parameters.fileDataResourceId) { - return runService('updateOtherDataResource', [dataResourceId: parameters.fileDataResourceId, - dataResourceContent: parameters.file]) + return (run service: 'updateOtherDataResource', with: + [dataResourceId: parameters.fileDataResourceId, + dataResourceContent: parameters.file]) } return success() } @@ -426,7 +421,7 @@ Map getDataResource() { return result } -Map getContentAndDataResource () { +Map getContentAndDataResource() { Map result = success() Map resultDataContent = [:] GenericValue content = from('Content').where('contentId', parameters.contentId).queryOne() @@ -446,9 +441,10 @@ Map getContentAndDataResource () { /* create content from data resource This method will create a skeleton content record from a data resource */ + Map createContentFromDataResource() { GenericValue dataResource = from('DataResource').where(parameters).queryOne() - if (! dataResource) { + if (!dataResource) { return error(UtilProperties.getMessage('ContentUiLabels', 'ContentDataResourceNotFound', [dataResourceId: parameters.dataResourceId], parameters.locale)) } @@ -459,6 +455,7 @@ Map createContentFromDataResource() { Map result = run service: 'createContent', with: parameters return result } + Map deleteContentKeywords() { GenericValue content = from('Content').where(parameters).queryOne() if (content) { @@ -598,14 +595,14 @@ Map createMissingContentAltUrls() { } } long totalParse = contentCreatedList.size() - long contentsUpdated = contentCreatedList.stream().filter {it == 'Y'}.count() + long contentsUpdated = contentCreatedList.stream().filter { it == 'Y' }.count() return success([contentsUpdated: contentsUpdated, contentsNotUpdated: totalParse - contentsUpdated]) } /** * recursive call to get all productCategoryId from children - * @param parentProductCategoryId - * @return + * @param parentProductCategoryId category id for resolve all children + * @return all children productCategoryId */ List createMissingCategoryContentAltUrlInline(String parentProductCategoryId) { List productCategoryIds = [] @@ -622,8 +619,8 @@ List createMissingCategoryContentAltUrlInline(String parentProductCategoryId) { /** * call createContentAlternativeUrl on all subContent and return the result for analyse - * @param contentId - * @return + * @param contentId id to generate the alternative + * @return the created content Id */ List createMissingContentAltUrlInline(String contentId) { List contentCreatedList = [] @@ -647,7 +644,6 @@ List createMissingContentAltUrlInline(String contentId) { * and calls the "createCommEventContentAssoc" service to tie the CommunicationEvent and Content entities together. */ Map createCommContentDataResource() { - // let's take a guess at what the dataResourceTypeId should be if it is empty if (!parameters.dataResourceTypeId && parameters.drMimeTypeId) { parameters.dataResourceTypeId = parameters.drMimeTypeId.startsWith('text') ? @@ -655,8 +651,8 @@ Map createCommContentDataResource() { } Map persistServiceResult = run service: 'persistContentAndAssoc', with: parameters Map serviceResult = run service: 'createCommEventContentAssoc', with: [contentId: persistServiceResult.contentId, - communicationEventId: parameters.communicationEventId, - sequenceNum: parameters.sequenceNum] + communicationEventId: parameters.communicationEventId, + sequenceNum: parameters.sequenceNum] return success([contentId: persistServiceResult.contentId, dataResourceId: persistServiceResult.dataResourceId, drDataResourceId: persistServiceResult.drDataResourceId, @@ -671,7 +667,7 @@ Map createCommContentDataResource() { /** * Remove a Content Record, related resource(s) and assocs. - * @return + * @return success */ Map removeContentAndRelated() { GenericValue content = from('Content').where(parameters).queryOne() @@ -684,11 +680,11 @@ Map removeContentAndRelated() { content.remove() GenericValue dataResource = content.getRelatedOne('DataResource', false) if (dataResource) { - dataResource.removeRelated("ElectronicText") - dataResource.removeRelated("ImageDataResource") - dataResource.removeRelated("OtherDataResource") - dataResource.removeRelated("VideoDataResource") - dataResource.removeRelated("DataResourceRole") + dataResource.removeRelated('ElectronicText') + dataResource.removeRelated('ImageDataResource') + dataResource.removeRelated('OtherDataResource') + dataResource.removeRelated('VideoDataResource') + dataResource.removeRelated('DataResourceRole') dataResource.remove() } } @@ -697,7 +693,7 @@ Map removeContentAndRelated() { /** * copy a content, electronic text and assocs and set status in progress - * @return + * @return new content Id generated by the copy */ Map copyContentAndElectronicTextandAssoc() { Map getContentResult = run service: 'getContent', with: parameters @@ -706,7 +702,7 @@ Map copyContentAndElectronicTextandAssoc() { Map getElectronicTextResult = run service: 'getElectronicText', with: content.getAllFields() Map dataResourceResult = run service: 'createDataResource', with: [dataResourceTypeId: 'ELECTRONIC_TEXT'] run service: 'createElectronicText', with: [dataResourceId: dataResourceResult.dataResourceId, - textData : getElectronicTextResult.textData] + textData: getElectronicTextResult.textData] content.dataResourceId = dataResourceResult.dataResourceId } Map contentResult = run service: 'createContent', with: [*: content.getAllFields(), @@ -732,7 +728,7 @@ Map copyContentAndElectronicTextandAssoc() { /** * @deprecated use createContentAssoc instead * Associate Content - * @return + * @return success */ Map assocContent() { GenericValue currentContent = from('Content').where(contentId: parameters.contentIdTo).cache().queryOne() diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/EditSurveyResponse.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/EditSurveyResponse.groovy index 6de7b8fec9..9157f5bdbe 100644 --- a/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/EditSurveyResponse.groovy +++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/EditSurveyResponse.groovy @@ -18,7 +18,6 @@ */ package org.apache.ofbiz.content.survey -import org.apache.ofbiz.content.survey.SurveyWrapper import org.apache.ofbiz.base.util.UtilURL surveyResponseId = parameters.surveyResponseId diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/ViewSurveyResponses.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/ViewSurveyResponses.groovy index 22811d6d56..af32172927 100644 --- a/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/ViewSurveyResponses.groovy +++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/survey/ViewSurveyResponses.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.content.survey -import org.apache.ofbiz.content.survey.SurveyWrapper - if (!survey) { surveyResponseId = parameters.surveyResponseId if (surveyResponseId) { diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/bom/BomSimulation.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/bom/BomSimulation.groovy index 82dd33a94f..5a50775b2d 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/bom/BomSimulation.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/bom/BomSimulation.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.manufacturing.bom -import org.apache.ofbiz.manufacturing.bom.BOMNode - tree = request.getAttribute('tree') currencyUomId = parameters.currencyUomId facilityId = parameters.facilityId @@ -36,7 +34,7 @@ if (tree) { productsData = [] grandTotalCost = 0.0 while (treeQtyIt) { - BOMNode node = (BOMNode)treeQtyIt.next() + BOMNode node = (BOMNode) treeQtyIt.next() unitCost = null totalCost = null qoh = null diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunAllFixedAssets.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunAllFixedAssets.groovy index e5317914bc..c6866db2b8 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunAllFixedAssets.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunAllFixedAssets.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.manufacturing.jobshopmgt -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun - productionRunId = parameters.productionRunId ?: parameters.workEffortId if (productionRunId) { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher) diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunDeclaration.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunDeclaration.groovy index 64626319cf..76095c238f 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunDeclaration.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunDeclaration.groovy @@ -23,7 +23,6 @@ package org.apache.ofbiz.manufacturing.jobshopmgt import org.apache.ofbiz.entity.util.EntityUtil import org.apache.ofbiz.entity.GenericValue -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun productionRunId = parameters.productionRunId ?: parameters.workEffortId if (productionRunId) { diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy index 0423668f81..ca7e7f8cc8 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy @@ -19,7 +19,6 @@ package org.apache.ofbiz.manufacturing.jobshopmgt import org.apache.ofbiz.base.util.UtilDateTime -import org.apache.ofbiz.base.util.UtilProperties import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.service.ServiceUtil diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTaskParties.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTaskParties.groovy index 7a450a2ec5..c1d8e49148 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTaskParties.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTaskParties.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.manufacturing.jobshopmgt -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun - taskPartyAssocList = [] productionRunId = parameters.productionRunId ?: parameters.workEffortId if (productionRunId) { diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTasks.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTasks.groovy index 04bdf35ff4..4a74dd6986 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTasks.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTasks.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.manufacturing.jobshopmgt -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun - productionRunId = parameters.productionRunId ?: parameters.workEffortId if (productionRunId) { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher) diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ViewProductionRun.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ViewProductionRun.groovy index 053aac6239..70ccf771a9 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ViewProductionRun.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ViewProductionRun.groovy @@ -21,8 +21,6 @@ package org.apache.ofbiz.manufacturing.jobshopmgt // The only required parameter is "productionRunId". // The "actionForm" parameter triggers actions (see "ProductionRunSimpleEvents.xml"). -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun - productionRunId = parameters.productionRunId if (productionRunId) { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher) diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/WorkWithShipmentPlans.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/WorkWithShipmentPlans.groovy index cfb6cc2816..39f327696c 100644 --- a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/WorkWithShipmentPlans.groovy +++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/WorkWithShipmentPlans.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.manufacturing.jobshopmgt -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun - // ************************************** // ShipmentPlan list form // ************************************** diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/customer/CheckoutMapProcs.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/customer/CheckoutMapProcs.groovy index 849726ae77..7e3cff333a 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/customer/CheckoutMapProcs.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/customer/CheckoutMapProcs.groovy @@ -100,4 +100,4 @@ static Map billToAddress(Map parameters) { return error(label('PartyUiLabels', 'PartyCountryMissing')) } return processedMap -} \ No newline at end of file +} diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/BillSettings.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/BillSettings.groovy index 0620df2229..1e99332372 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/BillSettings.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/entry/BillSettings.groovy @@ -18,13 +18,15 @@ */ package org.apache.ofbiz.order.entry +import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.entity.util.EntityUtil import org.apache.ofbiz.base.util.UtilHttp import org.apache.ofbiz.accounting.payment.BillingAccountWorker +import org.apache.ofbiz.order.shoppingcart.ShoppingCart -cart = session.getAttribute('shoppingCart') -orderPartyId = cart.getPartyId() -currencyUomId = cart.getCurrency() +ShoppingCart cart = session.getAttribute('shoppingCart') +String orderPartyId = cart.getPartyId() +String currencyUomId = cart.getCurrency() context.cart = cart context.paymentMethodType = request.getParameter('paymentMethodType') @@ -33,20 +35,20 @@ request.removeAttribute('_EVENT_MESSAGE_') // If there's a paymentMethodId request attribute, the user has just created a new payment method, // so put the new paymentMethodId in the context for the UI -newPaymentMethodId = request.getAttribute('paymentMethodId') +String newPaymentMethodId = request.getAttribute('paymentMethodId') if (newPaymentMethodId) { context.checkOutPaymentId = newPaymentMethodId } +GenericValue orderParty = null if (orderPartyId && '_NA_' != orderPartyId) { - orderParty = from('Party').where('partyId', orderPartyId).queryOne() - orderPerson = orderParty.getRelatedOne('Person', false) + orderParty = from('Party').where('partyId', orderPartyId).cache().queryOne() context.orderParty = orderParty - context.orderPerson = orderPerson if (orderParty) { + context.orderPerson = orderParty.getRelatedOne('Person', true) context.paymentMethodList = EntityUtil.filterByDate(orderParty.getRelated('PaymentMethod', null, null, false), true) - billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, orderPartyId, delegator, dispatcher) + List billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, orderPartyId, delegator, dispatcher) if (billingAccountList) { context.selectedBillingAccountId = cart.getBillingAccountId() context.billingAccountList = billingAccountList @@ -54,38 +56,33 @@ if (orderPartyId && '_NA_' != orderPartyId) { } } -if (request.getParameter('useShipAddr') && cart.getShippingContactMechId()) { - shippingContactMech = cart.getShippingContactMechId() - postalAddress = from('PostalAddress').where('contactMechId', shippingContactMech).queryOne() - context.postalFields = postalAddress -} else { - context.postalFields = UtilHttp.getParameterMap(request) -} +context.postalFields = request.getParameter('useShipAddr') && cart.getShippingContactMechId() + ? from('PostalAddress').where('contactMechId', cart.getShippingContactMechId()).queryOne() + : UtilHttp.getParameterMap(request) if (cart) { if (cart.getPaymentMethodIds()) { - checkOutPaymentId = cart.getPaymentMethodIds().get(0) + String checkOutPaymentId = cart.getPaymentMethodIds().first() context.checkOutPaymentId = checkOutPaymentId if (!orderParty) { - paymentMethod = from('PaymentMethod').where('paymentMethodId', checkOutPaymentId).queryOne() + GenericValue account = null + GenericValue paymentMethod = from('PaymentMethod').where(paymentMethodId: checkOutPaymentId).queryOne() if (paymentMethod?.paymentMethodTypeId == 'CREDIT_CARD') { - paymentMethodType = 'CC' + String paymentMethodType = 'CC' account = paymentMethod.getRelatedOne('CreditCard', false) context.creditCard = account context.paymentMethodType = paymentMethodType - } else if (paymentMethod.paymentMethodTypeId == 'EFT_ACCOUNT') { - paymentMethodType = 'EFT' + } else if (paymentMethod?.paymentMethodTypeId == 'EFT_ACCOUNT') { + String paymentMethodType = 'EFT' account = paymentMethod.getRelatedOne('EftAccount', false) context.eftAccount = account context.paymentMethodType = paymentMethodType } if (account) { - address = account.getRelatedOne('PostalAddress', false) - context.postalAddress = address + context.postalAddress = account.getRelatedOne('PostalAddress', false) } } } else if (cart.getPaymentMethodTypeIds()) { - checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0) - context.checkOutPaymentId = checkOutPaymentId + context.checkOutPaymentId = cart.getPaymentMethodTypeIds().first() } } diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CompanyHeader.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CompanyHeader.groovy index c2c4050b03..5cfa23b19c 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CompanyHeader.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/CompanyHeader.groovy @@ -18,20 +18,19 @@ */ package org.apache.ofbiz.order.order - // this script is used to get the company's logo header information for orders, -// invoices, and returns. It can either take order, invoice, returnHeader from - // parameters or use orderId, invoiceId, or returnId to look them up. - // if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback - import org.apache.ofbiz.base.util.UtilHttp import org.apache.ofbiz.content.data.DataResourceWorker import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.entity.util.EntityUtil -import org.apache.ofbiz.order.order.OrderReadHelper import org.apache.ofbiz.party.content.PartyContentWrapper import java.sql.Timestamp +// this script is used to get the company's logo header information for orders, +// invoices, and returns. It can either take order, invoice, returnHeader from +// parameters or use orderId, invoiceId, or returnId to look them up. +// if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback + orderHeader = parameters.orderHeader orderId = parameters.orderId invoice = parameters.invoice @@ -60,7 +59,7 @@ if (!orderHeader && orderId) { orderHeader = shipment.getRelatedOne('PrimaryOrderHeader', false) } -if (!invoice && invoiceId) { +if (!invoice && invoiceId) { invoice = from('Invoice').where('invoiceId', invoiceId).queryOne() try { UtilHttp.setContentDisposition(response, invoiceId + '.pdf') @@ -98,7 +97,7 @@ if (orderHeader) { partyId = productStore.payToPartyId } } - // purchase orders - use the BILL_TO_CUSTOMER of the order + // purchase orders - use the BILL_TO_CUSTOMER of the order } else if (orderHeader.orderTypeId == 'PURCHASE_ORDER') { GenericValue billToParty = orh.getBillToParty() if (billToParty) { @@ -188,7 +187,7 @@ address = null if (addresses) { address = from('PostalAddress').where('contactMechId', addresses[0].contactMechId).queryOne() } -if (address) { +if (address) { // get the country name and state/province abbreviation country = address.getRelatedOne('CountryGeo', true) if (country) { @@ -232,9 +231,9 @@ if (emails) { .queryList() if (selContacts) { i = selContacts.iterator() - while (i.hasNext()) { + while (i.hasNext()) { email = i.next().getRelatedOne('ContactMech', false) - if (email.contactMechTypeId == 'ELECTRONIC_ADDRESS') { + if (email.contactMechTypeId == 'ELECTRONIC_ADDRESS') { context.email = email break } @@ -257,7 +256,7 @@ if (websiteUrls) { .queryList() if (selContacts) { Iterator i = selContacts.iterator() - while (i.hasNext()) { + while (i.hasNext()) { website = i.next().getRelatedOne('ContactMech', false) if (website.contactMechTypeId == 'WEB_ADDRESS') { context.website = website diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/FilterOrderList.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/FilterOrderList.groovy index 50ffc92349..1984441810 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/FilterOrderList.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/FilterOrderList.groovy @@ -18,9 +18,7 @@ */ package org.apache.ofbiz.order.order -import org.apache.ofbiz.order.order.OrderReadHelper import org.apache.ofbiz.product.store.ProductStoreWorker -import org.apache.ofbiz.order.order.OrderListState orderHeaderList = context.orderHeaderList productStore = ProductStoreWorker.getProductStore(request) diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderList.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderList.groovy index 41c1a374af..e5e32ba026 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderList.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderList.groovy @@ -20,7 +20,6 @@ package org.apache.ofbiz.order.order import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityOperator -import org.apache.ofbiz.order.order.OrderListState partyId = request.getParameter('partyId') facilityId = request.getParameter('facilityId') diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderView.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderView.groovy index 447d29da09..a026215052 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderView.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderView.groovy @@ -26,7 +26,6 @@ import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityOperator import org.apache.ofbiz.entity.util.EntityUtil -import org.apache.ofbiz.order.order.OrderReadHelper import org.apache.ofbiz.party.contact.ContactHelper import org.apache.ofbiz.party.contact.ContactMechWorker import org.apache.ofbiz.product.catalog.CatalogWorker diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderViewWebSecure.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderViewWebSecure.groovy index d4ab405065..bce8b3bc0e 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderViewWebSecure.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderViewWebSecure.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.order.order -import org.apache.ofbiz.order.order.OrderContentWrapper - orderHeader = context.orderHeader // can anybody view an anonymous order? this is set in the screen widget and should only be turned on by an email confirmation screen diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/ViewImage.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/ViewImage.groovy index 2d872e207a..5da4243a29 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/ViewImage.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/ViewImage.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.order.order -import org.apache.ofbiz.order.order.OrderContentWrapper - orderId = request.getParameter('orderId') orderItemSeqId = request.getParameter('orderItemSeqId') orderContentTypeId = request.getParameter('orderContentTypeId') diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/QuickReturn.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/QuickReturn.groovy similarity index 98% rename from applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/QuickReturn.groovy rename to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/QuickReturn.groovy index 59ffbdda15..55185b9867 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/QuickReturn.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/QuickReturn.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ofbiz.order.orderReturn +package org.apache.ofbiz.order.orderreturn import org.apache.ofbiz.order.order.OrderReadHelper import org.apache.ofbiz.party.contact.ContactHelper diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHeader.groovy similarity index 98% rename from applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy rename to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHeader.groovy index 50097a5cbe..dbad942ca2 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHeader.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ofbiz.order.orderReturn +package org.apache.ofbiz.order.orderreturn import org.apache.ofbiz.entity.util.EntityUtil import org.apache.ofbiz.party.contact.ContactHelper diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy similarity index 97% rename from applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy rename to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy index 32a8c9d3dc..24ed6be805 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ofbiz.order.orderReturn +package org.apache.ofbiz.order.orderreturn import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityOperator diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnItems.groovy similarity index 98% rename from applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy rename to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnItems.groovy index b63d5da77e..f406948b22 100644 --- a/applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy +++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnItems.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.ofbiz.order.orderReturn +package org.apache.ofbiz.order.orderreturn import org.apache.ofbiz.order.order.OrderReadHelper diff --git a/applications/order/widget/ordermgr/OrderPrintScreens.xml b/applications/order/widget/ordermgr/OrderPrintScreens.xml index d55f55a43d..e44b18471f 100644 --- a/applications/order/widget/ordermgr/OrderPrintScreens.xml +++ b/applications/order/widget/ordermgr/OrderPrintScreens.xml @@ -123,8 +123,8 @@ under the License. <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHeader.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnItems.groovy"/> </actions> <widgets> <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml"> diff --git a/applications/order/widget/ordermgr/OrderReturnScreens.xml b/applications/order/widget/ordermgr/OrderReturnScreens.xml index 8b19800c34..b23f1ca349 100644 --- a/applications/order/widget/ordermgr/OrderReturnScreens.xml +++ b/applications/order/widget/ordermgr/OrderReturnScreens.xml @@ -86,7 +86,7 @@ under the License. <set field="titleProperty" value="PageTitleFindQuickReturn"/> <set field="headerItem" value="return"/> <set field="helpAnchor" value="_quick_return"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/QuickReturn.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/QuickReturn.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderReturnDecorator" location="${parameters.orderReturnDecoratorLocation}"> @@ -110,7 +110,7 @@ under the License. <set field="helpAnchor" value="_create_return"/> <set field="layoutSettings.javaScripts[+0]" value="/ordermgr-js/return.js" global="true"/> <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHeader.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderReturnDecorator" location="${parameters.orderReturnDecoratorLocation}"> @@ -155,7 +155,7 @@ under the License. <set field="headerItem" value="return"/> <set field="tabButtonItem" value="OrderReturnItems"/> <set field="helpAnchor" value="_create_return"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnItems.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderReturnDecorator" location="${parameters.orderReturnDecoratorLocation}"> @@ -181,7 +181,7 @@ under the License. <set field="headerItem" value="return"/> <set field="tabButtonItem" value="OrderReturnHistory"/> <set field="returnId" from-field="parameters.returnId"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnItems.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderReturnDecorator" location="${parameters.orderReturnDecoratorLocation}"> @@ -229,7 +229,7 @@ under the License. <section> <actions> <set field="entityField" value="returnTypeId"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy"/> </actions> <widgets> <section> @@ -256,7 +256,7 @@ under the License. <section> <actions> <set field="entityField" value="returnReasonId"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy"/> </actions> <widgets> <section> @@ -283,7 +283,7 @@ under the License. <section> <actions> <set field="entityField" value="returnQuantity"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy"/> </actions> <widgets> <section> @@ -310,7 +310,7 @@ under the License. <section> <actions> <set field="entityField" value="receivedQuantity"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy"/> </actions> <widgets> <section> @@ -337,7 +337,7 @@ under the License. <section> <actions> <set field="entityField" value="returnPrice"/> - <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy"/> + <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy"/> </actions> <widgets> <section> diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/EditShoppingList.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/EditShoppingList.groovy index 65468919e5..8d34dcca48 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/EditShoppingList.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/EditShoppingList.groovy @@ -104,7 +104,7 @@ if (shoppingListId) { } context.shoppingListItemDatas = shoppingListItemDatas // pagination for the shopping list - viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0) + viewIndex = Integer.valueOf(parameters.VIEW_INDEX ?: 0) viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : modelTheme.getDefaultViewSize() ?: 20 listSize = shoppingListItemDatas ? shoppingListItemDatas.size() : 0 diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/FindMatches.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/FindMatches.groovy index 32c7313c61..0e3b9a7f34 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/FindMatches.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/FindMatches.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.party.party -import org.apache.ofbiz.party.party.PartyWorker - match = parameters.match if (match) { context.match = match diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy index 35b7912887..0cb6a63311 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.party.party -import org.apache.ofbiz.party.party.PartyHelper - import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.entity.GenericValue diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy index 2c17a6ec07..b086fbb25a 100644 --- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy +++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy @@ -29,7 +29,6 @@ import org.apache.ofbiz.base.util.StringUtil import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.service.ServiceUtil -import org.apache.ofbiz.party.party.PartyHelper /** * Save Party Name Change diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy index 249f77ff5c..b089b3c45b 100644 --- a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy +++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/imagemanagement/ImageManagementServicesScript.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.product.product.imagemanagement -import java.sql.Timestamp - import org.apache.ofbiz.base.util.ScriptUtil import org.apache.ofbiz.base.util.StringUtil import org.apache.ofbiz.base.util.UtilDateTime @@ -27,6 +25,8 @@ import org.apache.ofbiz.base.util.UtilProperties import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.service.ServiceUtil +import java.sql.Timestamp + /** * Method to upload multiple images for product */ @@ -175,7 +175,7 @@ Map removeProductContentAndImageFile() { Map removeContent Map serviceResult = [:] List checkDefaultImage = from('ProductContent').where(productId: parameters.productId, contentId: parameters.contentId, - productContentTypeId: 'DEFAULT_IMAGE').queryList() + productContentTypeId: 'DEFAULT_IMAGE').queryList() if (checkDefaultImage) { String errorMessage = UtilProperties.getMessage('ProductErrorUiLabels', 'ImageManagementErrorRmoveDefaultImage', locale) logError("Cannot remove image contentId ${parameters.contentId}") @@ -233,7 +233,7 @@ Map removeProductContentForImageManagement() { } GenericValue dataResource = from('DataResource').where(dataResourceId: dataResourceId).queryOne() Map removeImageFile = [productId: parameters.productId, contentId: parameters.contentId, objectInfo: dataResource.objectInfo, - dataResourceName: dataResource.dataResourceName] + dataResourceName: dataResource.dataResourceName] serviceResult = run service: 'removeImageFileForImageManagement', with: removeImageFile if (!ServiceUtil.isSuccess(serviceResult)) { return error(serviceResult.errorMessage) @@ -255,7 +255,9 @@ Map setImageDetail() { productContent.sequenceNum = parameters.sequenceNum productContent.store() if (parameters.sequenceNum) { - ScriptUtil.executeScript('component://product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/SortSequenceNum.groovy', null, context) + ScriptUtil.executeScript( + 'component://product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/SortSequenceNum.groovy', + null, context) productContent.sequenceNum = parameters.sequenceNum productContent.store() } @@ -293,7 +295,7 @@ Map updateStatusImageManagement() { } } else { GenericValue contentApproval = from('ContentApproval').where(partyId: userLogin.partyId, contentId: parameters.contentId, - roleTypeId: 'IMAGEAPPROVER').queryFirst() + roleTypeId: 'IMAGEAPPROVER').queryFirst() contentApproval.approvalStatusId = parameters.checkStatusId contentApproval.store() } @@ -317,24 +319,24 @@ Map updateStatusImageManagement() { content.store() GenericValue productContent = from('ProductContent').where(contentId: parameters.contentId, productContentTypeId: 'IMAGE') - .queryFirst() + .queryFirst() productContent.purchaseFromDate = nowTimestamp productContent.store() } else { Long countApprove = from('ContentApproval').where(contentId: parameters.contentId, roleTypeId: 'IMAGEAPPROVER', - approvalStatusId: 'IM_APPROVED').queryCount() + approvalStatusId: 'IM_APPROVED').queryCount() if (countApprove >= (Long) 2) { GenericValue content = from('Content').where(parameters).queryOne() content.statusId = 'IM_APPROVED' content.store() GenericValue productContent = from('ProductContent').where(contentId: parameters.contentId, productContentTypeId: 'IMAGE') - .queryFirst() + .queryFirst() productContent.purchaseFromDate = nowTimestamp productContent.store() List checkApproveList = from('ContentApproval').where(contentId: parameters.contentId, roleTypeId: 'IMAGEAPPROVER') - .queryList() + .queryList() for (GenericValue checkApprove : checkApproveList) { checkApprove.approvalStatusId = 'IM_APPROVED' checkApprove.store() @@ -398,7 +400,7 @@ Map createImageContentApproval() { List partyRoles = from('PartyRole').where(roleTypeId: 'IMAGEAPPROVER').queryList() for (GenericValue partyRole : partyRoles) { Map contentApproval = [partyId: partyRole.partyId, contentId: parameters.contentId, roleTypeId: 'IMAGEAPPROVER', - approvalDate: nowTimestamp, approvalStatusId: 'IM_PENDING'] + approvalDate: nowTimestamp, approvalStatusId: 'IM_PENDING'] Map serviceResult = run service: 'createContentApproval', with: contentApproval if (!ServiceUtil.isSuccess(serviceResult)) { return error(serviceResult.errorMessage) @@ -428,7 +430,7 @@ Map resizeImages() { // <field-map field-name="statusId" value="IM_APPROVED"/> for (GenericValue productContentAndInfo : productContentAndInfos) { Map resizeImageMap = [productId: productContentAndInfo.productId, dataResourceName: productContentAndInfo.drDataResourceName, - resizeWidth: parameters.size] + resizeWidth: parameters.size] serviceResult = run service: 'resizeImageOfProduct', with: resizeImageMap if (!ServiceUtil.isSuccess(serviceResult)) { return error(serviceResult.errorMessage) @@ -442,8 +444,10 @@ Map resizeImages() { List productContentAndInfos = from('ProductContentAndInfo').where(productId: parameters.productId, productContentTypeId: 'IMAGE').queryList() // <field-map field-name="statusId" value="IM_APPROVED"/> for (GenericValue productContentAndInfo : productContentAndInfos) { - Map createNewImageThumbnailMap = [productId: productContentAndInfo.productId, contentId: productContentAndInfo.contentId, - dataResourceName: productContentAndInfo.drDataResourceName, drObjectInfo: productContentAndInfo.drObjectInfo, + Map createNewImageThumbnailMap = [productId: productContentAndInfo.productId, + contentId: productContentAndInfo.contentId, + dataResourceName: productContentAndInfo.drDataResourceName, + drObjectInfo: productContentAndInfo.drObjectInfo, sizeWidth: parameters.size] serviceResult = run service: 'createNewImageThumbnail', with: createNewImageThumbnailMap if (!ServiceUtil.isSuccess(serviceResult)) { @@ -462,7 +466,7 @@ Map removeImageBySize() { // <field-map field-name="statusId" value="IM_APPROVED"/> for (GenericValue productContentAndInfo : productContentAndInfos) { List contentAssocs = from('ContentAssoc').where(contentId: productContentAndInfo.contentId, contentAssocTypeId: 'IMAGE_THUMBNAIL', - mapKey: parameters.mapKey).queryList() + mapKey: parameters.mapKey).queryList() if (contentAssocs) { contentAssocs.each { GenericValue contentAssoc -> contentAssoc.remove() diff --git a/build.gradle b/build.gradle index e079597a3f..3248172272 100644 --- a/build.gradle +++ b/build.gradle @@ -349,8 +349,8 @@ gitHooks { codenarc { setConfigFile(new File('config/codenarc/codenarc.groovy')) setMaxPriority1Violations(0) - setMaxPriority2Violations(410) - setMaxPriority3Violations(3974) + setMaxPriority2Violations(403) + setMaxPriority3Violations(3920) } // Eclipse plugin settings diff --git a/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy b/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy index abde52d4c9..cf07e7634e 100644 --- a/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy +++ b/framework/common/src/main/groovy/org/apache/ofbiz/common/CommonServicesScript.groovy @@ -24,7 +24,6 @@ import java.text.SimpleDateFormat import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.base.util.UtilProperties -import org.apache.ofbiz.common.CommonWorkers import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.service.ModelService import org.apache.ofbiz.service.ServiceUtil @@ -351,9 +350,9 @@ Map createFuturePeriod() { applTypes = [] grain = null intermediate = null - parties = from('PartyAcctgPreference').where('enableAccounting', 'Y').queryIterator() - while (party = parties.next()) { - parameters.organizationPartyId = party.partyId + List parties = from('PartyAcctgPreference').where('enableAccounting', 'Y').queryList() + parties.each { + parameters.organizationPartyId = it.partyId createCustomTimePeriod = from('SystemProperty') .where('systemResourceId', 'general', 'systemPropertyId', 'CustomTimePeriod.create').queryOne() if (createCustomTimePeriod.systemPropertyValue == 'Y') { @@ -441,6 +440,5 @@ Map createFuturePeriod() { } } } - parties.close() return success() } diff --git a/framework/webapp/src/main/groovy/org/apache/ofbiz/webapp/test/OfbizPathShortenerTests.groovy b/framework/webapp/src/main/groovy/org/apache/ofbiz/webapp/test/OfbizPathShortenerTests.groovy index 29099b6d18..5a0aebcbae 100644 --- a/framework/webapp/src/main/groovy/org/apache/ofbiz/webapp/test/OfbizPathShortenerTests.groovy +++ b/framework/webapp/src/main/groovy/org/apache/ofbiz/webapp/test/OfbizPathShortenerTests.groovy @@ -46,8 +46,8 @@ class OfbizPathShortenerTests extends OFBizTestCase { 'LL.eyJ1c2VyTG9naW5JZCI6Imx1Y2lsZS5wZWxsZXRpZXJAZWRsbi5vcmciLCJpc3MiOiJBcGFjaGVPRkJpeiIsImV4cCI6MTcyNTU' + '0MjM0OSwiaWF0IjoxNzI1NTQwNTQLLL.Rycl_L-u4ZeWkx82pWWGu7gycfsHQxIxE8zu1nQ5oueGDBeOXALL-SJzMuvSARbpxCwF9A' + 'jl4rTxgoEYuRMoHg&JavaScriptEnabled=Y&And=Again' - String shortUriFirst = OfbizPathShortener.resolveShortenedPath(this.getDelegator(),longUri) - String shortUriSecond = OfbizPathShortener.resolveShortenedPath(this.getDelegator(),longUri) + String shortUriFirst = OfbizPathShortener.resolveShortenedPath(this.getDelegator(), longUri) + String shortUriSecond = OfbizPathShortener.resolveShortenedPath(this.getDelegator(), longUri) assert shortUriSecond == shortUriFirst } diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/FindGeneric.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/FindGeneric.groovy index e353a52b6d..4d6535a4b8 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/FindGeneric.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/entity/FindGeneric.groovy @@ -35,7 +35,7 @@ ModelEntity modelEntity = null // escape the security url encoding that break the sortField with the ftl rendering // no security issue here, nothing come from the request -context.escapeUrlEncode = "true" +context.escapeUrlEncode = 'true' try { modelEntity = delegator.getModelEntity(parameters.entityName) diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/LabelManager.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/LabelManager.groovy index 4e6075d8aa..aa30c9f4e3 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/LabelManager.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/LabelManager.groovy @@ -18,9 +18,6 @@ */ package org.apache.ofbiz.webtools.labelmanager -import org.apache.ofbiz.webtools.labelmanager.LabelManagerFactory -import org.apache.ofbiz.webtools.labelmanager.LabelReferences - LabelManagerFactory factory = LabelManagerFactory.getInstance() context.factory = factory factory.findMatchingLabels(parameters.labelComponentName, parameters.labelFileName, parameters.labelKey, diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/UpdateManager.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/UpdateManager.groovy index 4dea08501c..f16305b8c7 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/UpdateManager.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/UpdateManager.groovy @@ -18,8 +18,6 @@ */ package org.apache.ofbiz.webtools.labelmanager -import org.apache.ofbiz.webtools.labelmanager.LabelManagerFactory - LabelManagerFactory factory = LabelManagerFactory.getInstance() factory.findMatchingLabels(null, parameters.sourceFileName, parameters.sourceKey, null, false) context.labels = factory.getLabels() diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/ViewReferences.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/ViewReferences.groovy index de9f402ed0..4f608b211c 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/ViewReferences.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/labelmanager/ViewReferences.groovy @@ -18,9 +18,6 @@ */ package org.apache.ofbiz.webtools.labelmanager -import org.apache.ofbiz.webtools.labelmanager.LabelManagerFactory -import org.apache.ofbiz.webtools.labelmanager.LabelReferences - LabelManagerFactory factory = LabelManagerFactory.getInstance() context.factory = factory factory.findMatchingLabels(parameters.labelComponentName, parameters.labelFileName, parameters.sourceKey, parameters.labelLocaleName, false) diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy index d6e1faf507..b6cdf5d0b3 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy @@ -97,7 +97,6 @@ if (serviceName) { } context.serviceParameters = serviceParameters - private String prepareServiceParamFieldHtml(Delegator delegator, ModelParam modelParam, ModelForm form, Map context, MacroFormRenderer renderer, ModelService modelService) { Writer writer = new StringWriter()