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 e226e070df Fixed: Four regressions in the minilang-to-Groovy 
conversion of PartyServicesScript.groovy (OFBIZ-13593)
e226e070df is described below

commit e226e070df5ae055270f398abc5be17fbc11a332
Author: Mridul Pathak <[email protected]>
AuthorDate: Wed Sep 16 12:28:16 2026 +0530

    Fixed: Four regressions in the minilang-to-Groovy conversion of 
PartyServicesScript.groovy (OFBIZ-13593)
    
    - followPartyRelationshipsInlineRecurse read a nonexistent 
partyRel.partyFrom field (the actual field is partyIdFrom) in the 
includeFromToSwitched=='Y' branch, throwing IllegalArgumentException; reachable 
via getParentOrganizations
    - getChildRoleTypes returned only the discovered child role types, omitting 
the original seed roleTypeId; the other two callers of getChildRoleTypesInline 
already prepend the seed, and the service's own description states the result 
"will contain the original roleTypeId"
    - getPartiesByRelationship used lookupMap.setAllFields(parameters, false, 
null, null), which includes any of fromDate/thruDate/relationshipName the 
caller happens to pass (they're valid optional IN params per the servicedef), 
producing narrower result sets than the original minilang, which explicitly 
copied only partyIdFrom, partyIdTo, roleTypeIdFrom, roleTypeIdTo, statusId, 
priorityTypeId, and partyRelationshipTypeId
    - getPartyNameForDate reassigns person to the matching PartyNameHistory 
record when a historical name change applies, then gates the gender result on 
!partyNameHistoryCurrent - a condition that's always false whenever that 
reassignment happened, silently dropping gender (PartyNameHistory has no gender 
field of its own); gender is now captured from the original Person record 
before the reassignment and always used
    
    Each fix was verified against the original minilang and covered by a 
temporary RED/GREEN test before removal, and the party component's test suite 
passes unchanged.
---
 .../org/apache/ofbiz/party/party/PartyServicesScript.groovy  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
index 6d1a768462..d15052c648 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyServicesScript.groovy
@@ -76,6 +76,7 @@ Map getPartyNameForDate() {
 
     GenericValue person = from('Person').where(parameters).queryOne()
     GenericValue partyGroup = from('PartyGroup').where(parameters).queryOne()
+    String gender = person?.gender
 
     parameters.compareDate = parameters.compareDate ?: 
UtilDateTime.nowTimestamp()
 
@@ -109,8 +110,8 @@ Map getPartyNameForDate() {
         if (person.suffix) {
             resultMap.suffix = person.suffix
         }
-        if (!partyNameHistoryCurrent && person.gender) {
-            resultMap.gender = person.gender
+        if (gender) {
+            resultMap.gender = gender
         }
 
         resultMap.fullName = PartyHelper.getPartyName(person, 
parameters.lastNameFirst == 'Y')
@@ -193,7 +194,8 @@ Map getPartiesByRelationship() {
     Map resultMap = success()
 
     GenericValue lookupMap = makeValue('PartyRelationship')
-    lookupMap.setAllFields(parameters, false, null, null)
+    lookupMap.setAllFields(parameters.subMap(['partyIdFrom', 'partyIdTo', 
'roleTypeIdFrom', 'roleTypeIdTo',
+                                              'statusId', 'priorityTypeId', 
'partyRelationshipTypeId']), false, null, null)
     List<String> partyIdTos = from('PartyRelationship')
         .where(lookupMap)
         .getFieldList('partyIdTo')
@@ -248,7 +250,7 @@ Map getChildRoleTypes () {
 
     Map res = getChildRoleTypesInline([parameters.roleTypeId])
 
-    resultMap.childRoleTypeIdList = res.childRoleTypeIdList
+    resultMap.childRoleTypeIdList = [parameters.roleTypeId] + 
(res.childRoleTypeIdList ?: [])
     return resultMap
 }
 
@@ -907,7 +909,7 @@ Map followPartyRelationshipsInlineRecurse (List 
relatedPartyIdList, List roleTyp
                         .cache(useCache == 'Y')
                         .queryList()
                 partyRelationshipList.findAll { partyRel ->
-                    !relatedPartyIdList.contains(partyRel.partyFrom) && 
!newRelatedPartyIdList.contains(partyRel.partyIdFrom) }.each {
+                    !relatedPartyIdList.contains(partyRel.partyIdFrom) && 
!newRelatedPartyIdList.contains(partyRel.partyIdFrom) }.each {
                     newRelatedPartyIdList << it.partyIdFrom
                 }
             }

Reply via email to