This is an automated email from the ASF dual-hosted git repository.

mridulpathak 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 80e1dfa730 Fixed: Six regressions in the minilang-to-Groovy conversion 
of ProductServicesScript.groovy (OFBIZ-13621)
80e1dfa730 is described below

commit 80e1dfa730eb536aeba68b77ecd791321bc7992c
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 d9f6702719..1611b327c1 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
@@ -115,7 +115,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
@@ -302,7 +302,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()
 }
@@ -311,7 +311,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()
 }
@@ -565,7 +565,7 @@ Map checkProductRelatedPermission(String callingMethodName, 
String checkAction)
                                        roleTypeId: 'LTD_ADMIN']
         roleCategories = from('ProductCategoryMemberAndRole')
                 .where(lookupRoleCategoriesMap)
-                .filterByDate('roleFromDate', 'roleThruDate')
+                .filterByDate('fromDate', 'thruDate', 'roleFromDate', 
'roleThruDate')
                 .queryList()
     }
 
@@ -763,8 +763,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) {
@@ -863,7 +865,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()

Reply via email to