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

commit 3b63151e7d9a501a538dff54a71595f9eb348b39
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.
---
 .../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