dixitdeepak commented on a change in pull request #252:
URL: https://github.com/apache/ofbiz-framework/pull/252#discussion_r562389488



##########
File path: applications/order/groovyScripts/order/CompanyHeader.groovy
##########
@@ -135,12 +136,22 @@ if (!partyId) {
 }
 
 // the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
+GenericValue partyGroup = from("PartyGroup").where("partyId", 
partyId).queryOne()
 if (partyGroup) {
-    partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, 
locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", 
"text/html; charset=utf-8", delegator))
-    partyContent = 
partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, 
"LGOIMGURL", delegator)
+    GenericValue partyContent = 
PartyContentWrapper.getFirstPartyContentByType(partyId, partyGroup, 
"LGOIMGURL", delegator)

Review comment:
       I don't think there is way to get base64 from content/dataresouce worker 
classes, 
   

##########
File path: applications/order/groovyScripts/order/CompanyHeader.groovy
##########
@@ -135,17 +136,25 @@ if (!partyId) {
 }
 
 // the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
+GenericValue partyGroup = from("PartyGroup").where("partyId", 
partyId).queryOne()
 if (partyGroup) {
-    partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, 
locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", 
"text/html; charset=utf-8", delegator))
-    partyContent = 
partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, 
"LGOIMGURL", delegator)
-    if (partyContent) {
-        logoImageUrl = "/content/control/stream?contentId=" + 
partyContent.contentId
-    } else {
-        if (partyGroup?.logoImageUrl) {
-            logoImageUrl = partyGroup.logoImageUrl
+    GenericValue dataResource =
+            PartyContentWrapper.getFirstPartyContentByType(partyId, 
partyGroup, "LGOIMGURL", delegator)
+                    ?.getRelatedOne("Content", true)
+                    ?.getRelatedOne("DataResource", true)
+
+    if (dataResource) {
+        File logoFile = 
DataResourceWorker.getContentFile(dataResource.getString("dataResourceTypeId"),

Review comment:
       I think here we should add following check to make sure we are getting 
base64 in case of file
   `if (dataResourceTypeId.indexOf("_FILE") >= 0) {`
   
   As content can be configured in different ways, and can have a complete url 
it self
   
   I'd recommand to  add /content/control/stream?contentId in else part. 

##########
File path: applications/order/groovyScripts/order/CompanyHeader.groovy
##########
@@ -135,12 +136,22 @@ if (!partyId) {
 }
 
 // the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
+GenericValue partyGroup = from("PartyGroup").where("partyId", 
partyId).queryOne()
 if (partyGroup) {
-    partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, 
locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", 
"text/html; charset=utf-8", delegator))
-    partyContent = 
partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, 
"LGOIMGURL", delegator)
+    GenericValue partyContent = 
PartyContentWrapper.getFirstPartyContentByType(partyId, partyGroup, 
"LGOIMGURL", delegator)

Review comment:
       I don't object :)
   added comments to add condition while getting the data it'd be good we think 
around it as well. 
   
   

##########
File path: applications/order/groovyScripts/order/CompanyHeader.groovy
##########
@@ -135,12 +136,22 @@ if (!partyId) {
 }
 
 // the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
+GenericValue partyGroup = from("PartyGroup").where("partyId", 
partyId).queryOne()
 if (partyGroup) {
-    partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, 
locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", 
"text/html; charset=utf-8", delegator))
-    partyContent = 
partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, 
"LGOIMGURL", delegator)
+    GenericValue partyContent = 
PartyContentWrapper.getFirstPartyContentByType(partyId, partyGroup, 
"LGOIMGURL", delegator)

Review comment:
       I won't object :)
   added comments to add condition while getting the data it'd be good we think 
around it as well. 
   
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to