Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0042916
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2020-01-16 17:032020-01-22 18:36
ReporterAugustoMauchView Statuspublic 
Assigned ToAugustoMauch 
PrioritynormalResolutionfixedFixed in Version3.0PR20Q2
StatusclosedFix in branchFixed in SCM revision0fc6a0afc591
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0042916: Selectors do not work properly in parameter windows if there are translations installed

DescriptionWhen a parameter window has a grid parameter, and that grid parameter has a selector that points to a translatable property, the filter will not work properly if there are translations installed.

The fix for https://issues.openbravo.com/view.php?id=42915 [^] is required to reproduce this issue.
Steps To ReproduceMake sure the fix of https://issues.openbravo.com/view.php?id=42915 [^] is applied
- Install the attached module.
- Install a translation pack (or edit OBContext.hasTranslationInstalled so that it always return true)
- Login, use any non-system role
- Open the Test Tree PW window.
- Click on the filter of the extraProductCategory column and select any value.
- The grid will be empty and the following error will be shown in the log:

2020-01-16 17:03:26,510 [http-nio-8080-exec-3] ERROR org.openbravo.service.datasource.DataSourceServlet - org.hibernate.QueryException: could not resolve property: extraProductCategory of: Product [select get_uuid() as id, p.name as name, p.productCategory as extraProductCategory from Product p WHERE p.client.id in ('0', :clientId) AND p.organization.id in ( :organizations ) AND (( upper((COALESCE(to_char((select p.name from ProductCategoryTrl as t where t.productCategory = p.extraProductCategory and t.language.language='en_US')), to_char(p.productCategory.name), ''))) = upper(:alias_0) )) ]
java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: extraProductCategory of: Product [select get_uuid() as id, p.name as name, p.productCategory as extraProductCategory from Product p WHERE p.client.id in ('0', :clientId) AND p.organization.id in ( :organizations ) AND (( upper((COALESCE(to_char((select p.name from ProductCategoryTrl as t where t.productCategory = p.extraProductCategory and t.language.language='en_US')), to_char(p.productCategory.name), ''))) = upper(:alias_0) )) ]
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:729) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:745) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:104) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.openbravo.service.datasource.HQLDataSourceService.getQuery(HQLDataSourceService.java:368) ~[classes/:?]
    at org.openbravo.service.datasource.HQLDataSourceService.getData(HQLDataSourceService.java:190) ~[classes/:?]
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.getSelectedData(ReadOnlyDataSourceService.java:168) ~[classes/:?]
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.fetchJSONObject(ReadOnlyDataSourceService.java:147) ~[classes/:?]
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.fetch(ReadOnlyDataSourceService.java:76) ~[classes/:?]
    at org.openbravo.service.datasource.DataSourceServlet.doFetch(DataSourceServlet.java:290) [classes/:?]
    at org.openbravo.service.datasource.DataSourceServlet.doPost(DataSourceServlet.java:837) [classes/:?]
TagsNo tags attached.
Attached Fileszip file icon org.openbravo.testtreeinpw.zip [^] (14,651 bytes) 2020-01-16 17:04

- Relationships Relation Graph ] Dependency Graph ]
depends on defect 0042915 closedAugustoMauch Tree selector cannot be used in a parameter window that is opened from the menu 

-  Notes
(0117054)
hgbot (developer)
2020-01-20 10:36

Repository: erp/devel/pi
Changeset: 0fc6a0afc5916b86a15c55fcb311b0ec2d300b51
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Jan 20 10:22:29 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/0fc6a0afc5916b86a15c55fcb311b0ec2d300b51 [^]

Fixes BUG-42916: Builds proper query for translated selector in param window

The query done when a selector done in a parameter window for a
translatable property did not work if there were transltations installed.

The query was being built like this:

SELECT get_uuid() as id, p.name as name, p.productCategory as extraProductCategory
FROM Product p
WHERE p.client.id in ('0', :clientId)
AND p.organization.id in ( :organizations )
AND (( upper((COALESCE(to_char((SELECT p.name
                                FROM ProductCategoryTrl as t
                                WHERE t.productCategory = p.extraProductCategory AND t.language.language='en_US')),
              to_char(p.productCategory.name), ''))) = upper(:alias_0) ))

The problem is here "t.productCategory = p.extraProductCategory". Product does not have an extraProductCategory property,
that's the alias of a column that should have been replaced here [1]. There were replacements in place for other similar cases
(i.e. p.alias.id -> placeholder.id, p.alias.name -> placeholder.name) but there is replacement missing when p.alias is found.

[1] https://gitlab.com/openbravo/product/openbravo/blob/52847f60/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java#L547 [^]

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java
---
(0117180)
caristu (developer)
2020-01-22 18:36

Reviewed + tested OK: https://gitlab.com/openbravo/product/openbravo/merge_requests/35/ [^]

- Issue History
Date Modified Username Field Change
2020-01-16 17:03 AugustoMauch New Issue
2020-01-16 17:03 AugustoMauch Assigned To => AugustoMauch
2020-01-16 17:03 AugustoMauch Modules => Core
2020-01-16 17:03 AugustoMauch Triggers an Emergency Pack => No
2020-01-16 17:04 AugustoMauch File Added: org.openbravo.testtreeinpw.zip
2020-01-16 17:04 AugustoMauch Relationship added depends on 0042915
2020-01-16 17:59 AugustoMauch Steps to Reproduce Updated View Revisions
2020-01-20 10:36 hgbot Checkin
2020-01-20 10:36 hgbot Note Added: 0117054
2020-01-20 10:36 hgbot Status new => resolved
2020-01-20 10:36 hgbot Resolution open => fixed
2020-01-20 10:36 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/0fc6a0afc5916b86a15c55fcb311b0ec2d300b51 [^]
2020-01-22 18:36 caristu Review Assigned To => caristu
2020-01-22 18:36 caristu Note Added: 0117180
2020-01-22 18:36 caristu Status resolved => closed
2020-01-22 18:36 caristu Fixed in Version => 3.0PR20Q2


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker