[ofbiz-framework] branch trunk updated: Fixed: Convert ImageManagementServices.xml minilang to groovy (OFBIZ-11604)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: Convert ImageManagementServices.xml minilang to groovy (OFBIZ-11604)

jleroux@apache.org
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 7d9db5e  Fixed: Convert ImageManagementServices.xml minilang to groovy (OFBIZ-11604)
7d9db5e is described below

commit 7d9db5e3215282299b0daf21aac950490063ddc4
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Mon Mar 29 10:42:04 2021 +0200

    Fixed: Convert ImageManagementServices.xml minilang to groovy (OFBIZ-11604)
   
    For an unknown reason (I did not dig in), in uploadProductImages
    result.productId = parameters.productId must be set at start and not end
    because parameters.productId does not exist at end. I guess because of the call
    to addMultipleuploadForProduct, but as I said I did not dig in.
   
    Also updateStatusImageManagement did not return productId
   
    Unrelated removes an useless new line in ImageManagementServices.java
---
 .../product/imagemanagement/ImageManagementServices.groovy         | 7 +++++--
 .../ofbiz/product/imagemanagement/ImageManagementServices.java     | 1 -
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/applications/product/groovyScripts/product/imagemanagement/ImageManagementServices.groovy b/applications/product/groovyScripts/product/imagemanagement/ImageManagementServices.groovy
index 9837e33..a5c195a 100644
--- a/applications/product/groovyScripts/product/imagemanagement/ImageManagementServices.groovy
+++ b/applications/product/groovyScripts/product/imagemanagement/ImageManagementServices.groovy
@@ -20,6 +20,7 @@
 import java.sql.Timestamp
 
 import org.apache.ofbiz.base.util.ScriptUtil
+import org.apache.ofbiz.base.util.StringUtil
 import org.apache.ofbiz.base.util.UtilDateTime
 import org.apache.ofbiz.base.util.UtilProperties
 import org.apache.ofbiz.entity.GenericValue
@@ -32,6 +33,7 @@ import org.apache.ofbiz.service.ServiceUtil
 def uploadProductImages() {
     Map result = success()
     Map serviceResult = [:]
+    result.productId = parameters.productId
     Map addAdditionalViewForProductMap = parameters
     if (parameters._additionalImageOne_fileName) {
         addAdditionalViewForProductMap.productId = parameters.productId
@@ -163,7 +165,6 @@ def uploadProductImages() {
         }
         addAdditionalViewForProductMap.clear()
     }
-    result.productId = parameters.productId
     return result
 }
 
@@ -280,6 +281,7 @@ def setImageDetail() {
  * @return
  */
 def updateStatusImageManagement() {
+    Map result = success()
     Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
     String checkStatusVal = parameters.checkStatusId
     List statusId = StringUtil.split(checkStatusVal, "/")
@@ -361,7 +363,8 @@ def updateStatusImageManagement() {
             }
         }
     }
-    return success()
+    result.put("productId", parameters.productId);
+    return result
 }
 
 /**
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java
index 8bcf6f7..793853a 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java
@@ -561,7 +561,6 @@ public class ImageManagementServices {
 
         GenericValue extensionThumb = EntityUtil.getFirst(fileExtensionThumb);
         if (extensionThumb != null) {
-
             filenameToUseThumb += "." + extensionThumb.getString("fileExtensionId");
         }
         result.put("filenameToUseThumb", filenameToUseThumb);