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

jleroux 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 bc384fd978 fixed: PartyFinancialHistory throws an error (OFBIZ-13099) 
(#804)
bc384fd978 is described below

commit bc384fd978a36a51bad71a63135165f40f3676b3
Author: Pierre Smits <pierre.sm...@somonar.com>
AuthorDate: Fri May 24 14:04:51 2024 +0200

    fixed: PartyFinancialHistory throws an error (OFBIZ-13099) (#804)
    
    * fixed: PartyFinancialHistory throws an error (OFBIZ-13099)
    
    When accessing the financial history screen in the partymgr application 
(e.g. via 
https://localhost:8443/partymgr/control/PartyFinancialHistory?partyId=EuroSupplier),
 following error multiple times are thrown:
    
    modified:
    - replaced .hasNext() in PartyFinancialHistory.groovy, 
UnAppliedInvoicesForParty.groovy, UnAppliedPaymentsForParty.groovy
    
    * cleanup
    
    * fixed: PartyFinancialHistory throws an error (OFBIZ-13099)
    
    fixed while issue
    
    * fixed: PartyFinancialHistory throws an error (OFBIZ-13099)
    
    removed iterator .close()
    
    * Update UnAppliedInvoicesForParty.groovy
    
    Fixes:
    C:\projectsASF\Git\ofbiz-framework>git apply 804.patch
    804.patch:69: trailing whitespace.
    
    warning: 1 line adds whitespace errors.
    
    ---------
    
    Co-authored-by: Jacques Le Roux <jacques.le.r...@les7arts.com>
---
 .../org/apache/ofbiz/party/party/PartyFinancialHistory.groovy    | 9 +++------
 .../apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy    | 3 +--
 .../apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy    | 3 +--
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy
index 251b3f5e3c..aaca58f5c3 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyFinancialHistory.groovy
@@ -54,8 +54,8 @@ invExprs =
 
 invIterator = 
from('InvoiceAndType').where(invExprs).cursorScrollInsensitive().distinct().queryIterator()
 
-while (invIterator.hasNext()) {
-    invoice = invIterator.next()
+while (invIterator.next()) {
+    invoice = nvIterator.next()
     Boolean isPurchaseInvoice = EntityTypeUtil.hasParentType(delegator, 
'InvoiceType', 'invoiceTypeId',
             invoice.getString('invoiceTypeId'), 'parentTypeId', 
'PURCHASE_INVOICE')
     Boolean isSalesInvoice = EntityTypeUtil.hasParentType(delegator, 
'InvoiceType', 'invoiceTypeId', (String) invoice.getString('invoiceTypeId'),
@@ -74,8 +74,6 @@ while (invIterator.hasNext()) {
     }
 }
 
-invIterator.close()
-
 //get total/unapplied/applied payment in/out total amount:
 totalPayInApplied = BigDecimal.ZERO
 totalPayInNotApplied = BigDecimal.ZERO
@@ -100,7 +98,7 @@ payExprs =
 
 payIterator = 
from('PaymentAndType').where(payExprs).cursorScrollInsensitive().distinct().queryIterator()
 
-while (payIterator.hasNext()) {
+while (payIterator.next()) {
     payment = payIterator.next()
     if (payment.parentTypeId == 'DISBURSEMENT' || payment.parentTypeId == 
'TAX_PAYMENT') {
         totalPayOutApplied += PaymentWorker.getPaymentApplied(payment, 
actualCurrency).setScale(2, BigDecimal.ROUND_HALF_UP)
@@ -115,7 +113,6 @@ while (payIterator.hasNext()) {
                 + ' !!!! Should be either DISBURSEMENT, TAX_PAYMENT or 
RECEIPT')
     }
 }
-payIterator.close()
 
 context.finanSummary = [:]
 context.finanSummary.totalSalesInvoice = totalSalesInvoice = 
totalInvSaApplied.add(totalInvSaNotApplied)
diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy
index 8fde431464..61ab4c8fbf 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedInvoicesForParty.groovy
@@ -46,7 +46,7 @@ invExprs =
 
 invIterator = 
from('InvoiceAndType').where(invExprs).cursorScrollInsensitive().distinct().queryIterator()
 invoiceList = []
-while (invIterator.hasNext()) {
+while (invIterator.next()) {
     invoice = invIterator.next()
     unAppliedAmount = InvoiceWorker.getInvoiceNotApplied(invoice, 
actualCurrency).setScale(2, BigDecimal.ROUND_HALF_UP)
     if (unAppliedAmount.signum() == 1) {
@@ -64,6 +64,5 @@ while (invIterator.hasNext()) {
                          invoiceParentTypeId: invoice.parentTypeId])
     }
 }
-invIterator.close()
 
 context.ListUnAppliedInvoices = invoiceList
diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy
index 94c36de6e9..1860746f1e 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/UnAppliedPaymentsForParty.groovy
@@ -48,7 +48,7 @@ payExprs =
 paymentList = []
 payIterator = 
from('PaymentAndType').where(payExprs).cursorScrollInsensitive().distinct().queryIterator()
 
-while (payIterator.hasNext()) {
+while (payIterator.next()) {
     payment = payIterator.next()
     unAppliedAmount = PaymentWorker.getPaymentNotApplied(payment, 
actualCurrency).setScale(2, BigDecimal.ROUND_HALF_UP)
     if (unAppliedAmount.signum() == 1) {
@@ -68,6 +68,5 @@ while (payIterator.hasNext()) {
                          paymentParentTypeId: payment.parentTypeId])
     }
 }
-payIterator.close()
 
 context.paymentList = paymentList

Reply via email to