This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 9fe258fd6a Fixed: Six regressions in the minilang-to-Groovy conversion
of ProductServicesScript.groovy (OFBIZ-13621)
9fe258fd6a is described below
commit 9fe258fd6a55ad4974f5e10d156e940634797058
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 29 17:28:30 2026 +0530
Fixed: Six regressions in the minilang-to-Groovy conversion of
ProductServicesScript.groovy (OFBIZ-13621)
- deleteProductGroupOrder() always threw: it called
removeRelated('OrderItemGroupOrder'), a relation that doesn't exist on
ProductGroupOrder, and removed the parent row before its children. Now removes
OrderItemGroupOrder rows first, then the parent.
- checkProductRelatedPermission() dropped the product's category-membership
date filter, since a second filterByDate() call replaced rather than added to
the first. A limited-admin could retain permission via an expired category
membership.
- forceIndexProductKeywords() and deleteProductKeywords() added .cache() to
their Product lookup, not present in the original mini-lang.
- cancleOrderItemGroupOrder() treated a legitimate cancelQuantity of zero
as unset due to Groovy's truthiness on BigDecimal.
- updateProductQuickAdminName() passed the wrong method-name string to its
permission check, producing a misleading error message.
---
.../product/product/product/ProductServicesScript.groovy | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
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..44946767ae 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
@@ -122,7 +122,7 @@ Map updateProduct() {
* Update a Product Name from quick admin
*/
Map updateProductQuickAdminName() {
- Map res = checkProductRelatedPermission('updateQuickAdminName', 'UPDATE')
+ Map res = checkProductRelatedPermission('updateProductQuickAdminName',
'UPDATE')
if (!ServiceUtil.isSuccess(res)) {
return res
@@ -311,7 +311,7 @@ Map duplicateProduct() {
* induce all the keywords of a product
*/
Map forceIndexProductKeywords() {
- GenericValue product = from('Product').where(parameters).cache().queryOne()
+ GenericValue product = from('Product').where(parameters).queryOne()
KeywordIndex.forceIndexKeywords(product)
return success()
}
@@ -320,7 +320,7 @@ Map forceIndexProductKeywords() {
* delete all the keywords of a produc
*/
Map deleteProductKeywords() {
- GenericValue product = from('Product').where(parameters).cache().queryOne()
+ GenericValue product = from('Product').where(parameters).queryOne()
product.removeRelated('ProductKeyword')
return success()
}
@@ -582,7 +582,7 @@ Map checkProductRelatedPermission(String callingMethodName,
String checkAction)
roleTypeId: 'LTD_ADMIN']
roleCategories = from('ProductCategoryMemberAndRole')
.where(lookupRoleCategoriesMap)
- .filterByDate('roleFromDate', 'roleThruDate')
+ .filterByDate('fromDate', 'thruDate', 'roleFromDate',
'roleThruDate')
.queryList()
}
@@ -794,8 +794,10 @@ Map updateProductGroupOrder() {
*/
Map deleteProductGroupOrder() {
GenericValue productGroupOrder =
from('ProductGroupOrder').where(parameters).queryOne()
+ from('OrderItemGroupOrder').where(groupOrderId:
productGroupOrder.groupOrderId).queryList().each {
+ it.remove()
+ }
productGroupOrder.remove()
- productGroupOrder.removeRelated('OrderItemGroupOrder')
GenericValue jobSandbox = from('JobSandbox').where(jobId:
productGroupOrder.jobId).queryOne()
if (jobSandbox) {
@@ -895,7 +897,7 @@ Map cancleOrderItemGroupOrder() {
if (productGroupOrder) {
if (productGroupOrder.statusId == 'GO_CREATED') {
if (orderItem.statusId == 'ITEM_CANCELLED') {
- BigDecimal cancelQuantity = orderItem.cancelQuantity
?: orderItem.quantity
+ BigDecimal cancelQuantity = orderItem.cancelQuantity
!= null ? orderItem.cancelQuantity : orderItem.quantity
productGroupOrder.soldOrderQty -= cancelQuantity
}
productGroupOrder.store()