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 94186135d7 Fixed: Promo conditions PPIP_ORST_YEAR and 
PPIP_ORST_LAST_YEAR read the order sub-total from the wrong map (OFBIZ-13667)
94186135d7 is described below

commit 94186135d789f4bf152f38fee07b4ed83a47950c
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Oct 9 13:18:09 2026 +0530

    Fixed: Promo conditions PPIP_ORST_YEAR and PPIP_ORST_LAST_YEAR read the 
order sub-total from the wrong map (OFBIZ-13667)
    
    productOrderYear and productOrderLastYear keep the answer of 
getOrderedSummaryInformation in serviceResult but read the sub-total from their 
own result map, so the sub-total was always null and the condition never 
reflected the order history. Read totalSubRemainingAmount from serviceResult, 
and use serviceResult when checking for an error and when logging the error 
message (also in productOrderHist), since productOrderYear tested its own 
result for an error.
    
    (cherry picked from commit 0855ff5cdd4744468f8c4ae7573723689ece2160)
---
 .../product/product/promo/ProductPromoCondServices.groovy    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/promo/ProductPromoCondServices.groovy
 
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/promo/ProductPromoCondServices.groovy
index 15d575189c..cc2d286535 100644
--- 
a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/promo/ProductPromoCondServices.groovy
+++ 
b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/promo/ProductPromoCondServices.groovy
@@ -405,7 +405,7 @@ Map productOrderHist() {
             Map<String, Object> serviceResult = run service: 
'getOrderedSummaryInformation', with: serviceIn
             if (ServiceUtil.isError(serviceResult)) {
                 logError('Error calling getOrderedSummaryInformation service 
for the PPIP_ORST_HIST ProductPromo condition input value: '
-                        + ServiceUtil.getErrorMessage(result))
+                        + ServiceUtil.getErrorMessage(serviceResult))
                 return serviceResult
             }
             BigDecimal orderSubTotal = 
serviceResult.get('totalSubRemainingAmount')
@@ -452,12 +452,12 @@ Map productOrderYear() {
                 'userLogin', userLogin)
         try {
             Map<String, Object> serviceResult = 
dispatcher.runSync('getOrderedSummaryInformation', serviceIn)
-            if (ServiceUtil.isError(result)) {
+            if (ServiceUtil.isError(serviceResult)) {
                 logError('Error calling getOrderedSummaryInformation service 
for the PPIP_ORST_YEAR ProductPromo condition input value: '
-                        + ServiceUtil.getErrorMessage(result))
+                        + ServiceUtil.getErrorMessage(serviceResult))
                 return serviceResult
             }
-            BigDecimal orderSubTotal = result.get('totalSubRemainingAmount')
+            BigDecimal orderSubTotal = 
serviceResult.get('totalSubRemainingAmount')
             if (Debug.verboseOn()) {
                 logVerbose('Doing order history sub-total compare: 
orderSubTotal=' + orderSubTotal + ', for the last '
                         + monthsToInclude + ' months.')
@@ -510,10 +510,10 @@ Map productOrderLastYear() {
             Map<String, Object> serviceResult = 
dispatcher.runSync('getOrderedSummaryInformation', serviceIn)
             if (ServiceUtil.isError(serviceResult)) {
                 logError('Error calling getOrderedSummaryInformation service 
for the PPIP_ORST_LAST_YEAR ProductPromo condition input value: '
-                        + ServiceUtil.getErrorMessage(result))
+                        + ServiceUtil.getErrorMessage(serviceResult))
                 return serviceResult
             }
-            BigDecimal orderSubTotal = (BigDecimal) 
result.get('totalSubRemainingAmount')
+            BigDecimal orderSubTotal = (BigDecimal) 
serviceResult.get('totalSubRemainingAmount')
             if (Debug.verboseOn()) {
                 logVerbose('Doing order history sub-total compare: 
orderSubTotal=' + orderSubTotal + ', for last year.')
             }

Reply via email to