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 88b5ac9bbd Fix party invitation permission and status handling and the 
lead phone extension
88b5ac9bbd is described below

commit 88b5ac9bbdaaead1c9671405b9d6c9b7c89deb0d
Author: Mridul Pathak <[email protected]>
AuthorDate: Thu Oct 22 19:24:22 2026 +0530

    Fix party invitation permission and status handling and the lead phone 
extension
    
    Three regressions from the minilang conversion:
    
    - acceptPartyInvitation creates the missing roles through createPartyRole, 
which carries the party role permission check, instead of the permission-free 
ensurePartyRole, so an invitee can no longer add the invitation roles to an 
arbitrary party.
    - declinePartyInvitation and cancelPartyInvitation are real wrappers around 
updatePartyInvitation that set PARTYINV_DECLINED and PARTYINV_CANCELLED, and no 
longer accept a statusId from the caller.
    - createPersonRoleAndContactMechs declares the optional extension 
attribute, so the phone extension entered when creating a lead is not filtered 
out by run service anymore.
---
 applications/party/servicedef/services.xml               |  7 +++----
 .../ofbiz/party/party/PartyInvitationServices.groovy     | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/applications/party/servicedef/services.xml 
b/applications/party/servicedef/services.xml
index fceeab9d8c..3a2ab0d2bc 100644
--- a/applications/party/servicedef/services.xml
+++ b/applications/party/servicedef/services.xml
@@ -137,6 +137,7 @@ under the License.
         <auto-attributes entity-name="TelecomNumber" mode="IN" 
optional="true"/>
         <attribute name="roleTypeId" mode="IN" type="String"/>
         <attribute name="emailAddress" type="String" mode="IN" 
optional="true"/>
+        <attribute name="extension" type="String" mode="IN" optional="true"/>
         <attribute name="partyId" mode="OUT" type="String" optional="false"/>
     </service>
     <service name="updatePerson" engine="java" default-entity-name="Person"
@@ -1243,20 +1244,18 @@ under the License.
          </attribute>
     </service>
     <service name="declinePartyInvitation" engine="groovy"
-            
location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy"
 invoke="updatePartyInvitation">
+            
location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy"
 invoke="declinePartyInvitation">
         <permission-service 
service-name="accAndDecPartyInvitationPermissionCheck"/>
         <attribute name="partyInvitationId" type="String" mode="IN" 
optional="false">
             <type-validate>
                 <fail-property resource="PartyErrorUiLabels" 
property="PartyRequiredFieldMissingPartyInvitationId"/>
             </type-validate>
         </attribute>
-        <attribute name="statusId" type="String" mode="IN" optional="true" 
default-value="PARTYINV_DECLINED"/>
     </service>
     <service name="cancelPartyInvitation" engine="groovy"
-            
location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy"
 invoke="updatePartyInvitation">
+            
location="component://party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy"
 invoke="cancelPartyInvitation">
         <permission-service 
service-name="cancelPartyInvitationPermissionCheck"/>
         <attribute name="partyInvitationId" type="String" mode="IN"/>
-        <attribute name="statusId" type="String" mode="IN" optional="true" 
default-value="PARTYINV_CANCELLED"/>
     </service>
 
     <!-- Permission checking services-->
diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy
index 148dfdc435..462a662d89 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/PartyInvitationServices.groovy
@@ -66,10 +66,11 @@ Map acceptPartyInvitation() {
             .where(partyInvitationId: parameters.partyInvitationId)
             .queryList()
     if (partyInvitationRoleAssocs) {
-        Map ensurePartyRoleCtx = [partyId: parameters.partyId]
+        // createPartyRole carries the permission check, ensurePartyRole does 
not
         partyInvitationRoleAssocs.each {
-            ensurePartyRoleCtx.roleTypeId = it.roleTypeId
-            run service: 'ensurePartyRole', with: ensurePartyRoleCtx
+            if (!from('PartyRole').where(partyId: parameters.partyId, 
roleTypeId: it.roleTypeId).queryOne()) {
+                run service: 'createPartyRole', with: [partyId: 
parameters.partyId, roleTypeId: it.roleTypeId]
+            }
         }
     }
 
@@ -79,3 +80,12 @@ Map acceptPartyInvitation() {
     return result
 }
 
+Map declinePartyInvitation() {
+    return run(service: 'updatePartyInvitation', with: [partyInvitationId: 
parameters.partyInvitationId,
+                                                        statusId: 
'PARTYINV_DECLINED'])
+}
+
+Map cancelPartyInvitation() {
+    return run(service: 'updatePartyInvitation', with: [partyInvitationId: 
parameters.partyInvitationId,
+                                                        statusId: 
'PARTYINV_CANCELLED'])
+}

Reply via email to