Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045425Openbravo ERPA. Platformpublic2020-11-11 14:192020-11-12 10:11
cberner 
cberner 
normalminorhave not tried
closedfixed 
5
 
PR21Q1 
Core
No
0045425: ParametersActionHandler.onSave is not embedding parameters using OBCriteria
ParametersActionHandler.onSave method is embedding parameters directly in the OBQuery HQL where clause, it should instead use OBCriteria.

Relevant code:
OBQuery<ParameterValue> obq = OBDal.getInstance()
      .createQuery(ParameterValue.class,
         dbFilterProperty + " = :filter and parameter = :param")
In description.
Use OBCriteria instead.
No tags attached.
related to design defect 0038136 acknowledged Triage Platform Base Tracking issue: Find & Fix queries not using bind-params but embedding values into query string 
Issue History
2020-11-11 14:19cbernerNew Issue
2020-11-11 14:19cbernerAssigned To => cberner
2020-11-11 14:19cbernerModules => Core
2020-11-11 14:19cbernerTriggers an Emergency Pack => No
2020-11-11 14:22cbernerRelationship addedrelated to 0038136
2020-11-11 14:23hgbotNote Added: 0124281
2020-11-11 14:25cbernerNote Added: 0124282
2020-11-12 10:11hgbotResolutionopen => fixed
2020-11-12 10:11hgbotStatusnew => closed
2020-11-12 10:11hgbotNote Added: 0124302
2020-11-12 10:11hgbotFixed in Version => PR21Q1
2020-11-12 10:11hgbotNote Added: 0124303

Notes
(0124281)
hgbot   
2020-11-11 14:23   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/224 [^]
(0124282)
cberner   
2020-11-11 14:25   
Test Plan:
1. Login
2. Add a new widget(User Defined HTML Widget) from left panel.
3. Complete fields and save, this will trigger the modified query.
(0124302)
hgbot   
2020-11-12 10:11   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/224 [^]
(0124303)
hgbot   
2020-11-12 10:11   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: a422ed1ff10a79c4089ef78913da2ad5643cef77
Author: Cristian Berner <cristian.berner@openbravo.com>
Date: 2020-11-12T09:10:53+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/a422ed1ff10a79c4089ef78913da2ad5643cef77 [^]

Fixes ISSUE-45425: ParametersActionHandler.onSave is embedding parameters wrongly

ParametersActionHandler.onSave method is embedding parameters directly
in the OBQuery HQL where clause. This fixes it by using OBCriteria
instead, which is also safer.

Also a minor refactor has been done:
* f assignment was unneded, we only care about the exception
* use proxies instead of retrieving the object from db. They are used
  only to check id, there is no need to retrieve it from db, we don't
  care at this stage if the row is even present in db, filter will
  return empty if so.
* parameterize log

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/ParametersActionHandler.java
---