This is an automated email from the ASF dual-hosted git repository.
ashishvijaywargiya 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 5a0be63e93 Groovy dsl enhancement applied (#2018)
5a0be63e93 is described below
commit 5a0be63e931c5654f69956d1ba187c1ab3e84563
Author: Ashish Vijaywargiya <[email protected]>
AuthorDate: Wed Sep 16 12:42:04 2026 +0530
Groovy dsl enhancement applied (#2018)
The following changes were made to the Groovy DSL enhancements, now applied
the changes to all ofbiz-framework and ofbiz-plugins:
- Applied the new error/success/failure(resource, key[, context]) i18n
overloads across 26 Groovy scripts (25 in ofbiz-framework, 1 in ofbiz-plugins),
replacing manual UtilProperties.getMessage(...) calls at 128 reviewed call
sites, and along the way fixed a latent bug in ContentPermissionServices.groovy
that called a nonexistent UtilProperties.getMessage overload (would have thrown
MissingMethodException if ever hit).
- Applied the write-side entity DSL create()/delete() methods across 8
files, converting delegator.makeValidValue()+create() and
delegator.removeByAnd() call sites to the fluent create(entityName, fields) /
delete(entityName).where(fields) forms.
- Applied the write-side entity DSL update() method across 15 services,
converting 29 find-then-mutate-then-store() sites to
update(entityName).where(cond).set(fields), out of ~145 originally scanned,
after a full per-site audit that deliberately left self-referential updates,
multi-record loops, and pre-mutation-snapshot sites untouched as not a safe
mechanical fit.
- Found and fixed a real bug in the DSL itself while applying update():
EntityUpdateBuilder.set() threw on non-entity keys (e.g. userLogin) when passed
a raw service parameters map, which is exactly how most call sites use it;
switched to setNonPKFields() to match create()'s existing safety behavior.
- Applied the runAsync service:/with: DSL sugar to sendInvoicePerEmail,
replacing its manual makeValidContext() + dispatcher.runAsync() call with the
equivalent one-line form.
- Verified with the accounting, content, order, party, product, and
workeffort component test suites (all passing), a full testIntegration run for
the i18n rollout (685/685 passing), and checkstyleMain/codenarcMain clean
throughout.
- No changes to the DSL surface itself beyond the one
EntityUpdateBuilder.set() bugfix — GroovyBaseScript, EntityDeleteBuilder, and
the DSL's own test suite are untouched by this rollout.
---
.../accounting/admin/AcctgAdminServices.groovy | 3 +-
.../fixedasset/FixedAssetServices.groovy | 2 +-
.../invoice/InvoiceServicesScript.groovy | 14 ++--
.../ofbiz/accounting/rate/RateServices.groovy | 10 +--
.../commonext/ofbizsetup/SystemInfoServices.groovy | 2 +-
.../content/content/ContentServicesScript.groovy | 7 +-
.../ofbiz/content/data/DataServicesScript.groovy | 10 +--
.../permission/ContentPermissionServices.groovy | 3 +-
.../ofbiz/marketing/sfa/lead/LeadServices.groovy | 2 +-
.../ofbiz/order/order/OrderDeliveryServices.groovy | 10 +--
.../order/OrderRequirementServicesScript.groovy | 5 +-
.../order/order/OrderReturnServicesScript.groovy | 4 +-
.../ofbiz/order/quote/QuoteServicesScript.groovy | 70 +++++++++---------
.../shoppinglist/ShoppingListServicesScript.groovy | 15 ++--
.../party/contact/ContactMechServicesScript.groovy | 45 ++++++------
.../party/party/PartyPermissionServices.groovy | 10 ++-
.../ofbiz/party/party/PartyServicesScript.groovy | 7 +-
.../product/catalog/category/EditCategory.groovy | 5 +-
.../config/EditProductConfigItemContent.groovy | 5 +-
.../catalog/imagemanagement/ImageUpload.groovy | 5 +-
.../catalog/product/EditProductContent.groovy | 5 +-
.../facility/facility/FacilityGeoServices.groovy | 5 +-
.../category/CategoryContentServicesScript.groovy | 4 +-
.../product/category/CategoryServicesScript.groovy | 57 +++++++--------
.../ProductConfigItemContentServicesScript.groovy | 4 +-
.../feature/ProductFeatureServicesScript.groovy | 10 +--
.../ImageManagementServicesScript.groovy | 12 ++--
.../inventory/InventoryIssueServices.groovy | 3 +-
.../inventory/InventoryServicesScript.groovy | 6 +-
.../product/price/PriceServicesScript.groovy | 20 +++---
.../product/ProductContentServicesScript.groovy | 4 +-
.../product/product/ProductServicesScript.groovy | 82 ++++++++--------------
.../product/store/ProductStoreServices.groovy | 28 ++++----
.../shipment/ShipmentReceiptServices.groovy | 16 ++---
.../ofbiz/product/shipment/ShipmentServices.groovy | 41 +++++------
.../workeffort/WorkEffortServicesScript.groovy | 8 +--
.../ofbiz/common/CommonServicesScript.groovy | 8 +--
.../apache/ofbiz/common/PortalPageMethods.groovy | 6 +-
.../apache/ofbiz/common/PortalPageServices.groovy | 6 +-
.../ofbiz/common/SetTimeZoneFromBrowser.groovy | 6 +-
.../ofbiz/common/email/EmailServicesScript.groovy | 2 +-
.../permission/CommonPermissionServices.groovy | 6 +-
.../ofbiz/entityext/EntitySyncServices.groovy | 3 +-
.../service/engine/EntityUpdateBuilder.groovy | 6 +-
44 files changed, 247 insertions(+), 335 deletions(-)
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
index 30eccf1842..be63de08f9 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
@@ -41,8 +41,7 @@ Map createPartyAcctgPreference() {
//Does not check if the Party is actually a company because real people
have to pay taxes too
//TODO: maybe check to make sure that all fields are not null
- newEntity = delegator.makeValidValue('PartyAcctgPreference', parameters)
- delegator.create(newEntity)
+ create('PartyAcctgPreference', parameters)
return success()
}
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/fixedasset/FixedAssetServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/fixedasset/FixedAssetServices.groovy
index a463a01b70..1d4f01c80e 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/fixedasset/FixedAssetServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/fixedasset/FixedAssetServices.groovy
@@ -227,7 +227,7 @@ Map createFixedAssetMaintOrder() {
} else {
parameters.orderItemSeqId = from('OrderItem').where(orderId:
lookedUpValue.orderId).queryList()?.orderItemSeqId
}
- delegator.create('FixedAssetMaintOrder', parameters)
+ create('FixedAssetMaintOrder', parameters)
return success()
}
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
index d72fb637d9..735edd253a 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
@@ -339,14 +339,12 @@ Map cancelInvoice() {
* @return Success response
*/
Map sendInvoicePerEmail() {
- Map emailParams = dispatcher.getDispatchContext()
- .makeValidContext('sendMailFromScreen', 'IN', [*: parameters,
- xslfoAttachScreenLocation:
'component://accounting/widget/AccountingPrintScreens.xml#InvoicePDF',
- bodyParameters: [invoiceId:
parameters.invoiceId,
- userLogin:
parameters.userLogin,
- other: parameters.other] //to
print in 'other currency'
- ])
- dispatcher.runAsync('sendMailFromScreen', emailParams)
+ runAsync service: 'sendMailFromScreen', with: [*: parameters,
+ xslfoAttachScreenLocation:
'component://accounting/widget/AccountingPrintScreens.xml#InvoicePDF',
+ bodyParameters: [invoiceId: parameters.invoiceId,
+ userLogin: parameters.userLogin,
+ other: parameters.other] //to print in
'other currency'
+ ]
return success(label('AccountingUiLabels',
'AccountingEmailScheduledToSend'))
}
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
index d883049f50..029ff21b10 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
@@ -51,7 +51,7 @@ Map updateRateAmount() {
return result
}
} else {
- return error(UtilProperties.getMessage('AccountingErrorUiLabels',
'AccountingUpdateRateAmountAlreadyExist', locale))
+ return error('AccountingErrorUiLabels',
'AccountingUpdateRateAmountAlreadyExist')
}
}
updating ? newEntity.store() : newEntity.create()
@@ -71,7 +71,7 @@ Map expireRateAmount() {
lookedUpValue.thruDate = UtilDateTime.getDayEnd(previousDay)
lookedUpValue.store()
} else {
- return error(UtilProperties.getMessage('AccountingErrorUiLabels',
'AccountingDeleteRateAmount', locale))
+ return error('AccountingErrorUiLabels', 'AccountingDeleteRateAmount')
}
return success()
}
@@ -89,9 +89,9 @@ Map updatePartyRate() {
partyRate.thruDate = UtilDateTime.nowTimestamp()
partyRate.store()
}
- GenericValue newEntity = delegator.makeValidValue('PartyRate', parameters)
- newEntity.fromDate = newEntity.fromDate ?: UtilDateTime.nowTimestamp()
- newEntity.create()
+ Map partyRateFields = [*: parameters]
+ partyRateFields.fromDate = partyRateFields.fromDate ?:
UtilDateTime.nowTimestamp()
+ GenericValue newEntity = create('PartyRate', partyRateFields)
//check other default rate to desactive them
if (newEntity.defaultRate == 'Y') {
diff --git
a/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoServices.groovy
b/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoServices.groovy
index 29c386b0c1..68a28ac6b7 100644
---
a/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoServices.groovy
+++
b/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoServices.groovy
@@ -47,7 +47,7 @@ Map deleteSystemInfoNote() {
}
Map deleteAllSystemNotes() {
- delegator.removeByAnd('NoteData', [noteParty: userLogin.partyId, noteName:
'SYSTEMNOTE'])
+ delete('NoteData').where([noteParty: userLogin.partyId, noteName:
'SYSTEMNOTE'])
return success()
}
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 ac622fcfa2..8580f69e7a 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
@@ -19,7 +19,6 @@
package org.apache.ofbiz.content.content
import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.common.UrlServletHelper
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.condition.EntityCondition
@@ -69,7 +68,7 @@ Map findAssocContent() {
}
Map updateSingleContentPurpose() {
- delegator.removeByAnd('ContentPurpose', [contentId: parameters.contentId])
+ delete('ContentPurpose').where([contentId: parameters.contentId])
run service: 'createContentPurpose', with: parameters
}
@@ -447,8 +446,8 @@ Map getContentAndDataResource() {
Map createContentFromDataResource() {
GenericValue dataResource =
from('DataResource').where(parameters).queryOne()
if (!dataResource) {
- return error(UtilProperties.getMessage('ContentUiLabels',
'ContentDataResourceNotFound',
- [dataResourceId: parameters.dataResourceId],
parameters.locale))
+ return error('ContentUiLabels', 'ContentDataResourceNotFound',
+ [dataResourceId: parameters.dataResourceId])
}
parameters.contentName = parameters.contentName ?:
dataResource.dataResourceName
parameters.contentTypeId = parameters.contentTypeId ?: 'DOCUMENT'
diff --git
a/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
b/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
index 20a258bfa5..8be16a4f95 100644
---
a/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
+++
b/applications/content/src/main/groovy/org/apache/ofbiz/content/data/DataServicesScript.groovy
@@ -75,7 +75,7 @@ Map createDataResource() {
Map createDataResourceAndAssocToContent() {
GenericValue content = from('Content').where(parameters).queryOne()
if (!content) {
- return error(UtilProperties.getMessage('ContentErrorUiLabels',
'layoutEvents.content_empty', parameters.locale))
+ return error('ContentErrorUiLabels', 'layoutEvents.content_empty')
}
Map serviceResult = run service: 'createDataResource', with: parameters
@@ -119,16 +119,16 @@ Map getElectronicText() {
currentContent = from('Content').where(parameters).queryOne()
}
if (!currentContent) {
- return error(UtilProperties.getMessage('ContentUiLabels',
'ContentNeitherContentSupplied', parameters.locale))
+ return error('ContentUiLabels', 'ContentNeitherContentSupplied')
}
}
if (!currentContent.dataResourceId) {
- return error(UtilProperties.getMessage('ContentUiLabels',
'ContentDataResourceNotFound', parameters.locale))
+ return error('ContentUiLabels', 'ContentDataResourceNotFound')
}
result.dataResourceId = currentContent.dataResourceId
GenericValue eText = from('ElectronicText').where('dataResourceId',
currentContent.dataResourceId).queryOne()
if (!eText) {
- return error(UtilProperties.getMessage('ContentUiLabels',
'ContentElectronicTextNotFound', parameters.locale))
+ return error('ContentUiLabels', 'ContentElectronicTextNotFound')
}
result.textData = eText.textData
return result
@@ -371,5 +371,5 @@ Map prepareServiceContext(GenericValue dataResource, String
mode) {
serviceContext.dataResourceContent = parameters.uploadedFile
return serviceContext
}
- return error(UtilProperties.getMessage('ContentUiLabels',
'ContentDataTypeNotYetSupported', parameters.locale))
+ return error('ContentUiLabels', 'ContentDataTypeNotYetSupported')
}
diff --git
a/applications/content/src/main/groovy/org/apache/ofbiz/content/permission/ContentPermissionServices.groovy
b/applications/content/src/main/groovy/org/apache/ofbiz/content/permission/ContentPermissionServices.groovy
index 1e217ec2d9..2b49817a16 100644
---
a/applications/content/src/main/groovy/org/apache/ofbiz/content/permission/ContentPermissionServices.groovy
+++
b/applications/content/src/main/groovy/org/apache/ofbiz/content/permission/ContentPermissionServices.groovy
@@ -18,7 +18,6 @@
*/
package org.apache.ofbiz.content.permission
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
/**
@@ -129,7 +128,7 @@ Map viewContentPermission(Boolean hasPermission, String
contentId, String conten
// contentId is required for update checking
contentId = contentId ?: parameters.contentId
if (!contentId) {
- return error(UtilProperties.getMessage('ContentUiLabels',
'ContentViewPermissionError'))
+ return error('ContentUiLabels', 'ContentViewPermissionError')
}
//check the operation security
diff --git
a/applications/marketing/src/main/groovy/org/apache/ofbiz/marketing/sfa/lead/LeadServices.groovy
b/applications/marketing/src/main/groovy/org/apache/ofbiz/marketing/sfa/lead/LeadServices.groovy
index 4cbf4e452e..77c1661379 100644
---
a/applications/marketing/src/main/groovy/org/apache/ofbiz/marketing/sfa/lead/LeadServices.groovy
+++
b/applications/marketing/src/main/groovy/org/apache/ofbiz/marketing/sfa/lead/LeadServices.groovy
@@ -33,7 +33,7 @@ Map createLead() {
Map serviceResult
// Check if Person or PartyGroup name is supplied
if ((!parameters.firstName || !parameters.lastName) &&
!parameters.groupName) {
- return error(UtilProperties.getMessage('MarketingUiLabels',
'SfaFirstNameLastNameAndCompanyNameMissingError', locale))
+ return error('MarketingUiLabels',
'SfaFirstNameLastNameAndCompanyNameMissingError')
}
run service: 'ensurePartyRole', with: [partyId: userLogin.partyId,
roleTypeId: 'OWNER']
// PartyRole check end
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
index cc13f39b6c..b9c1b0e89e 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderDeliveryServices.groovy
@@ -56,17 +56,13 @@ Map updateOrderDeliverySchedule() {
return serviceResult
}
- // Lookup the existing schedule to modify
- GenericValue schedule =
from('OrderDeliverySchedule').where(parameters).queryOne()
-
// only set statusId if hasScheduleAdminRelatedPermission
- String saveStatusId = schedule.statusId
- schedule.setNonPKFields(parameters)
+ Map updateFields = [*: parameters]
if (!security.hasEntityPermission('ORDERMGR', ('_' + checkAction),
parameters.userLogin)) {
- schedule.statusId = saveStatusId
+ updateFields.remove('statusId')
}
// Update the actual schedule
- schedule.store()
+ update('OrderDeliverySchedule').where(parameters).set(updateFields)
return success()
}
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
index 50428ca0eb..99dfd0af6a 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderRequirementServicesScript.groovy
@@ -19,7 +19,6 @@
package org.apache.ofbiz.order.order
import org.apache.ofbiz.base.util.Debug
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityTypeUtil
import org.apache.ofbiz.service.ServiceUtil
@@ -87,7 +86,7 @@ Map checkCreateStockRequirementAtp() {
Map checkCreateStockRequirement(String methodId) {
if (!(security.hasEntityPermission('ORDERMGR', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCheckCreateStockRequirement', parameters.locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCheckCreateStockRequirement')
}
Map resultMap = success()
@@ -161,7 +160,7 @@ Map checkCreateStockRequirement(String methodId) {
Map checkCreateProductRequirementForFacility() {
if (!(security.hasEntityPermission('ORDERMGR', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCheckCreateStockRequirement', parameters.locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCheckCreateStockRequirement')
}
Map resultMap = success()
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
index b1d2be5576..752ae9cd14 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderReturnServicesScript.groovy
@@ -874,7 +874,6 @@ Map createReturnStatus() {
Map updateReturnContactMech() {
GenericValue returnContactMechMap = makeValue('ReturnContactMech')
returnContactMechMap.setPKFields(parameters)
- GenericValue returnHeader =
from('ReturnHeader').where(parameters).queryOne()
Map createReturnContactMechMap = [returnId: parameters.returnId,
contactMechPurposeTypeId: parameters.contactMechPurposeTypeId,
contactMechId: parameters.contactMechId]
@@ -882,8 +881,7 @@ Map updateReturnContactMech() {
// If returnContactMechList value is null then create new entry in
ReturnContactMech entity
if (!returnContactMechList) {
if (parameters.contactMechPurposeTypeId == 'SHIPPING_LOCATION') {
- returnHeader.originContactMechId =
createReturnContactMechMap.contactMechId
- returnHeader.store()
+ update('ReturnHeader').where(parameters).set([originContactMechId:
createReturnContactMechMap.contactMechId])
}
run service: 'createReturnContactMech', with:
createReturnContactMechMap
}
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
index 091713f216..4c3e514144 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/quote/QuoteServicesScript.groovy
@@ -37,11 +37,11 @@ import org.apache.ofbiz.service.ServiceUtil
*/
Map checkUpdateQuoteStatus() {
if (!security.hasEntityPermission('ORDERMGR', '_UPDATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCheckUpdateQuoteStatus', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCheckUpdateQuoteStatus')
}
GenericValue quote = from('Quote').where(parameters).queryOne()
if (!quote) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteDoesNotExists')
}
quote.statusId = 'QUO_ORDERED'
quote.store()
@@ -82,12 +82,12 @@ Map getNextQuoteId() {
GenericValue quote = from('Quote').where('quoteId',
quoteId).queryOne()
if (quote) {
// Return alert if ID already exists
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteIdAlreadyExists', [quoteId: quoteId], locale))
+ return error('OrderErrorUiLabels',
'OrderQuoteIdAlreadyExists', [quoteId: quoteId])
}
// Check the provided ID
String errorMessage = UtilValidate.checkValidDatabaseId(quoteId)
if (errorMessage) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteGetNextIdError', locale) + errorMessage)
+ return error(label('OrderErrorUiLabels',
'OrderQuoteGetNextIdError') + errorMessage)
}
} else {
quoteId = delegator.getNextSeqId('Quote')
@@ -121,7 +121,7 @@ Map createQuote() {
if (parameters.partyId
&& parameters.partyId != userLogin.partyId
&& !security.hasEntityPermission('ORDERMGR', '_CREATE',
userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuote', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuote')
}
// Create new entity and create all the fields.
@@ -174,12 +174,12 @@ Map createQuote() {
*/
Map updateQuote() {
if (!security.hasEntityPermission('ORDERMGR', '_UPDATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunUpdateQuote', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunUpdateQuote')
}
String quoteId = parameters.quoteId
GenericValue quote = from('Quote').where('quoteId', quoteId).queryOne()
if (!quote) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteDoesNotExists')
}
parameters.statusId = parameters.statusId ?: quote.statusId
@@ -191,14 +191,14 @@ Map updateQuote() {
if (!validChange) {
logError("The status change from ${quote.statusId} to
${parameters.statusId} is not a valid change")
// FIXME : LABEL :D
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteStatusChangeIsNotValid', locale))
+ return error('OrderErrorUiLabels',
'OrderQuoteStatusChangeIsNotValid')
}
}
quote.setNonPKFields(parameters)
quote.store()
- return success(UtilProperties.getMessage('OrderUiLabels',
'OrderOrderQuoteUpdatedSuccessfully', locale))
+ return success('OrderUiLabels', 'OrderOrderQuoteUpdatedSuccessfully')
}
/**
@@ -206,11 +206,11 @@ Map updateQuote() {
*/
Map copyQuote() {
if (!security.hasEntityPermission('ORDERMGR', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCopyQuote', locale))
+ return error('OrderErrorUiLabels', 'OrderSecurityErrorToRunCopyQuote')
}
GenericValue quote = from('Quote').where(parameters).queryOne()
if (!quote) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteDoesNotExists')
}
Map serviceResult = run service: 'createQuote', with: [*:quote, statusId:
null]
String quoteIdTo = serviceResult.quoteId
@@ -330,12 +330,12 @@ Map ensureWorkEffortAndCreateQuoteWorkEffort() {
Map createQuoteItem() {
GenericValue quote = from('Quote').where(parameters).queryOne()
if (!quote) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteDoesNotExists')
}
if (quote.partyId
&& quote.partyId != userLogin.partyId
&& !security.hasEntityPermission('ORDERMGR', '_CREATE',
userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteItem', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteItem')
}
GenericValue quoteItem = delegator.makeValidValue('QuoteItem', parameters)
if (!quoteItem.quoteItemSeqId) {
@@ -345,7 +345,7 @@ Map createQuoteItem() {
if (!parameters.quoteUnitPrice && parameters.productId) {
GenericValue product = from('Product').where('productId',
parameters.productId).cache().queryOne()
if (product?.isVirtual == 'Y') {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderCannotAddVirtualProductToQuote', locale))
+ return error('OrderErrorUiLabels',
'OrderCannotAddVirtualProductToQuote')
}
if (product?.productTypeId?.startsWith('AGGREGATED')
&& parameters.configId) {
@@ -370,13 +370,13 @@ Map createQuoteItem() {
*/
Map updateQuoteItem() {
if (!security.hasEntityPermission('ORDERMGR', '_UPDATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunUpdateQuoteItem', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunUpdateQuoteItem')
}
Map pksQuoteItem = [quoteId: parameters.quoteId, quoteItemSeqId:
parameters.quoteItemSeqId]
GenericValue quoteItem = from('QuoteItem').where(pksQuoteItem).queryOne()
if (!quoteItem) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteItemDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteItemDoesNotExists')
}
quoteItem.setNonPKFields(parameters)
quoteItem.store()
@@ -388,15 +388,15 @@ Map updateQuoteItem() {
*/
Map removeQuoteItem() {
if (!security.hasEntityPermission('ORDERMGR', '_DELETE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunRemoveQuoteItem', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunRemoveQuoteItem')
}
Map pksQuoteItem = [quoteId: parameters.quoteId, quoteItemSeqId:
parameters.quoteItemSeqId]
GenericValue quoteItem = from('QuoteItem').where(pksQuoteItem).queryOne()
if (!quoteItem) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteItemDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteItemDoesNotExists')
}
- delegator.removeByAnd('QuoteTerm', pksQuoteItem)
- delegator.removeByAnd('QuoteAdjustment', pksQuoteItem)
+ delete('QuoteTerm').where(pksQuoteItem)
+ delete('QuoteAdjustment').where(pksQuoteItem)
quoteItem.remove()
return success()
}
@@ -406,11 +406,11 @@ Map removeQuoteItem() {
*/
Map copyQuoteItem() {
if (!security.hasEntityPermission('ORDERMGR', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCopyQuoteItem', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCopyQuoteItem')
}
GenericValue quoteItem = from('QuoteItem').where(parameters).queryOne()
if (!quoteItem) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteItemDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteItemDoesNotExists')
}
String quoteIdTo = parameters.quoteIdTo ?: quoteItem.quoteId
Map input = [
@@ -448,12 +448,12 @@ Map copyQuoteItem() {
*/
Map createQuoteAndQuoteItemForRequest() {
if (!security.hasEntityPermission('ORDERMGR', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteAndQuoteItemForRequest', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteAndQuoteItemForRequest')
}
GenericValue custRequest = from('CustRequest').where(parameters).queryOne()
GenericValue custRequestItem =
from('CustRequestItem').where(parameters).queryOne()
if (!custRequest) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderErrorCustRequestWithIdDoesntExist', locale))
+ return error('OrderErrorUiLabels',
'OrderErrorCustRequestWithIdDoesntExist')
}
Map input = [
@@ -497,7 +497,7 @@ Map createQuoteFromCart() {
if (createQuoteInMap.partyId
&& createQuoteInMap.partyId != userLogin.partyId
&& !security.hasEntityPermission('ORDERMGR', '_CREATE',
userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteFromCart', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteFromCart')
}
createQuoteInMap.currencyUomId = cart.getCurrency()
@@ -571,11 +571,11 @@ Map createQuoteFromShoppingList() {
*/
Map autoUpdateQuotePrice() {
if (!security.hasEntityPermission('ORDERMGR', '_UPDATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunAutoUpdateQuotePrice', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunAutoUpdateQuotePrice')
}
GenericValue quoteItem = from('QuoteItem').where(parameters).queryOne()
if (!quoteItem) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteItemDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteItemDoesNotExists')
}
if (parameters.manualQuoteUnitPrice) {
quoteItem.quoteUnitPrice = parameters.manualQuoteUnitPrice
@@ -591,18 +591,18 @@ Map autoUpdateQuotePrice() {
*/
Map createQuoteFromCustRequest() {
if (!security.hasEntityPermission('ORDERMGR', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteFromCustRequest', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteFromCustRequest')
}
GenericValue custRequest = from('CustRequest').where('custRequestId',
parameters.custRequestId).queryOne()
if (!custRequest) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderErrorCustRequestWithIdDoesntExist',
- [custRequestId: parameters.custRequestId], locale))
+ return error('OrderErrorUiLabels',
'OrderErrorCustRequestWithIdDoesntExist',
+ [custRequestId: parameters.custRequestId])
}
// Error if request type not equals to RF_QUOTE or RF_PUR_QUOTE
if (custRequest.custRequestTypeId != 'RF_QUOTE' &&
custRequest.custRequestTypeId != 'RF_PUR_QUOTE') {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteNotARequest', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteNotARequest')
}
Map createQuoteInMap = [
@@ -657,12 +657,12 @@ Map createQuoteFromCustRequest() {
*/
Map autoCreateQuoteAdjustments() {
if (!security.hasEntityPermission('ORDERMGR', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunAutoCreateQuoteAdjustments', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunAutoCreateQuoteAdjustments')
}
String quoteId = parameters.quoteId
GenericValue quote = from('Quote').where('quoteId', quoteId).queryOne()
if (!quote) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderQuoteDoesNotExists', locale))
+ return error('OrderErrorUiLabels', 'OrderQuoteDoesNotExists')
}
// All existing promo quote items are removed.
@@ -724,7 +724,7 @@ Map createQuoteNote() {
return serviceResult
}
if (!serviceResult.noteId) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderProblemCreatingTheNoteNoNoteIdReturned', locale))
+ return error('OrderErrorUiLabels',
'OrderProblemCreatingTheNoteNoNoteIdReturned')
}
GenericValue quoteNote = makeValue('QuoteNote')
quoteNote.quoteId = parameters.quoteId
@@ -738,7 +738,7 @@ Map createQuoteNote() {
*/
Map createQuoteAdjustment() {
if (!security.hasEntityPermission('ORDERMGR', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteAdjustment', locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunCreateQuoteAdjustment')
}
GenericValue quoteAdjustment = makeValue('QuoteAdjustment', parameters)
quoteAdjustment.quoteAdjustmentId =
delegator.getNextSeqId('QuoteAdjustment')
diff --git
a/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
b/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
index 8979bce9e6..8d9264ecd3 100644
---
a/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
+++
b/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppinglist/ShoppingListServicesScript.groovy
@@ -102,7 +102,7 @@ Map createShoppingListItem() {
GenericValue shoppingList =
from('ShoppingList').where(parameters).queryOne()
GenericValue product = from('Product').where(parameters).queryOne()
if (!product) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductErrorProductNotFound', parameters.locale))
+ return error('ProductUiLabels', 'ProductErrorProductNotFound')
}
GenericValue newEntity = makeValue('ShoppingListItem')
newEntity.setNonPKFields(parameters)
@@ -121,9 +121,7 @@ Map createShoppingListItem() {
*/
Map updateShoppingListItem() {
GenericValue shoppingList =
from('ShoppingList').where(parameters).queryOne()
- GenericValue shoppingListItem =
from('ShoppingListItem').where(parameters).queryOne()
- shoppingListItem.setNonPKFields(parameters)
- shoppingListItem.store()
+ update('ShoppingListItem').where(parameters).set(parameters)
updateLastAdminModified(shoppingList, userLogin)
return success()
@@ -173,7 +171,7 @@ Map calculateShoppingListDeepTotalPrice() {
return error(serviceResult.errorMessage)
}
if (!serviceResult.hasPermission) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunForAnotherParty', parameters.locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunForAnotherParty')
}
Map calcPriceInBaseMap = [prodCatalogId: parameters.prodCatalogId,
webSiteId: parameters.webSiteId]
['partyId', 'productStoreId', 'productStoreGroupId', 'currencyUomId',
'autoUserLogin'].each {
@@ -228,7 +226,7 @@ Map checkShoppingListSecurity() {
if (userLogin && (userLogin.userLoginId != 'anonymous') &&
parameters.partyId && (userLogin.partyId != parameters.partyId)
&& !security.hasEntityPermission('PARTYMGR',
"_${parameters.permissionAction}", parameters.userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
'OrderSecurityErrorToRunForAnotherParty', parameters.locale))
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunForAnotherParty')
}
Map result = success()
@@ -243,11 +241,10 @@ Map checkShoppingListItemSecurity() {
GenericValue shoppingList =
from('ShoppingList').where(parameters).queryOne()
if (shoppingList?.partyId && userLogin.partyId != shoppingList.partyId &&
!security.hasEntityPermission('PARTYMGR',
"_${parameters.permissionAction}", parameters.userLogin)) {
- return error(UtilProperties.getMessage('OrderErrorUiLabels',
+ return error('OrderErrorUiLabels',
'OrderSecurityErrorToRunForAnotherParty',
[parentMethodName: parameters.parentMethodName,
- permissionAction: parameters.permissionAction],
- parameters.locale))
+ permissionAction: parameters.permissionAction])
}
Map result = success()
diff --git
a/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
b/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
index c815df2e34..59e420d7e5 100644
---
a/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
+++
b/applications/party/src/main/groovy/org/apache/ofbiz/party/contact/ContactMechServicesScript.groovy
@@ -18,7 +18,6 @@
*/
package org.apache.ofbiz.party.contact
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.base.util.UtilValidate
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.service.ModelService
@@ -38,7 +37,7 @@ Map updateContactMech() {
]
GenericValue lookedValue = from('ContactMech').where('contactMechId',
parameters.contactMechId).queryOne()
if (! lookedValue) {
- return error(UtilProperties.getMessage('ServiceErrorUiLabels',
'ServiceValueNotFound', locale))
+ return error('ServiceErrorUiLabels', 'ServiceValueNotFound')
}
String contactMechTypeId = parameters.contactMechTypeId ?:
lookedValue.contactMechTypeId
String successMessage = 'Party' +
@@ -48,11 +47,11 @@ Map updateContactMech() {
lookedValue.setNonPKFields(parameters)
lookedValue.contactMechId = null
Map serviceResult = run service: 'createContactMech', with:
lookedValue.getAllFields()
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
successMessage, locale))
+ Map serviceReturn = success('PartyUiLabels', successMessage)
serviceReturn.contactMechId = serviceResult.contactMechId
return serviceReturn
}
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
'PartyNothingToDoHere', locale))
+ Map serviceReturn = success('PartyUiLabels', 'PartyNothingToDoHere')
serviceReturn.contactMechId = parameters.contactMechId
return serviceReturn
}
@@ -79,15 +78,14 @@ String hasValidStateProvince(String countryGeoId, String
stateProvinceGeoId) {
Map createPostalAddress() {
String errorMessage = hasValidStateProvince(parameters.countryGeoId,
parameters.stateProvinceGeoId)
if (errorMessage) {
- return error(UtilProperties.getMessage('PartyUiLabels', errorMessage,
locale))
+ return error('PartyUiLabels', errorMessage)
}
GenericValue newValue = makeValue('PostalAddress', parameters)
Map createContactMechMap = [contactMechTypeId: 'POSTAL_ADDRESS',
contactMechId: parameters.contactMechId]
Map serviceResult = run service: 'createContactMech', with:
createContactMechMap
newValue.contactMechId = serviceResult.contactMechId
newValue.create()
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
- 'PartyPostalAddressSuccessfullyCreated', locale))
+ Map serviceReturn = success('PartyUiLabels',
'PartyPostalAddressSuccessfullyCreated')
serviceReturn.contactMechId = newValue.contactMechId
return serviceReturn
}
@@ -98,11 +96,11 @@ Map createPostalAddress() {
Map updatePostalAddress() {
String errorMessage = hasValidStateProvince(parameters.countryGeoId,
parameters.stateProvinceGeoId)
if (errorMessage) {
- return error(UtilProperties.getMessage('PartyUiLabels', errorMessage,
locale))
+ return error('PartyUiLabels', errorMessage)
}
GenericValue lookedValue = from('PostalAddress').where('contactMechId',
parameters.contactMechId).queryOne()
if (! lookedValue) {
- return error(UtilProperties.getMessage('ServiceErrorUiLabels',
'ServiceValueNotFound', locale))
+ return error('ServiceErrorUiLabels', 'ServiceValueNotFound')
}
GenericValue newValue = (GenericValue) lookedValue.clone()
newValue.setNonPKFields(parameters)
@@ -127,7 +125,7 @@ Map updatePostalAddress() {
}
}
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
successMessage, locale))
+ Map serviceReturn = success('PartyUiLabels', successMessage)
serviceReturn.contactMechId = contactMechId
serviceReturn.oldContactMechId = oldContactMechId
return serviceReturn
@@ -142,8 +140,7 @@ Map createTelecomNumber() {
Map serviceResult = run service: 'createContactMech', with:
createContactMechMap
newValue.contactMechId = serviceResult.contactMechId
newValue.create()
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
- 'PartyTelecomNumberSuccessfullyCreated', locale))
+ Map serviceReturn = success('PartyUiLabels',
'PartyTelecomNumberSuccessfullyCreated')
serviceReturn.contactMechId = newValue.contactMechId
return serviceReturn
}
@@ -154,7 +151,7 @@ Map createTelecomNumber() {
Map updateTelecomNumber() {
GenericValue lookedValue = from('TelecomNumber').where('contactMechId',
parameters.contactMechId).queryOne()
if (!lookedValue) {
- return error(UtilProperties.getMessage('ServiceErrorUiLabels',
'ServiceValueNotFound', locale))
+ return error('ServiceErrorUiLabels', 'ServiceValueNotFound')
}
GenericValue newValue = (GenericValue) lookedValue.clone()
newValue.setNonPKFields(parameters)
@@ -179,7 +176,7 @@ Map updateTelecomNumber() {
}
}
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
successMessage, locale))
+ Map serviceReturn = success('PartyUiLabels', successMessage)
serviceReturn.contactMechId = contactMechId
serviceReturn.oldContactMechId = oldContactMechId
return serviceReturn
@@ -190,19 +187,18 @@ Map updateTelecomNumber() {
*/
Map createEmailAddress() {
if (!parameters.emailAddress) {
- return error(UtilProperties.getMessage('PartyUiLabels',
'PartyEmailAddressMissing', locale))
+ return error('PartyUiLabels', 'PartyEmailAddressMissing')
}
if (UtilValidate.isEmail(parameters.emailAddress)) {
Map createContactMechMap = [contactMechTypeId: 'EMAIL_ADDRESS',
contactMechId: parameters.contactMechId,
infoString: parameters.emailAddress]
Map serviceResult = run service: 'createContactMech', with:
createContactMechMap
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
- 'PartyEmailAddressSuccessfullyCreated', locale))
+ Map serviceReturn = success('PartyUiLabels',
'PartyEmailAddressSuccessfullyCreated')
serviceReturn.contactMechId = serviceResult.contactMechId
return serviceReturn
}
- return error(UtilProperties.getMessage('PartyUiLabels',
'PartyEmailAddressNotFormattedCorrectly', locale))
+ return error('PartyUiLabels', 'PartyEmailAddressNotFormattedCorrectly')
}
/**
@@ -210,19 +206,18 @@ Map createEmailAddress() {
*/
Map updateEmailAddress() {
if (!parameters.emailAddress) {
- return error(UtilProperties.getMessage('PartyUiLabels',
'PartyEmailAddressMissing', locale))
+ return error('PartyUiLabels', 'PartyEmailAddressMissing')
}
if (UtilValidate.isEmail(parameters.emailAddress)) {
Map updateContactMechMap = [contactMechTypeId: 'EMAIL_ADDRESS',
contactMechId: parameters.contactMechId,
infoString: parameters.emailAddress]
Map serviceResult = run service: 'updateContactMech', with:
updateContactMechMap
- Map serviceReturn = success(UtilProperties.getMessage('PartyUiLabels',
- 'PartyEmailAddressSuccessfullyUpdated', locale))
+ Map serviceReturn = success('PartyUiLabels',
'PartyEmailAddressSuccessfullyUpdated')
serviceReturn.contactMechId = serviceResult.contactMechId
return serviceReturn
}
- return error(UtilProperties.getMessage('PartyUiLabels',
'PartyEmailAddressNotFormattedCorrectly', locale))
+ return error('PartyUiLabels', 'PartyEmailAddressNotFormattedCorrectly')
}
/**
@@ -255,7 +250,7 @@ Map updateFtpAddressWithHistory() {
if (resultMap.oldContactMechId) {
GenericValue lookedValue = from('FtpAddress').where('contactMechId',
parameters.contactMechId).queryOne()
if (!lookedValue) {
- return error(UtilProperties.getMessage('ServiceErrorUiLabels',
'ServiceValueNotFound', locale))
+ return error('ServiceErrorUiLabels', 'ServiceValueNotFound')
}
GenericValue newValue = (GenericValue) lookedValue.clone()
newValue.setNonPKFields(parameters)
@@ -350,10 +345,10 @@ Map verifyEmailAddress() {
.where(verifyHash: parameters.verifyHash)
.queryFirst()
if (! emailAddressVerification) {
- return error(UtilProperties.getMessage('PartyUiLabels',
'PartyEmailAddressNotExist', locale))
+ return error('PartyUiLabels', 'PartyEmailAddressNotExist')
}
if (UtilValidate.isDateBeforeNow(emailAddressVerification.expireDate)) {
- return error(UtilProperties.getMessage('PartyUiLabels',
'PartyEmailAddressVerificationExpired', locale))
+ return error('PartyUiLabels', 'PartyEmailAddressVerificationExpired')
}
return success()
}
diff --git
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyPermissionServices.groovy
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyPermissionServices.groovy
index bb2efb2e20..118af6fcfa 100644
---
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyPermissionServices.groovy
+++
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyPermissionServices.groovy
@@ -174,8 +174,7 @@ Map accAndDecPartyInvitationPermissionCheck() {
}
} else {
if (!partyInvitation?.emailAddress) {
- return error(UtilProperties.getMessage('PartyUiLabels',
- 'PartyInvitationNotValidError', parameters.locale))
+ return error('PartyUiLabels', 'PartyInvitationNotValidError')
}
Map serviceResult = run service: 'findPartyFromEmailAddress',
with: [address: partyInvitation.emailAddress]
String partyId = serviceResult.partyId
@@ -183,8 +182,7 @@ Map accAndDecPartyInvitationPermissionCheck() {
hasPermission = true
result.hasPermission = hasPermission
} else {
- return error(UtilProperties.getMessage('PartyUiLabels',
- 'PartyInvitationNotValidError', parameters.locale))
+ return error('PartyUiLabels', 'PartyInvitationNotValidError')
}
}
}
@@ -223,7 +221,7 @@ Map cancelPartyInvitationPermissionCheck() {
}
} else {
if (!partyInvitation?.emailAddress) {
- String errorMessage =
UtilProperties.getMessage('PartyUiLabels', 'PartyInvitationNotValidError',
parameters.locale)
+ String errorMessage = label('PartyUiLabels',
'PartyInvitationNotValidError')
logError(errorMessage)
return error(errorMessage)
}
@@ -236,7 +234,7 @@ Map cancelPartyInvitationPermissionCheck() {
result.hasPermission = hasPermission
}
} else {
- String errorMessage =
UtilProperties.getMessage('PartyUiLabels', 'PartyInvitationNotValidError',
parameters.locale)
+ String errorMessage = label('PartyUiLabels',
'PartyInvitationNotValidError')
logError(errorMessage)
return error(errorMessage)
}
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 5429b7027c..8a912d6e77 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
@@ -454,12 +454,7 @@ Map updatePartyRelationship() {
parameters.roleTypeIdFrom = parameters.roleTypeIdFrom ?: '_NA_'
parameters.roleTypeIdTo = parameters.roleTypeIdTo ?: '_NA_'
- // lookup existing value
- GenericValue partyRelationship = from('PartyRelationship')
- .where(parameters)
- .queryOne()
- partyRelationship.setNonPKFields(parameters)
- partyRelationship.store()
+ update('PartyRelationship').where(parameters).set(parameters)
return success()
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/category/EditCategory.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/category/EditCategory.groovy
index 221fe3c919..60fe65f16a 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/category/EditCategory.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/category/EditCategory.groovy
@@ -19,7 +19,6 @@
package org.apache.ofbiz.product.catalog.category
import org.apache.ofbiz.base.util.HttpRequestFileUpload
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.base.util.string.FlexibleStringExpander
import org.apache.ofbiz.entity.util.EntityUtilProperties
@@ -78,7 +77,7 @@ if (fileType) {
if (!java.nio.file.Paths.get(imageServerPath + '/' +
filePathPrefix).normalize()
.startsWith(java.nio.file.Paths.get(imageServerPath).normalize()))
{
logError('Path traversal attempt detected in category image upload')
- return error(UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale))
+ return error('SecurityUiLabels', 'SupportedImageFormats')
}
defaultFileName = filenameToUse + '_temp'
uploadObject = new HttpRequestFileUpload()
@@ -90,7 +89,7 @@ if (fileType) {
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a
problem, except if it's a webshell!)")
}
- String errorMessage = UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale)
+ String errorMessage = label('SecurityUiLabels',
'SupportedImageFormats')
logError(errorMessage)
return error(errorMessage)
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/config/EditProductConfigItemContent.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/config/EditProductConfigItemContent.groovy
index 2ad99f7108..cb2918548c 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/config/EditProductConfigItemContent.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/config/EditProductConfigItemContent.groovy
@@ -19,7 +19,6 @@
package org.apache.ofbiz.product.catalog.config
import org.apache.ofbiz.base.util.HttpRequestFileUpload
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.base.util.string.FlexibleStringExpander
import org.apache.ofbiz.entity.util.EntityUtilProperties
@@ -92,7 +91,7 @@ if (fileType) {
if (!java.nio.file.Paths.get(imageServerPath + '/' +
filePathPrefix).normalize()
.startsWith(java.nio.file.Paths.get(imageServerPath).normalize()))
{
logError('Path traversal attempt detected in config item image upload')
- return error(UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale))
+ return error('SecurityUiLabels', 'SupportedImageFormats')
}
defaultFileName = filenameToUse + '_temp'
uploadObject = new HttpRequestFileUpload()
@@ -104,7 +103,7 @@ if (fileType) {
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a
problem, except if it's a webshell!)")
}
- String errorMessage = UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale)
+ String errorMessage = label('SecurityUiLabels',
'SupportedImageFormats')
logError(errorMessage)
return error(errorMessage)
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/ImageUpload.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/ImageUpload.groovy
index d15816597d..6f7f1f4ad4 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/ImageUpload.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/imagemanagement/ImageUpload.groovy
@@ -20,7 +20,6 @@ package org.apache.ofbiz.product.catalog.imagemanagement
import org.apache.ofbiz.base.util.HttpRequestFileUpload
import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.base.util.string.FlexibleStringExpander
import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.product.image.ScaleImage
@@ -91,7 +90,7 @@ if (fileType) {
if (!java.nio.file.Paths.get(imageServerPath + '/' +
filePathPrefix).normalize()
.startsWith(java.nio.file.Paths.get(imageServerPath).normalize()))
{
logError('Path traversal attempt detected in product image upload')
- return error(UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale))
+ return error('SecurityUiLabels', 'SupportedImageFormats')
}
defaultFileName = filenameToUse + '_temp'
uploadObject = new HttpRequestFileUpload()
@@ -103,7 +102,7 @@ if (fileType) {
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a
problem, except if it's a webshell!)")
}
- String errorMessage = UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale)
+ String errorMessage = label('SecurityUiLabels',
'SupportedImageFormats')
logError(errorMessage)
return error(errorMessage)
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/EditProductContent.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/EditProductContent.groovy
index 007b7c159b..6f1cc5126c 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/EditProductContent.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/catalog/product/EditProductContent.groovy
@@ -20,7 +20,6 @@ package org.apache.ofbiz.product.catalog.product
import org.apache.ofbiz.base.util.HttpRequestFileUpload
import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.base.util.string.FlexibleStringExpander
import org.apache.ofbiz.entity.util.EntityUtilProperties
import org.apache.ofbiz.product.image.ScaleImage
@@ -92,7 +91,7 @@ if (fileType) {
if (!java.nio.file.Paths.get(imageServerPath + '/' +
filePathPrefix).normalize()
.startsWith(java.nio.file.Paths.get(imageServerPath).normalize()))
{
logError('Path traversal attempt detected in product image upload')
- return error(UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale))
+ return error('SecurityUiLabels', 'SupportedImageFormats')
}
defaultFileName = filenameToUse + '_temp'
uploadObject = new HttpRequestFileUpload()
@@ -104,7 +103,7 @@ if (fileType) {
} catch (Exception e) {
logError(e, "error deleting existing file (not necessarily a
problem, except if it's a webshell!)")
}
- String errorMessage = UtilProperties.getMessage('SecurityUiLabels',
'SupportedImageFormats', locale)
+ String errorMessage = label('SecurityUiLabels',
'SupportedImageFormats')
logError(errorMessage)
return error(errorMessage)
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/FacilityGeoServices.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/FacilityGeoServices.groovy
index 7de35ecfd7..1f990403cd 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/FacilityGeoServices.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/facility/facility/FacilityGeoServices.groovy
@@ -18,7 +18,6 @@
*/
package org.apache.ofbiz.product.facility.facility
-import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.service.ServiceUtil
/**
@@ -34,8 +33,6 @@ Map createUpdateFacilityGeoPoint() {
return serviceResult
}
String geoPointId = serviceResult.geoPointId
- GenericValue facility = from('Facility').where(parameters).queryOne()
- facility.geoPointId = geoPointId
- facility.store()
+ update('Facility').where(parameters).set([geoPointId: geoPointId])
return success()
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryContentServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryContentServicesScript.groovy
index c04f1f2818..c03d3f8be6 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryContentServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryContentServicesScript.groovy
@@ -56,9 +56,7 @@ Map createCategoryContent() {
Map updateCategoryContent() {
GenericValue lookupPKMap = makeValue('ProductCategoryContent')
lookupPKMap.setPKFields(parameters, true)
- Map lookedUpValue =
from('ProductCategoryContent').where(lookupPKMap).queryOne()
- lookedUpValue.setNonPKFields(parameters, true)
- lookedUpValue.store()
+ update('ProductCategoryContent').where(lookupPKMap).set(parameters)
Map updateContent =
dispatcher.getDispatchContext().makeValidContext('updateContent',
ModelService.IN_PARAM, parameters)
run service: 'updateContent', with: updateContent
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryServicesScript.groovy
index 4a13381c01..56faaa71e4 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/category/CategoryServicesScript.groovy
@@ -47,8 +47,8 @@ Map createProductCategory() {
String resourceDescription = parameters.rescourceDescription ?:
'createProductCategory'
if (!(security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)
|| security.hasEntityPermission('CATALOG_ROLE', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError',
+ [resourceDescription: resourceDescription])
}
Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
@@ -138,8 +138,7 @@ Map removeProductFromCategory() {
// If the associated category was the primary category for the product,
clear that field
GenericValue product = from('Product').where(parameters).queryOne()
if (Objects.equals(product?.primaryProductCategoryId,
parameters.productCategoryId)) {
- product.primaryProductCategoryId = null
- product.store()
+ update('Product').where(parameters).set([primaryProductCategoryId:
null])
}
GenericValue lookedUpValue =
from('ProductCategoryMember').where(parameters).queryOne()
lookedUpValue.remove()
@@ -174,9 +173,7 @@ Map updatePartyToCategory() {
if (!ServiceUtil.isSuccess(res)) {
return res
}
- GenericValue lookedUpValue =
from('ProductCategoryRole').where(parameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductCategoryRole').where(parameters).set(parameters)
return success()
}
@@ -257,9 +254,7 @@ Map updateProductCategoryToCategory() {
return res
}
- GenericValue lookedUpValue =
from('ProductCategoryRollup').where(parameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductCategoryRollup').where(parameters).set(parameters)
Map result = success()
result.productCategoryId = parameters.productCategoryId
return result
@@ -341,8 +336,8 @@ Map duplicateCategoryEntities() {
String resourceDescription = parameters.resourceDescription ?:
'duplicateCategoryEntities'
if (!(security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)
|| security.hasEntityPermission('CATALOG_ROLE', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'ProductCatalogCreatePermissionError', [resourceDescription:
resourceDescription], parameters.locale))
+ return error('ProductUiLabels',
+ 'ProductCatalogCreatePermissionError', [resourceDescription:
resourceDescription])
}
copyCategoryEntities(parameters.entityName, parameters.productCategoryId,
parameters.productCategoryIdTo, parameters.validDate)
@@ -498,9 +493,7 @@ Map createProductInCategory() {
// set isVirtual based on hasSelectableFeatures
if (hasSelectableFeatures == 'Y') {
- GenericValue newProduct = from('Product').where(parameters).queryOne()
- newProduct.isVirtual = 'Y'
- newProduct.store()
+ update('Product').where(parameters).set([isVirtual: 'Y'])
}
return result
}
@@ -512,13 +505,13 @@ Map duplicateProductCategory() {
String resourceDescription = parameters.resourceDescription ?:
'duplicateProductCategory'
if (!(security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)
|| security.hasEntityPermission('CATALOG_ROLE', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError',
+ [resourceDescription: resourceDescription])
}
if (findOne('ProductCategory', [productCategoryId:
parameters.productCategoryId], false)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCategoryAlreadyExists',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCategoryAlreadyExists',
+ [resourceDescription: resourceDescription])
}
// look up the old product category and clone it
@@ -589,8 +582,8 @@ Map duplicateProductCategory() {
Map createProductCategoryAttribute() {
String resourceDescription = parameters.resourceDescription ?:
'createProductCategoryAttribute'
if (!(security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError',
+ [resourceDescription: resourceDescription])
}
// check if the new attribute-name is unique to the product-category-id
@@ -601,8 +594,8 @@ Map createProductCategoryAttribute() {
}
List existingData =
from('ProductCategoryAttribute').where(condition).queryList()
if (existingData) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCategoryAttrAlreadyExists',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCategoryAttrAlreadyExists',
+ [resourceDescription: resourceDescription])
}
GenericValue newEntity = makeValue('ProductCategoryAttribute', parameters)
newEntity.create()
@@ -615,13 +608,11 @@ Map createProductCategoryAttribute() {
Map updateProductCategoryAttribute() {
String resourceDescription = parameters.resourceDescription ?:
'updateProductCategoryAttribute'
if (!(security.hasEntityPermission('CATALOG', '_UPDATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogUpdatePermissionError',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogUpdatePermissionError',
+ [resourceDescription: resourceDescription])
}
- GenericValue productCategoryAttributeInstance =
from('ProductCategoryAttribute').where(parameters).queryOne()
- productCategoryAttributeInstance.setNonPKFields(parameters)
- productCategoryAttributeInstance.store()
+ update('ProductCategoryAttribute').where(parameters).set(parameters)
return success()
}
@@ -631,8 +622,8 @@ Map updateProductCategoryAttribute() {
Map deleteProductCategoryAttribute() {
String resourceDescription = parameters.resourceDescription ?:
'deleteProductCategoryAttribute'
if (!(security.hasEntityPermission('CATALOG', '_DELETE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogDeletePermissionError',
- [resourceDescription: resourceDescription], parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogDeletePermissionError',
+ [resourceDescription: resourceDescription])
}
GenericValue productCategoryAttributeInstance =
from('ProductCategoryAttribute').where(parameters).queryOne()
@@ -690,8 +681,8 @@ Map checkCategoryRelatedPermission(String
callingMethodName, String checkAction,
|| (security.hasEntityPermission('CATALOG_ROLE', "_${checkAction}",
parameters.userLogin)
&& roleCategories))) {
logVerbose('Permission check failed, user does not have the correct
permission.')
- result = error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError',
- [resourceDescription: callingMethodName], parameters.locale))
+ result = error('ProductUiLabels',
'ProductCatalogCreatePermissionError',
+ [resourceDescription: callingMethodName])
}
return result
}
@@ -701,7 +692,7 @@ Map checkCategoryRelatedPermission(String
callingMethodName, String checkAction,
*/
Map productCategoryGenericPermission() {
if (!parameters.mainAction) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductMissingMainActionInPermissionService', parameters.locale))
+ return error('ProductUiLabels',
'ProductMissingMainActionInPermissionService')
}
Map result = success()
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/config/ProductConfigItemContentServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/config/ProductConfigItemContentServicesScript.groovy
index cfc76a360b..2a55a4ce66 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/config/ProductConfigItemContentServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/config/ProductConfigItemContentServicesScript.groovy
@@ -48,9 +48,7 @@ Map updateProductConfigItemContent() {
GenericValue pkParameters = makeValue('ProdConfItemContent')
pkParameters.setPKFields(parameters)
- GenericValue lookedUpValue =
from('ProdConfItemContent').where(pkParameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProdConfItemContent').where(pkParameters).set(parameters)
run service: 'updateContent', with: parameters
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/feature/ProductFeatureServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/feature/ProductFeatureServicesScript.groovy
index 82bb585d2e..c4b4095604 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/feature/ProductFeatureServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/feature/ProductFeatureServicesScript.groovy
@@ -19,7 +19,6 @@
package org.apache.ofbiz.product.product.feature
import java.util.regex.Pattern
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
/**
@@ -46,13 +45,11 @@ Map applyFeatureToProductFromTypeAndCode() {
Map createProductFeatureType() {
Map result = success()
if (!security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'ProductCatalogCreatePermissionError', parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError')
}
parameters.productFeatureTypeId = parameters.productFeatureTypeId ?:
delegator.getNextSeqId('ProductFeatureType')
if (!Pattern.matches('^[a-zA-Z_0-9]+$', parameters.productFeatureTypeId)) {
- return error(UtilProperties.getMessage('ProductErrorUiLabels',
- 'ProductFeatureTypeIdMustContainsLettersAndDigits',
parameters.locale))
+ return error('ProductErrorUiLabels',
'ProductFeatureTypeIdMustContainsLettersAndDigits')
}
GenericValue newEntity = makeValue('ProductFeatureType', parameters)
newEntity.create()
@@ -65,8 +62,7 @@ Map createProductFeatureType() {
*/
Map createProductFeatureApplAttr() {
if (!security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'ProductCatalogCreatePermissionError', parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError')
}
GenericValue newEntity = makeValue('ProductFeatureApplAttr', parameters)
if (! newEntity.fromDate) {
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 b089b3c45b..2127105e55 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
@@ -370,22 +370,22 @@ Map updateStatusImageManagement() {
*/
Map addRejectedReasonImageManagement() {
Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
- GenericValue content = from('Content').where(parameters).queryOne()
+ String description
switch (parameters.description) {
case 'RETAKE_PHOTO':
- content.description = 'Re-take Photo'
+ description = 'Re-take Photo'
break
case 'REMOVE_LOGO':
- content.description = 'Remove Logo'
+ description = 'Remove Logo'
break
case 'OTHER':
- content.description = 'Other'
+ description = 'Other'
break
default:
- content.description = 'Other'
+ description = 'Other'
break
}
- content.store()
+ update('Content').where(parameters).set([description: description])
GenericValue productContent = from('ProductContent').where(contentId:
parameters.contentId, productContentTypeId: 'IMAGE').queryFirst()
productContent.thruDate = nowTimestamp
productContent.store()
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryIssueServices.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryIssueServices.groovy
index 24a8b2aeda..c5fd14793e 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryIssueServices.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryIssueServices.groovy
@@ -50,8 +50,7 @@ Map issueImmediatelyFulfilledOrder() {
}
}
// now that the issuance is done, set the
needsInventoryIssuance=N
- orderHeader.needsInventoryIssuance = 'N'
- orderHeader.store()
+
update('OrderHeader').where(parameters).set([needsInventoryIssuance: 'N'])
logInfo("Issued inventory for orderId ${orderHeader.orderId}.")
} else {
logInfo("Not issuing inventory for orderId
${orderHeader.orderId}," +
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
index 846379fc6d..e0fd6927c9 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/inventory/InventoryServicesScript.groovy
@@ -40,7 +40,7 @@ Map checkFacilityRelatedPermission(String callingMethodName,
String checkAction,
if (!security.hasEntityPermission('CATALOG', "_${checkAction}",
parameters.userLogin)
&& (!security.hasEntityPermission('FACILITY', "_${checkAction}",
parameters.userLogin))
&& ((!alternatePermissionRoot) ||
!security.hasEntityPermission("${alternatePermissionRoot}", "_${checkAction}",
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError', parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError')
}
return success()
}
@@ -52,7 +52,7 @@ Map checkFacilityRelatedPermission(String callingMethodName,
String checkAction,
Map facilityGenericPermission() {
String mainAction = parameters.mainAction
if (!mainAction) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductMissingMainActionInPermissionService', parameters.locale))
+ return error('ProductUiLabels',
'ProductMissingMainActionInPermissionService')
}
String callingMethodName = parameters.resourceDescription
Map permissionResult = checkFacilityRelatedPermission(callingMethodName,
mainAction, null)
@@ -74,7 +74,7 @@ Map facilityGenericPermission() {
Map checkProductFacilityRelatedPermission() {
String mainAction = parameters.mainAction
if (!mainAction) {
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonPermissionMainActionAttributeMissing', parameters.locale))
+ return error('CommonUiLabels',
'CommonPermissionMainActionAttributeMissing')
}
parameters.altPermission = 'FACILITY'
Map serviceResult = run service: 'checkProductRelatedPermission', with:
parameters
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/price/PriceServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/price/PriceServicesScript.groovy
index e746a2c301..b5ee3cb7b5 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/price/PriceServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/price/PriceServicesScript.groovy
@@ -34,7 +34,7 @@ import org.apache.ofbiz.party.party.PartyHelper
Map createProductPrice() {
Map result = success()
if (!security.hasPermission('CATALOG_PRICE_MAINT', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductPriceMaintPermissionError', locale))
+ return error('ProductUiLabels', 'ProductPriceMaintPermissionError')
}
inlineHandlePriceWithTaxIncluded()
@@ -58,7 +58,7 @@ Map createProductPrice() {
Map updateProductPrice() {
Map result = success()
if (!security.hasPermission('CATALOG_PRICE_MAINT', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductPriceMaintPermissionError', locale))
+ return error('ProductUiLabels', 'ProductPriceMaintPermissionError')
}
inlineHandlePriceWithTaxIncluded()
@@ -79,7 +79,7 @@ Map updateProductPrice() {
Map deleteProductPrice() {
Map result = success()
if (!security.hasPermission('CATALOG_PRICE_MAINT', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductPriceMaintPermissionError', locale))
+ return error('ProductUiLabels', 'ProductPriceMaintPermissionError')
}
GenericValue lookedUpValue =
from('ProductPrice').where(parameters).queryOne()
// grab the old price value before setting nonpk parameter fields
@@ -108,7 +108,7 @@ Map inlineHandlePriceWithTaxIncluded() {
parameters.taxPercentage = taxAuthorityRateProduct?.taxPercentage
}
if (!parameters.taxPercentage) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductPriceTaxPercentageNotFound', locale))
+ return error('ProductUiLabels',
'ProductPriceTaxPercentageNotFound')
}
// in short the formula is: taxAmount = priceWithTax -
(priceWithTax/(1+taxPercentage/100))
BigDecimal taxAmount = parameters.priceWithTax -
(parameters.priceWithTax / (1 + parameters.taxPercentage / 100))
@@ -132,10 +132,10 @@ Map inlineHandlePriceWithTaxIncluded() {
Map createProductPriceCond() {
Map result = success()
if (!security.hasEntityPermission('CATALOG', '_CREATE', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError', locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError')
}
if (!security.hasPermission('CATALOG_PRICE_MAINT', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductPriceMaintPermissionError', locale))
+ return error('ProductUiLabels', 'ProductPriceMaintPermissionError')
}
if (parameters.condValueInput) {
parameters.condValue = parameters.condValueInput
@@ -152,17 +152,15 @@ Map createProductPriceCond() {
*/
Map updateProductPriceCond() {
if (!security.hasEntityPermission('CATALOG', '_UPDATE', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogUpdatePermissionError', locale))
+ return error('ProductUiLabels', 'ProductCatalogUpdatePermissionError')
}
if (!security.hasPermission('CATALOG_PRICE_MAINT', userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductPriceMaintPermissionError', locale))
+ return error('ProductUiLabels', 'ProductPriceMaintPermissionError')
}
if (['PRIP_QUANTITY',
'PRIP_LIST_PRICE'].contains(parameters.inputParamEnumId)) {
parameters.condValue = parameters.condValueInput
}
- GenericValue lookedUpValue =
from('ProductPriceCond').where(parameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductPriceCond').where(parameters).set(parameters)
return success()
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductContentServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductContentServicesScript.groovy
index dc82762165..550599adb3 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductContentServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductContentServicesScript.groovy
@@ -39,9 +39,7 @@ Map createProductContent() {
* Update Content For Product
*/
Map updateProductContent() {
- GenericValue lookedUpValue =
from('ProductContent').where(parameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductContent').where(parameters).set(parameters)
run service: 'updateContent', with: parameters
return success()
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductServicesScript.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductServicesScript.groovy
index dc9cac1635..ed1b19e213 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductServicesScript.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/product/ProductServicesScript.groovy
@@ -37,7 +37,7 @@ Map createProduct() {
Map result = success()
if (!(security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)
|| security.hasEntityPermission('CATALOG_ROLE', '_CREATE',
parameters.userLogin))) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError', parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError')
}
GenericValue newEntity = makeValue('Product', parameters)
@@ -48,7 +48,7 @@ Map createProduct() {
}
GenericValue dummyProduct =
from('Product').where(parameters).queryOne()
if (dummyProduct) {
- return error(UtilProperties.getMessage('CommonErrorUiLabels',
'CommonErrorDuplicateKey', parameters.locale))
+ return error('CommonErrorUiLabels', 'CommonErrorDuplicateKey')
}
} else {
newEntity.productId = delegator.getNextSeqId('Product')
@@ -108,12 +108,9 @@ Map updateProduct() {
if (!ServiceUtil.isSuccess(res)) {
return res
}
- GenericValue lookedUpValue = from('Product').where(parameters).queryOne()
-
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.lastModifiedDate = UtilDateTime.nowTimestamp()
- lookedUpValue.lastModifiedByUserLogin = userLogin.userLoginId
- lookedUpValue.store()
+ update('Product').where(parameters).set([*: parameters,
+ lastModifiedDate:
UtilDateTime.nowTimestamp(),
+ lastModifiedByUserLogin:
userLogin.userLoginId])
return success()
}
@@ -175,7 +172,7 @@ Map duplicateProduct() {
}
GenericValue dummyProduct = from('Product').where(parameters).queryOne()
if (dummyProduct) {
- return error(UtilProperties.getMessage('CommonErrorUiLabels',
'CommonErrorDuplicateKey', parameters.locale))
+ return error('CommonErrorUiLabels', 'CommonErrorDuplicateKey')
}
// look up the old product and clone it
@@ -297,10 +294,10 @@ Map duplicateProduct() {
if (parameters.removeAssocs) {
relationToRemove << 'ProductAssoc'
// small difference here, also do the reverse assocs...
- delegator.removeByAnd('ProductAssoc', reverseProductFindContext)
+ delete('ProductAssoc').where(reverseProductFindContext)
}
relationToRemove.each {
- delegator.removeByAnd(it, productFindContext)
+ delete(it).where(productFindContext)
}
return success()
}
@@ -347,21 +344,19 @@ Map indexProductKeywords() {
Map discontinueProductSales() {
// set sales discontinuation date to now
Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
- GenericValue product = from('Product').where(parameters).queryOne()
- product.salesDiscontinuationDate = nowTimestamp
- product.store()
+ update('Product').where(parameters).set([salesDiscontinuationDate:
nowTimestamp])
// expire product from all categories
exprBldr = new EntityConditionBuilder()
condition = exprBldr.AND {
- EQUALS(productId: product.productId)
+ EQUALS(productId: parameters.productId)
EQUALS(thruDate: null)
}
delegator.storeByCondition('ProductCategoryMember',
[thruDate: nowTimestamp], condition)
// expire product from all associations going to it
assocCondition = new EntityConditionBuilder().AND {
- EQUALS(productIdTo: product.productId)
+ EQUALS(productIdTo: parameters.productId)
EQUALS(thruDate: null)
}
delegator.storeByCondition('ProductAssoc',
@@ -420,9 +415,7 @@ Map createProductReview() {
String productId = newEntity.productId
updateProductWithReviewRatingAvg(productId)
- String successMessage = UtilProperties.getMessage('ProductUiLabels',
- 'ProductCreateProductReviewSuccess', parameters.locale)
- Map result = success(successMessage )
+ Map result = success('ProductUiLabels',
'ProductCreateProductReviewSuccess')
result.productReviewId = newEntity.productReviewId
return result
@@ -436,11 +429,9 @@ Map updateProductReview() {
if (!ServiceUtil.isSuccess(res)) {
return res
}
- GenericValue lookedUpValue =
from('ProductReview').where(parameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductReview').where(parameters).set(parameters)
- String productId = lookedUpValue.productId
+ String productId = parameters.productId
updateProductWithReviewRatingAvg(productId)
return success()
@@ -460,17 +451,15 @@ Map setProductReviewStatus() {
if (from('StatusValidChange')
.where(statusId: productReview.statusId, statusIdTo:
parameters.statusId)
.queryCount() == 0) {
- String errorMessage =
UtilProperties.getMessage('ProductErrorUiLabels',
- 'ProductReviewErrorCouldNotChangeOrderStatusFromTo',
parameters.locale)
+ String errorMessage = label('ProductErrorUiLabels',
'ProductReviewErrorCouldNotChangeOrderStatusFromTo')
logError(errorMessage)
return error(errorMessage)
}
}
- productReview.statusId = parameters.statusId
- productReview.store()
+ GenericValue updatedProductReview =
update('ProductReview').where(parameters).set([statusId: parameters.statusId])
Map result = success()
- result.productReviewId = productReview.productReviewId
+ result.productReviewId = updatedProductReview.productReviewId
return result
}
@@ -591,8 +580,8 @@ Map checkProductRelatedPermission(String callingMethodName,
String checkAction)
|| (parameters.alternatePermissionRoot &&
security.hasEntityPermission(parameters.alternatePermissionRoot,
"_${checkAction}", parameters.userLogin)))) {
String checkActionLabel =
"ProductCatalog${checkAction.charAt(0)}${checkAction.substring(1).toLowerCase()}PermissionError"
- return error(UtilProperties.getMessage('ProductUiLabels',
checkActionLabel,
- [resourceDescription: callingMethodName, mainAction:
checkAction], parameters.locale))
+ return error('ProductUiLabels', checkActionLabel,
+ [resourceDescription: callingMethodName, mainAction:
checkAction])
}
return success()
}
@@ -613,15 +602,14 @@ Map checkProductRelatedPermissionService() {
Map productGenericPermission() {
String mainAction = parameters.mainAction
if (!mainAction) {
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'ProductMissingMainActionInPermissionService',
parameters.locale))
+ return error('ProductUiLabels',
'ProductMissingMainActionInPermissionService')
}
Map result = success()
result.hasPermission = ServiceUtil.isSuccess(
checkProductRelatedPermission(parameters.resourceDescription,
parameters.mainAction))
if (!result.hasPermission) {
- result = failure(UtilProperties.getMessage('ProductUiLabels',
'ProductPermissionError', parameters.locale))
+ result = failure('ProductUiLabels', 'ProductPermissionError')
}
return result
}
@@ -632,19 +620,17 @@ Map productGenericPermission() {
Map productPriceGenericPermission() {
String mainAction = parameters.mainAction
if (!mainAction) {
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'ProductMissingMainActionInPermissionService',
parameters.locale))
+ return error('ProductUiLabels',
'ProductMissingMainActionInPermissionService')
}
Map result = success()
if (!security.hasPermission('CATALOG_PRICE_MAINT', parameters.userLogin)) {
- result = error(UtilProperties.getMessage('ProductUiLabels',
- 'ProductPriceMaintPermissionError', parameters.locale))
+ result = error('ProductUiLabels', 'ProductPriceMaintPermissionError')
}
result.hasPermission = ServiceUtil.isSuccess(result) &&
ServiceUtil.isSuccess(checkProductRelatedPermission(parameters.resourceDescription,
mainAction))
if (!result.hasPermission) {
- result = failure(UtilProperties.getMessage('ProductUiLabels',
'ProductPermissionError', parameters.locale))
+ result = failure('ProductUiLabels', 'ProductPermissionError')
}
return result
}
@@ -682,9 +668,7 @@ Map updatePartyToProduct() {
}
GenericValue lookupPKMap = makeValue('ProductRole')
lookupPKMap.setPKFields(parameters)
- GenericValue lookedUpValue = findOne('ProductRole', lookupPKMap, false)
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductRole').where(lookupPKMap).set(parameters)
return success()
}
@@ -732,9 +716,7 @@ Map updateProductCategoryGlAccount() {
return res
}
- GenericValue lookedUpValue = findOne('ProductCategoryGlAccount',
parameters, false)
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ update('ProductCategoryGlAccount').where(parameters).set(parameters)
return success()
}
@@ -775,15 +757,12 @@ Map createProductGroupOrder() {
* Update ProductGroupOrder
*/
Map updateProductGroupOrder() {
- GenericValue productGroupOrder =
from('ProductGroupOrder').where(parameters).queryOne()
- productGroupOrder.setNonPKFields(parameters)
- productGroupOrder.store()
+ GenericValue productGroupOrder =
update('ProductGroupOrder').where(parameters).set(parameters)
if (productGroupOrder.statusId == 'GO_CREATED') {
GenericValue jobSandbox = from('JobSandbox').where(jobId:
productGroupOrder.jobId).queryOne()
if (jobSandbox) {
- jobSandbox.runTime = parameters.thruDate
- jobSandbox.store()
+ update('JobSandbox').where(jobId:
productGroupOrder.jobId).set([runTime: parameters.thruDate])
}
}
return success()
@@ -834,10 +813,9 @@ Map createJobForProductGroupOrder() {
runtimeDataId: runtimeDataId,
maxRecurrenceCount: 1L,
priority: 50L]
- delegator.create('JobSandbox', jobFields)
+ create('JobSandbox', jobFields)
- productGroupOrder.jobId = jobFields.jobId
- productGroupOrder.store()
+ update('ProductGroupOrder').where(parameters).set([jobId:
jobFields.jobId])
}
return success()
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/store/ProductStoreServices.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/store/ProductStoreServices.groovy
index 8c78e01d41..6ece55c4cf 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/store/ProductStoreServices.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/store/ProductStoreServices.groovy
@@ -36,18 +36,18 @@ import org.apache.ofbiz.service.ServiceUtil
Map createProductStore() {
Map result = success()
if (!security.hasEntityPermission('CATALOG', '_CREATE',
parameters.userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogCreatePermissionError', parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogCreatePermissionError')
}
if (parameters.oneInventoryFacility == 'Y'
&& !parameters.inventoryFacilityId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'InventoryFacilityIdRequired', parameters.locale))
+ return error('ProductUiLabels', 'InventoryFacilityIdRequired')
}
if (parameters.showPricesWithVatTax == 'Y') {
if (!parameters.vatTaxAuthGeoId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductVatTaxAuthGeoNotSet', parameters.locale))
+ return error('ProductUiLabels', 'ProductVatTaxAuthGeoNotSet')
}
if (!parameters.vatTaxAuthPartyId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductVatTaxAuthPartyNotSet', parameters.locale))
+ return error('ProductUiLabels', 'ProductVatTaxAuthPartyNotSet')
}
}
GenericValue newEntity = makeValue('ProductStore')
@@ -73,10 +73,10 @@ Map createProductStore() {
*/
Map updateProductStore() {
if (!security.hasEntityPermission('CATALOG', '_UPDATE',
parameters.userLogin)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductCatalogUpdatePermissionError', parameters.locale))
+ return error('ProductUiLabels', 'ProductCatalogUpdatePermissionError')
}
if (parameters.oneInventoryFacility == 'Y' &&
!parameters.inventoryFacilityId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'InventoryFacilityIdRequired', parameters.locale))
+ return error('ProductUiLabels', 'InventoryFacilityIdRequired')
}
GenericValue store = from('ProductStore').where(productStoreId:
parameters.productStoreId).queryOne()
String oldFacilityId = store.inventoryFacilityId
@@ -86,10 +86,10 @@ Map updateProductStore() {
store.visualThemeId = parameters.ecomThemeId
if (store.showPricesWithVatTax == 'Y') {
if (!store.vatTaxAuthGeoId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductVatTaxAuthGeoNotSet', parameters.locale))
+ return error('ProductUiLabels', 'ProductVatTaxAuthGeoNotSet')
}
if (!store.vatTaxAuthPartyId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductVatTaxAuthPartyNotSet', parameters.locale))
+ return error('ProductUiLabels', 'ProductVatTaxAuthPartyNotSet')
}
}
store.store()
@@ -131,7 +131,7 @@ Map reserveStoreInventory() {
GenericValue productStore =
from('ProductStore').where(parameters).cache().queryOne()
if (!productStore) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductProductStoreNotFound', parameters.locale))
+ return error('ProductUiLabels', 'ProductProductStoreNotFound')
}
GenericValue product = from('Product').where(parameters).cache().queryOne()
@@ -157,7 +157,7 @@ Map reserveStoreInventory() {
logInfo('ProductStoreService:Facility Found : [' + facilityFound +
']')
}
if (!facilityFound) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'FacilityNoAssociatedWithProcuctStore', parameters.locale))
+ return error('ProductUiLabels',
'FacilityNoAssociatedWithProcuctStore')
}
Map serviceResult = run service: 'reserveProductInventoryByFacility',
with: [*: parameters,
facilityId: facilityId,
@@ -177,7 +177,7 @@ Map reserveStoreInventory() {
} else {
if (productStore.oneInventoryFacility == 'Y') {
if (!productStore.inventoryFacilityId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductProductStoreNoSpecifiedInventoryFacility', parameters.locale))
+ return error('ProductUiLabels',
'ProductProductStoreNoSpecifiedInventoryFacility')
}
Map serviceResult = run service:
'reserveProductInventoryByFacility', with: [*: parameters,
facilityId: productStore.inventoryFacilityId,
@@ -288,7 +288,7 @@ Map isStoreInventoryAvailable() {
}
if (productStore.oneInventoryFacility == 'Y') {
if (!productStore.inventoryFacilityId) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductProductStoreNotCheckAvailability', parameters.locale))
+ return error('ProductUiLabels',
'ProductProductStoreNotCheckAvailability')
}
boolean isMarketingPkg = EntityTypeUtil.hasParentType(delegator,
'ProductType', 'productTypeId',
product.productTypeId, 'parentTypeId', 'MARKETING_PKG')
@@ -398,7 +398,7 @@ Map checkProductStoreRelatedPermission(Map inputParameter) {
(security.hasEntityPermission('CATALOG_ROLE', ('_' + checkAction),
userLogin) && roleStores))) {
logVerbose('Permission check failed, user does not have permission')
String checkActionLabel = 'ProductCatalog' + checkAction.charAt(0) +
checkAction.substring(1).toLowerCase() + 'PermissionError'
- return error(UtilProperties.getMessage('ProductUiLabels',
checkActionLabel, locale))
+ return error('ProductUiLabels', checkActionLabel)
}
return success()
}
@@ -409,7 +409,7 @@ Map checkProductStoreRelatedPermission(Map inputParameter) {
Map productStoreGenericPermission() {
Map result = success()
if (!parameters.mainAction) {
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'ProductMissingMainActionInPermissionService', parameters.locale)
+ String errorMessage = label('ProductUiLabels',
'ProductMissingMainActionInPermissionService')
logError(errorMessage)
return error(errorMessage)
}
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
index c52882fae1..6d335e9263 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentReceiptServices.groovy
@@ -22,7 +22,6 @@ import java.math.RoundingMode
import java.sql.Timestamp
import org.apache.ofbiz.base.util.UtilDateTime
-import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.condition.EntityCondition
@@ -43,11 +42,9 @@ Map createShipmentReceipt() {
newEntity.create()
if (parameters.inventoryItemDetailSeqId) {
- GenericValue invDet = from('InventoryItemDetail')
+ update('InventoryItemDetail')
.where(inventoryItemDetailSeqId:
parameters.inventoryItemDetailSeqId, inventoryItemId:
parameters.inventoryItemId)
- .queryOne()
- invDet.receiptId = receiptId
- invDet.store()
+ .set([receiptId: receiptId])
}
Boolean affectAccounting = true
@@ -79,7 +76,7 @@ Map receiveInventoryProduct () {
BigDecimal quantityRejected = parameters.quantityRejected ?:
BigDecimal.ZERO
if ((quantityRejected == BigDecimal.ZERO && parameters.quantityAccepted ==
BigDecimal.ZERO)
|| (quantityRejected < BigDecimal.ZERO || parameters.quantityAccepted
< BigDecimal.ZERO)) {
- return error(UtilProperties.getMessage('ProductUiLabels',
'ProductNoItemsToAcceptOrReject', parameters.locale))
+ return error('ProductUiLabels', 'ProductNoItemsToAcceptOrReject')
}
Map result = success()
@@ -90,7 +87,7 @@ Map receiveInventoryProduct () {
// if we are serialized and either a serialNumber or inventoyItemId is
passed in and the quantityAccepted is greater than 1 then complain
if ((parameters.serialNumber || parameters.currentInventoryItemId) &&
(parameters.quantityAccepted > (BigDecimal.ONE))) {
Map errorLog = [parameters: parameters]
- return error(UtilProperties.getMessage('ProductUiLabels',
'FacilityReceiveInventoryProduct', errorLog, parameters.locale))
+ return error('ProductUiLabels', 'FacilityReceiveInventoryProduct',
errorLog)
// before getting going, see if there are any validation issues so
far
}
if (parameters.quantityAccepted > BigDecimal.ZERO) {
@@ -384,10 +381,7 @@ Map cancelReceivedItems() {
// 4. updateProductIfAvailableFromShipment
// update the accepted and received quantity to zero in ShipmentReceipt
entity
- GenericValue shipmentReceipt =
from('ShipmentReceipt').where(parameters).queryOne()
- shipmentReceipt.quantityAccepted = 0.0
- shipmentReceipt.quantityRejected = 0.0
- shipmentReceipt.store()
+ update('ShipmentReceipt').where(parameters).set([quantityAccepted: 0.0,
quantityRejected: 0.0])
// create record for InventoryItemDetail entity
GenericValue inventoryItem = delegator.getRelatedOne('InventoryItem',
shipmentReceipt, false)
diff --git
a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentServices.groovy
b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentServices.groovy
index 7ee836266c..9347eb78b5 100644
---
a/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentServices.groovy
+++
b/applications/product/src/main/groovy/org/apache/ofbiz/product/shipment/ShipmentServices.groovy
@@ -101,7 +101,7 @@ Map createShipmentForReturn() {
shipmentCtx.shipmentTypeId = 'PURCHASE_RETURN'
shipmentCtx.statusId = 'SHIPMENT_INPUT'
} else {
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'FacilityReturnHeaderTypeNotSupported', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityReturnHeaderTypeNotSupported')
logError(errorMessage)
return error(errorMessage)
}
@@ -599,9 +599,7 @@ Map createShipmentPackage() {
* Update ShipmentPackage
*/
Map updateShipmentPackage() {
- GenericValue lookedUpValue =
from('ShipmentPackage').where(parameters).queryOne()
- lookedUpValue.setNonPKFields(parameters)
- lookedUpValue.store()
+ GenericValue lookedUpValue =
update('ShipmentPackage').where(parameters).set(parameters)
ensurePackageRouteSeg(lookedUpValue.shipmentId,
lookedUpValue.shipmentPackageSeqId)
return success()
}
@@ -617,8 +615,7 @@ Map deleteShipmentPackage() {
shipmentPackageSeqId: parameters.shipmentPackageSeqId)
.queryList()
if (shipmentPackageContents) {
- String errorMessage = UtilProperties.getMessage('ProductErrorUiLabels',
- 'ProductErrorShipmentPackageCannotBeDeleted', locale)
+ String errorMessage = label('ProductErrorUiLabels',
'ProductErrorShipmentPackageCannotBeDeleted')
return error(errorMessage)
}
GenericValue lookedUpValue =
from('ShipmentPackage').where(parameters).queryOne()
@@ -765,19 +762,19 @@ Map quickShipEntireOrder() {
GenericValue orderHeader = from('OrderHeader').where(parameters).queryOne()
if (!orderHeader || !orderHeader.productStoreId) {
// no store cannot use quick ship; throw error
- return error(UtilProperties.getMessage('ProductUiLabels',
'FacilityShipmentMissingProductStore', locale))
+ return error('ProductUiLabels', 'FacilityShipmentMissingProductStore')
}
// get the product store entity
GenericValue productStore = from('ProductStore').where(productStoreId:
orderHeader.productStoreId).queryOne()
if ('Y' != productStore?.reserveInventory) {
// no reservations; no shipment; cannot use quick ship
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'FacilityShipmentNotCreatedForNotReserveInventory',
[productStore: productStore], locale))
+ return error('ProductUiLabels',
+ 'FacilityShipmentNotCreatedForNotReserveInventory',
[productStore: productStore])
}
if (productStore.explodeOrderItems == 'Y') {
// can't insert duplicate rows in shipmentPackageContent
- return error(UtilProperties.getMessage('ProductUiLabels',
- 'FacilityShipmentNotCreatedForExplodesOrderItems',
[productStore: productStore], locale))
+ return error('ProductUiLabels',
+ 'FacilityShipmentNotCreatedForExplodesOrderItems',
[productStore: productStore])
}
// locate shipping facilities associated with order item rez's
List orderItemShipGrpInvResFacilityIds =
from('OrderItemAndShipGrpInvResAndItem')
@@ -803,7 +800,7 @@ Map quickShipEntireOrder() {
result.shipmentShipGroupFacilityList = shipmentShipGroupFacilityList
result.successMessageList = successMessageList
if (!shipmentShipGroupFacilityList) {
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'FacilityShipmentNotCreated', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityShipmentNotCreated')
return error(errorMessage)
}
return result
@@ -816,8 +813,7 @@ Map quickDropShipOrder() {
Map result = success()
GenericValue orderHeader = from('OrderHeader').where(parameters).queryOne()
if (orderHeader?.statusId == 'ORDER_CREATED') {
- String errorMessage = UtilProperties.getMessage('OrderErrorUiLabels',
- 'OrderApproveOrderBeforeQuickDropShip', locale)
+ String errorMessage = label('OrderErrorUiLabels',
'OrderApproveOrderBeforeQuickDropShip')
return error(errorMessage)
}
Map serviceResultCS = run service: 'createShipment', with:
[primaryOrderId: parameters.orderId,
@@ -905,7 +901,7 @@ Map getOrderItemShipGroupLists(GenericValue orderHeader) {
.queryList()
// make sure we have something to ship
if (!orderItemAndShipGroupAssocList) {
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'FacilityNoItemsAvailableToShip', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityNoItemsAvailableToShip')
logError(errorMessage)
return error(errorMessage)
}
@@ -1065,7 +1061,7 @@ Map createOrderShipmentPlan () {
GenericValue orderHeader = from('OrderHeader').where(parameters).queryOne()
if (!orderHeader?.productStoreId) {
// no store cannot use quick ship; throw error
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'FacilityNoQuickShip', locale)
+ String errorMessage = label('ProductUiLabels', 'FacilityNoQuickShip')
logError(errorMessage)
return error(errorMessage)
}
@@ -1199,7 +1195,7 @@ Map quickShipOrderByItem() {
if (!parameters.originFacilityId) {
if (!orderHeader?.productStoreId) {
// no store cannot use quick ship; throw error
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'FacilityNoQuickShip', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityNoQuickShip')
logError(errorMessage)
return error(errorMessage)
}
@@ -1210,28 +1206,25 @@ Map quickShipOrderByItem() {
.queryOne()
if (productStore.reserveInventory != 'Y') {
// no reservations; no shipment; cannot use quick ship
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
- 'FacilityNoQuickShipForNotReserveInventory', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityNoQuickShipForNotReserveInventory')
logError(errorMessage)
return error(errorMessage)
}
if (productStore.oneInventoryFacility != 'Y') {
// if we allow multiple facilities we cannot use quick ship; throw
error
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
- 'FacilityNoQuickShipForMultipleFacilities', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityNoQuickShipForMultipleFacilities')
logError(errorMessage)
return error(errorMessage)
}
if (!productStore.inventoryFacilityId) {
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
- 'FacilityNoQuickShipForNotInventoryFacility', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityNoQuickShipForNotInventoryFacility')
logError(errorMessage)
return error(errorMessage)
}
}
// make sure we have items to issue
if (!parameters.itemShipList) {
- String errorMessage = UtilProperties.getMessage('ProductUiLabels',
'FacilityNoItemsAvailableToShip', locale)
+ String errorMessage = label('ProductUiLabels',
'FacilityNoItemsAvailableToShip')
logError(errorMessage)
return error(errorMessage)
}
diff --git
a/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
b/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
index 1c67a08be6..76c75c044e 100644
---
a/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
+++
b/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/workeffort/WorkEffortServicesScript.groovy
@@ -390,16 +390,16 @@ Map duplicateWorkEffort() {
}
Map removeWorkEffortMap = [workEffortId: oldWorkEffort.workEffortId]
if (parameters.removeWorkEffortAssocs == 'Y') {
- delegator.removeByAnd('WorkEffortAssoc', removeWorkEffortMap)
+ delete('WorkEffortAssoc').where(removeWorkEffortMap)
}
if (parameters.removeWorkEffortNotes == 'Y') {
- delegator.removeByAnd('WorkEffortNote', removeWorkEffortMap)
+ delete('WorkEffortNote').where(removeWorkEffortMap)
}
if (parameters.removeWorkEffortContents == 'Y') {
- delegator.removeByAnd('WorkEffortContent', removeWorkEffortMap)
+ delete('WorkEffortContent').where(removeWorkEffortMap)
}
if (parameters.removeWorkEffortAssignmentRates == 'Y') {
- delegator.removeByAnd('RateAmount', removeWorkEffortMap)
+ delete('RateAmount').where(removeWorkEffortMap)
}
return success([workEffortId: workEffortId])
}
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 fce2148454..a5a7666551 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
@@ -97,7 +97,7 @@ Map convertUom() {
if (!uomConversion) {
// if still no uom conversion entity, then no conversion is possible
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonNoUomConversionFound', parameters.locale))
+ return error('CommonUiLabels', 'CommonNoUomConversionFound')
}
logVerbose("using conversion factor=${uomConversion.conversionFactor}")
// Do custom conversion, if we have customMethodId
@@ -153,7 +153,7 @@ Map convertUomCustom() {
String customMethodId = uomConversion.customMethodId
GenericValue customMethod = from('CustomMethod').where(customMethodId:
customMethodId).cache().queryOne()
if (!customMethod?.customMethodName) {
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonNoCustomMethodName', parameters.locale))
+ return error('CommonUiLabels', 'CommonNoCustomMethodName')
}
logVerbose('calling custom method' + customMethod.customMethodName)
Map serviceResult = run service: customMethod.customMethodName, with:
[arguments: parameters]
@@ -200,7 +200,7 @@ Map getVisualThemeResources() {
.queryList()
}
if (!resourceList) {
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonVisualThemeResourcesNotFound', parameters.locale))
+ return error('CommonUiLabels', 'CommonVisualThemeResourcesNotFound')
}
for (GenericValue resourceRecord : resourceList) {
String resourceTypeEnumId = resourceRecord.resourceTypeEnumId
@@ -354,6 +354,6 @@ Map deleteKeywordThesaurus() {
if (parameters.alternateKeyword) {
newEntity.alternateKeyword = parameters.alternateKeyword
}
- delegator.removeByAnd('KeywordThesaurus', newEntity)
+ delete('KeywordThesaurus').where(newEntity)
return success()
}
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
index 0bdd9cdadc..94098b436c 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
@@ -40,9 +40,9 @@ String duplicatePortalPage() {
*/
String setPortalPortletAttributes() {
if (parameters) {
- delegator.removeByAnd('PortletAttribute', [portalPageId:
parameters.portalPageId,
- portalPortletId:
parameters.portalPortletId,
- portletSeqId:
parameters.portletSeqId])
+ delete('PortletAttribute').where([portalPageId:
parameters.portalPageId,
+ portalPortletId:
parameters.portalPortletId,
+ portletSeqId:
parameters.portletSeqId])
List skipField = ['portalPageId', 'portalPortletId', 'portletSeqId']
parameters.each {
if (skipField.contains(it.key)) {
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
index 60076f4b56..46d0726473 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
@@ -114,9 +114,9 @@ Map deletePortalPagePortlet() {
}
GenericValue portalPagePortlet =
from('PortalPagePortlet').where(parameters).queryOne()
if (portalPagePortlet) {
- delegator.removeByAnd('PortletAttribute', [portalPageId:
portalPagePortlet.portalPageId,
- portalPortletId:
portalPagePortlet.portalPortletId,
- portletSeqId:
portalPagePortlet.portletSeqId])
+ delete('PortletAttribute').where([portalPageId:
portalPagePortlet.portalPageId,
+ portalPortletId:
portalPagePortlet.portalPortletId,
+ portletSeqId:
portalPagePortlet.portletSeqId])
portalPagePortlet.remove()
}
return success()
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
index 49271f9ff2..d2de198549 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/SetTimeZoneFromBrowser.groovy
@@ -18,15 +18,15 @@
*/
package org.apache.ofbiz.common
+import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.service.ServiceUtil
Map setTimeZoneFromBrowser() {
if (parameters?.userLogin?.userLoginId) {
- userLogin = from('UserLogin').where('userLoginId',
parameters.userLogin.userLoginId).queryFirst()
+ GenericValue userLogin = from('UserLogin').where('userLoginId',
parameters.userLogin.userLoginId).queryOne()
if (userLogin) {
if (!userLogin.lastTimeZone || userLogin.lastTimeZone == 'null') {
- userLogin.lastTimeZone = parameters.localeName
- userLogin.store()
+ update('UserLogin').where('userLoginId',
parameters.userLogin.userLoginId).set([lastTimeZone: parameters.localeName])
return ServiceUtil.returnSuccess()
}
}
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
index a08eaa6870..82edce3c2e 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/email/EmailServicesScript.groovy
@@ -31,7 +31,7 @@ Map sendMailFromTemplateSetting() {
// if partyIdTo provided but no emailAddress, get it from the
partyContactMech
if (!parameters.sendTo && !parameters.partyIdTo) {
logError('PartyId or SendTo should be specified!')
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonEmailShouldBeSpecified', parameters.locale))
+ return error('CommonUiLabels', 'CommonEmailShouldBeSpecified')
}
if (parameters.partyIdTo && !parameters.sendTo) {
Map getEmail = [partyId: parameters.partyIdTo]
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/permission/CommonPermissionServices.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/permission/CommonPermissionServices.groovy
index 912a4890b0..82ba858361 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/permission/CommonPermissionServices.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/permission/CommonPermissionServices.groovy
@@ -25,13 +25,13 @@ Map genericBasePermissionCheck() {
// allow mainAction to be set from outside methods or direct to the service
String mainAction = parameters.mainAction
if (!mainAction) {
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonPermissionMainActionAttributeMissing', parameters.locale))
+ return error('CommonUiLabels',
'CommonPermissionMainActionAttributeMissing')
}
// allow primary permission to be set from outside methods or direct to
the service
String primaryPermission = parameters.primaryPermission
if (!primaryPermission) {
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonPermissionPrimaryPermissionMissing', parameters.locale))
+ return error('CommonUiLabels',
'CommonPermissionPrimaryPermissionMissing')
}
logVerbose("Checking for primary permission
${primaryPermission}_${mainAction}")
@@ -74,7 +74,7 @@ Map getAllCrudPermissions() {
result.hasViewPermission = false
String primaryPermission = parameters.primaryPermission
if (!primaryPermission) {
- return error(UtilProperties.getMessage('CommonUiLabels',
'CommonPermissionPrimaryPermissionMissing', parameters.locale))
+ return error('CommonUiLabels',
'CommonPermissionPrimaryPermissionMissing')
}
logInfo("Getting all CRUD permissions for ${primaryPermission}")
result = hasCrudPermission(primaryPermission, result)
diff --git
a/framework/entityext/src/main/groovy/org/apache/ofbiz/entityext/EntitySyncServices.groovy
b/framework/entityext/src/main/groovy/org/apache/ofbiz/entityext/EntitySyncServices.groovy
index 5c9ce98172..730e3e7545 100644
---
a/framework/entityext/src/main/groovy/org/apache/ofbiz/entityext/EntitySyncServices.groovy
+++
b/framework/entityext/src/main/groovy/org/apache/ofbiz/entityext/EntitySyncServices.groovy
@@ -27,8 +27,7 @@ Map entitySyncPermissionCheck() {
Map resetEntitySyncStatus() {
entitySyncRecord = from('EntitySync').where('entitySyncId',
parameters.entitySyncId).queryOne()
if (entitySyncRecord && entitySyncRecord.runStatusId == 'ESR_RUNNING') {
- entitySyncRecord.runStatusId = 'ESR_NOT_STARTED'
- entitySyncRecord.store()
+ update('EntitySync').where('entitySyncId',
parameters.entitySyncId).set([runStatusId: 'ESR_NOT_STARTED'])
}
return success()
}
diff --git
a/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/EntityUpdateBuilder.groovy
b/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/EntityUpdateBuilder.groovy
index 8edf04a474..d0d9677afe 100644
---
a/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/EntityUpdateBuilder.groovy
+++
b/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/EntityUpdateBuilder.groovy
@@ -52,7 +52,11 @@ class EntityUpdateBuilder {
if (existing == null) {
throw new ServiceErrorException("No ${entityName} found matching
${whereFields}" as String)
}
- existing.putAll(fields)
+ // Like setNonPKFields(), not a raw Map.putAll(): walks the entity's
own non-PK fields and pulls
+ // matching values out of the given map, silently ignoring anything
else (e.g. userLogin, locale,
+ // timeZone commonly present in a raw service parameters map). This is
what makes it safe to call
+ // as update(entity).where(cond).set(parameters) -- the primary use
case this builder exists for.
+ existing.setNonPKFields(fields)
existing.store()
return existing
}