You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2023/01/12 12:07:38 UTC
[ofbiz-framework] branch release22.01 updated: Fixed: Accounting Invoice Overview - PDF failed (OFBIZ-12735)
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release22.01 by this push:
new 1765c311f6 Fixed: Accounting Invoice Overview - PDF failed (OFBIZ-12735)
1765c311f6 is described below
commit 1765c311f60ee40190b1d4ae82b37252dde2f106
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Thu Jan 12 11:52:52 2023 +0100
Fixed: Accounting Invoice Overview - PDF failed (OFBIZ-12735)
>hen clicking “PDF” button in the invoice view, it failed with a StackOverflow
A quick fix in DocTypeTemplate.groovy:
in def getCustomScreenTemplate()
Change:
parentTypeValue = from(entityTypeName).where().cache().queryFirst().parentTypeId
To:
String parentTypeValue =
from(entityTypeName)
.where("invoiceTypeId", fieldTypeValue)
.cache()
.queryFirst()
.parentTypeId
jleroux: I noticed this Ingo's not applied patch at OFBIZ-10215:
https://issues.apache.org/jira/secure/attachment/13045313/DocTypeTemplate-1.patch
It's very similar to Yannong's but a bit more general. We don't need to worry
about the 3 types (invoice, order, quote). It's already handled.
I also formatted getCustomScreenTemplate()
Thanks: Yannong Huang for report a proposition fic
---
.../groovyScripts/template/DocTypeTemplate.groovy | 33 +++++++++++++---------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/applications/commonext/groovyScripts/template/DocTypeTemplate.groovy b/applications/commonext/groovyScripts/template/DocTypeTemplate.groovy
index 1c5986392d..a2234dfc56 100644
--- a/applications/commonext/groovyScripts/template/DocTypeTemplate.groovy
+++ b/applications/commonext/groovyScripts/template/DocTypeTemplate.groovy
@@ -30,19 +30,26 @@ def getFieldTypeName(String entityName) {
* If no value found, do a recursive search on parentType
*/
def getCustomScreenTemplate(String entityTypeName, String fieldTypeValue) {
- if (! fieldTypeValue) {
- return null
- }
- GenericValue tplCustScreen = from("PartyPrefDocTypeTplAndCustomScreen")
- .where(getFieldTypeName(entityTypeName), fieldTypeValue)
- .cache()
- .queryFirst()
- if (tplCustScreen) {
- return tplCustScreen
- }
- // No template found for this type, try if the parent had
- String parentTypeValue = from(entityTypeName).where().cache().queryFirst().parentTypeId
- return getCustomScreenTemplate(entityTypeName, parentTypeValue)
+ if (!fieldTypeValue) {
+ return null
+ }
+
+ GenericValue tplCustScreen = from("PartyPrefDocTypeTplAndCustomScreen")
+ .where(getFieldTypeName(entityTypeName), fieldTypeValue)
+ .cache()
+ .queryFirst()
+
+ if (tplCustScreen) {
+ return tplCustScreen
+ }
+
+ // No template found for this type, try if the parent had
+ String parentTypeValue = from(entityTypeName)
+ .where(getFieldTypeName(entityTypeName), fieldTypeValue)
+ .cache()
+ .queryFirst()
+ .parentTypeId
+ return getCustomScreenTemplate(entityTypeName, parentTypeValue)
}
// first resolve the document reference passed on the context