Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045989Openbravo ERP00. Application dictionarypublic2021-03-03 13:462021-03-24 15:56
lbressan 
platform 
highmajoralways
closedfixed 
5
pi 
piPR21Q2 
Core
No
0045989: Error in the references of type OBUISEL_Selector Reference
If the @additional_filters@ constant is missing in custom queries of references of type OBUISEL_Selector Reference, it does not fail to compile but fails to select the selector.
The error was detected when migrating from a 19Q version to 20Q4.
Issue preparation: Follow steps 1-4 or install attached module on a Web POS environment

1. In the "Sales Order" window
    a. create a field in the database and in the application dictionary of type button.
2. Create a "Process Definition" with Standard interface pattern and "Client/Organization" data access. Set any handler.
       a.Create a "Business Partner" parameter with reference type "OBUISEL_Selector Reference".
       b.Create a reference of type "OBUISEL_Selector Reference", in the defined selector tab set:
               1. Table: Business Partner
               2. Template: Selector Template
               3. Custom query: yes
               4. HQL: select bp.name as name, bp.id as bpid
                    from BusinessPartner bp
                    where bp.employee=true
            5.Entity Alias= bp
            6.Display Field= name
            7.Value Field= id
        c. assign this reference to the reference of the created parameter
3.assign the process created before to the button created in the "Sales Order" window.
4. Compile: check that no error or warning is displayed about the missing mandatory constant "@additional_filters@".

Reproducing the issue:

5. Open the "Sales Order" window, click on the new orange button.
6. open the file openbravo.log
7. click on the created selector
8. view errors in the log:

2021-03-03 09:17:43,168 [http-nio-8080-exec-7] ERROR org.openbravo.service.datasource.DataSourceServlet - Could not locate named parameter [clients], expecting one of []
java.lang.IllegalArgumentException: Could not locate named parameter [clients], expecting one of []
    at org.hibernate.query.internal.ParameterMetadataImpl.getNamedParameterDescriptor(ParameterMetadataImpl.java:229) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.query.internal.ParameterMetadataImpl.getQueryParameter(ParameterMetadataImpl.java:198) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.query.internal.QueryParameterBindingsImpl.resolveQueryParameter(QueryParameterBindingsImpl.java:460) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.query.internal.QueryParameterBindingsImpl.getQueryParameterListBinding(QueryParameterBindingsImpl.java:450) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
    at org.hibernate.query.internal.AbstractProducedQuery.setParameterList(AbstractProducedQuery.java:614) ~[hibernate-core-5.4.2.Final.jar:5.4.2.Final]
No tags attached.
zip example images.zip (352,103) 2021-03-03 13:46
https://issues.openbravo.com/file_download.php?file_id=15360&type=bug
zip com.nna.openbravo.retail.testing.zip (14,221) 2021-03-04 14:15
https://issues.openbravo.com/file_download.php?file_id=15367&type=bug
Issue History
2021-03-03 13:46lbressanNew Issue
2021-03-03 13:46lbressanAssigned To => platform
2021-03-03 13:46lbressanFile Added: example images.zip
2021-03-03 13:46lbressanModules => Core
2021-03-03 13:46lbressanTriggers an Emergency Pack => No
2021-03-03 13:59lbressanTypedefect => feature request
2021-03-03 14:27lbressanTypefeature request => defect
2021-03-03 14:32lbressanResolution time => 1616540400
2021-03-04 14:15AugustoMauchFile Added: com.nna.openbravo.retail.testing.zip
2021-03-04 14:16AugustoMauchSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22175#r22175
2021-03-04 14:18AugustoMauchSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22176#r22176
2021-03-17 15:59hgbotNote Added: 0126761
2021-03-24 15:56hgbotResolutionopen => fixed
2021-03-24 15:56hgbotStatusnew => closed
2021-03-24 15:56hgbotFixed in Version => PR21Q2
2021-03-24 15:56hgbotNote Added: 0126892
2021-03-24 15:56hgbotNote Added: 0126891

Notes
(0126761)
hgbot   
2021-03-17 15:59   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/331 [^]
(0126891)
hgbot   
2021-03-24 15:56   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 9383e78b5d017f567a1baeaf45f989d4abdbba43
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 2021-03-24T15:52:22+01:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/9383e78b5d017f567a1baeaf45f989d4abdbba43 [^]

Fixes BUG-45989: hql of selectors must include @additional_filters@ placeholder

This placeholder is needed because it is replaced in runtime with a client filter. An event handler has been
added to ensure new selecters are defined properly, and a check has been added on ViewManager that will throw
an error when loading a window that references a selector with an invalid HQL query

---
A modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorEventHandler.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/ViewComponent.java
M modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MESSAGE.xml
---
(0126892)
hgbot   
2021-03-24 15:56   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/331 [^]