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 f2059c894c Fixed: PortalPageMethods portlet attribute saving and page 
copying regressions (OFBIZ-13568)
f2059c894c is described below

commit f2059c894c94d765778c8158c7455d8b599708a4
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Sep 11 15:30:55 2026 +0530

    Fixed: PortalPageMethods portlet attribute saving and page copying 
regressions (OFBIZ-13568)
    
    - setPortalPortletAttributes now includes the 'with:' keyword in its 'run 
service:' call, fixing a runtime MissingMethodException when saving portlet 
attributes.
    - copyIfRequiredSystemPage sets the portalPageId request attribute and 
parameter and returns 'success' when invoked in a controller event context.
    - duplicatePortalPage restores the original minilang guard on 
originalPortalPageId.
---
 .../apache/ofbiz/common/PortalPageMethods.groovy   | 32 +++++++++++++---------
 .../apache/ofbiz/common/PortalPageServices.groovy  |  3 +-
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
index 34d401b1fe..0bdd9cdadc 100644
--- 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
+++ 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy
@@ -25,9 +25,10 @@ import org.apache.ofbiz.entity.GenericValue
  */
 String duplicatePortalPage() {
     GenericValue portalPage = from('PortalPage').where(parameters).queryOne()
-    Map serviceResult = run service: 'createPortalPage', with: [*: 
portalPage.getAllFields(),
-                                                                portalPageId: 
null,
-                                                                
originalPortalPageId: parameters.portalPageId]
+    Map createPage = [*: portalPage.getAllFields(),
+                      portalPageId: null,
+                      originalPortalPageId: portalPage.originalPortalPageId ?: 
parameters.portalPageId]
+    Map serviceResult = run service: 'createPortalPage', with: createPage
     run service: 'duplicatePortalPageDetails', with: [fromPortalPageId: 
parameters.portalPageId,
                                                       toPortalPageId: 
serviceResult.portalPageId]
     request.setAttribute('portalPageId', serviceResult.portalPageId)
@@ -56,9 +57,9 @@ String setPortalPortletAttributes() {
             if (porletAttr) {
                 porletAttr.remove()
             }
-            run service: 'createPortletAttribute', [*: parameters,
-                                                    attrName: it.key,
-                                                    attrValue: it.value]
+            run service: 'createPortletAttribute', with: [*: parameters,
+                                                          attrName: it.key,
+                                                          attrValue: it.value]
         }
     }
     return success()
@@ -70,18 +71,23 @@ String setPortalPortletAttributes() {
 String copyIfRequiredSystemPage() {
     GenericValue portalPage = 
from('PortalPage').where(parameters).cache().queryOne()
             ?: from('PortalPage').where(portalPageId: 
parameters.parentPortalPageId).cache().queryOne()
-    Map serviceResult = [:]
     if (portalPage && portalPage.ownerUserLoginId == '_NA_' && 
from('PortalPage')
             .where(originalPortalPageId: portalPage.portalPageId,
                     ownerUserLoginId: userLogin.userLoginId)
-            .queryCount() == 0 ) {
+            .queryCount() == 0) {
         // copy the portal page
-        serviceResult = run service: 'createPortalPage', with: [*: 
portalPage.getAllFields(),
-                                                                portalPageId: 
null,
-                                                                
originalPortalPageId: portalPage.portalPageId,
-                                                                
ownerUserLoginId: userLogin.userLoginId]
+        Map serviceResult = run service: 'createPortalPage', with: [*: 
portalPage.getAllFields(),
+                                                                    
portalPageId: null,
+                                                                    
originalPortalPageId: portalPage.portalPageId,
+                                                                    
ownerUserLoginId: userLogin.userLoginId]
         run service: 'duplicatePortalPageDetails', with: [fromPortalPageId: 
portalPage.portalPageId,
                                                           toPortalPageId: 
serviceResult.portalPageId]
+        parameters.portalPageId = serviceResult.portalPageId
+    } else if (portalPage) {
+        parameters.portalPageId = portalPage.portalPageId
     }
-    return serviceResult ? serviceResult.portalPageId : 
portalPage?.portalPageId
+    if (binding.hasVariable('request') && request) {
+        request.setAttribute('portalPageId', parameters.portalPageId)
+    }
+    return success()
 }
diff --git 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
index 68a17114db..3383498514 100644
--- 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
+++ 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
@@ -357,5 +357,6 @@ private Map checkOwnerShip() {
 private String copyIfRequiredSystemPage() {
     Script script = InvokerHelper.createScript(
             
GroovyUtil.getScriptClassFromLocation('component://common/src/main/groovy/org/apache/ofbiz/common/PortalPageMethods.groovy'),
 binding)
-    return script.invokeMethod('copyIfRequiredSystemPage', null) as String
+    script.invokeMethod('copyIfRequiredSystemPage', null)
+    return parameters.portalPageId
 }

Reply via email to