You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2026/05/06 14:19:30 UTC

(ofbiz-plugins) branch trunk updated: Used queryFirst instead using queryIterator to get first record

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

dixitdeepak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 21dd03fa5 Used queryFirst instead using queryIterator to get first record
21dd03fa5 is described below

commit 21dd03fa558e668360765804cf8fa5523d746c04
Author: Deepak Dixit <de...@hotwax.co>
AuthorDate: Wed May 6 19:49:21 2026 +0530

    Used queryFirst instead using queryIterator to get first record
---
 .../main/groovy/org/apache/ofbiz/projectmgr/EditWeekTimesheet.groovy  | 4 +---
 .../src/main/groovy/org/apache/ofbiz/scrum/EditDailyHourReport.groovy | 4 +---
 scrum/src/main/groovy/org/apache/ofbiz/scrum/EditWeekTimesheet.groovy | 4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/projectmgr/src/main/groovy/org/apache/ofbiz/projectmgr/EditWeekTimesheet.groovy b/projectmgr/src/main/groovy/org/apache/ofbiz/projectmgr/EditWeekTimesheet.groovy
index 9b4bfbc65..cf2a8e9a9 100644
--- a/projectmgr/src/main/groovy/org/apache/ofbiz/projectmgr/EditWeekTimesheet.groovy
+++ b/projectmgr/src/main/groovy/org/apache/ofbiz/projectmgr/EditWeekTimesheet.groovy
@@ -44,9 +44,7 @@ if (timesheetId) {
             EntityCondition.makeCondition('thruDate', EntityComparisonOperator.GREATER_THAN, midweek),
             EntityCondition.makeCondition('partyId', EntityComparisonOperator.EQUALS, partyId)
     ], EntityOperator.AND)
-    entryIterator = from('Timesheet').where(entryExprs).queryIterator()
-    timesheet = entryIterator.next()
-    entryIterator.close()
+    timesheet = from('Timesheet').where(entryExprs).queryFirst()
     if (!timesheet) {
         result = run servic: 'createProjectTimesheet', with: [partyId: partyId]
         if (result && result.timesheetId) {
diff --git a/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditDailyHourReport.groovy b/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditDailyHourReport.groovy
index 432a64592..01c86f0af 100644
--- a/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditDailyHourReport.groovy
+++ b/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditDailyHourReport.groovy
@@ -47,9 +47,7 @@ if (timesheetId) {
             EntityCondition.makeCondition('thruDate', EntityComparisonOperator.GREATER_THAN, midweek),
             EntityCondition.makeCondition('partyId', EntityComparisonOperator.EQUALS, partyId)
     ], EntityOperator.AND)
-    entryIterator = from('Timesheet').where(entryExprs).queryIterator()
-    timesheet = entryIterator.next()
-    entryIterator.close()
+    timesheet = from('Timesheet').where(entryExprs).queryFirst()
     if (timesheet == null) {
         result = runService('createProjectTimesheet', ['userLogin': parameters.userLogin, 'partyId': partyId])
         if (result && result.timesheetId) {
diff --git a/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditWeekTimesheet.groovy b/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditWeekTimesheet.groovy
index 51d1490b9..4f3471228 100644
--- a/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditWeekTimesheet.groovy
+++ b/scrum/src/main/groovy/org/apache/ofbiz/scrum/EditWeekTimesheet.groovy
@@ -44,9 +44,7 @@ if (timesheetId) {
             EntityCondition.makeCondition('thruDate', EntityComparisonOperator.GREATER_THAN, midweek),
             EntityCondition.makeCondition('partyId', EntityComparisonOperator.EQUALS, partyId)
     ], EntityOperator.AND)
-    entryIterator = from('Timesheet').where(entryExprs).queryIterator()
-    timesheet = entryIterator.next()
-    entryIterator.close()
+    timesheet = from('Timesheet').where(entryExprs).queryFirst()
     if (!timesheet) {
         result = run servic: 'createProjectTimesheet', with: [partyId: partyId]
         if (result && result.timesheetId) {