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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0023011
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 00. Application dictionarymajoralways2013-02-07 16:192013-04-16 19:18
Reportereduardo_ArgalView Statuspublic 
Assigned ToAugustoMauch 
PriorityhighResolutionfixedFixed in Version3.0MP23
StatusclosedFix in branchFixed in SCM revisionc0e933f438dc
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toshankarb
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0023011: Wrong hql query due to hql order by clause of a tab

DescriptionDepending on the hql order by clause set in a tab, system builds wrong hql query. This is related to the use of common hql functions when defining the order by clause.
Steps To ReproduceGo to:
Sales invoice window Accounting tab.
set the following order by clause:
accountingSchema.name, accountingDate, abs(debit) desc, debit desc, abd(credit) desc, value
Mind that the build hql is wrong. Order by clause in that query is completely different from the one set in the tab.
TagsNo tags attached.
Attached Files? file icon issue23011.export [^] (2,762 bytes) 2013-04-08 14:02

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0023012 closededuardo_Argal Accounting tab for transactions does not order properly when negative values exist 

-  Notes
(0057742)
AugustoMauch (manager)
2013-04-05 13:03

HQL order by clase entered by the user:
accountingSchema.name, accountingDate, abs(debit) desc, debit desc, abs(credit) desc, value

Generated HQL order by clase:
order by join_0.name,e.accountingDate,e desc ,e.debit desc ,e desc ,e.value,e.id

'e desc' is added to the HQL query when the abs function is used
(0057804)
hgbot (developer)
2013-04-09 15:31

Repository: erp/devel/pi
Changeset: c0e933f438dc75587bb1588e7697a547496db0ae
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Apr 08 14:01:36 2013 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c0e933f438dc75587bb1588e7697a547496db0ae [^]

Fixes issue 23011: Enables using simple functions in HQL order by clause

Now it is possible to use one argument functions (i.e. abs(), max(), min(), etc) as part of the HQL order by clauses. A regular expression is used to check if the orderByParam matches the pattern functionName + '(' + property + ')' + 'desc' (optional). If so, it retrieves the function name and the property name, and resolves the property name. After doing it, it wrappes the resolved property name in its function and adds ' desc' if the function was meant to be sorted in descending order.

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0057805)
AugustoMauch (manager)
2013-04-09 15:38

Test plan:
- Change the HQL clause of the Accounting tab as described in the steps to reproduce
- Open the Sales Invoice window, clear the filter and select a record
- Place a breakpoint at the end of the getOrderByClause method of the AdvancedQueryBuilder class.
- Select the Accounting tab. Eclipse will stop in the breakpoint.
- Check that the value of orderByClause attribute is order by join_0.name,e.accountingDate,abs(e.debit) desc,e.debit desc ,abs(e.credit) desc,e.value,e.id.
(0057806)
AugustoMauch (manager)
2013-04-09 15:41

Mind that there is a type in the steps to reproduce: the HQL logic should be accountingSchema.name, accountingDate, abs(debit) desc, debit desc, abs(credit) desc, value, not accountingSchema.name, accountingDate, abs(debit) desc, debit desc, abd(credit) desc, value.
(0057906)
shankarb (reporter)
2013-04-15 14:14

Code reviewed and tested in pi changeset b96b3181a12a
(0057941)
hudsonbot (developer)
2013-04-16 19:18

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/8df08bea850d [^]

Maturity status: Test

- Issue History
Date Modified Username Field Change
2013-02-07 16:19 eduardo_Argal New Issue
2013-02-07 16:19 eduardo_Argal Assigned To => alostale
2013-02-07 16:19 eduardo_Argal Modules => Core
2013-02-07 16:19 eduardo_Argal Triggers an Emergency Pack => No
2013-02-07 16:27 eduardo_Argal Relationship added blocks 0023012
2013-04-05 13:03 AugustoMauch Note Added: 0057742
2013-04-08 11:28 AugustoMauch Assigned To alostale => AugustoMauch
2013-04-08 14:02 AugustoMauch File Added: issue23011.export
2013-04-08 14:02 AugustoMauch Status new => scheduled
2013-04-08 14:02 AugustoMauch fix_in_branch => pi
2013-04-09 13:58 AugustoMauch Issue Monitored: shankarb
2013-04-09 13:58 AugustoMauch Review Assigned To => shankarb
2013-04-09 13:58 AugustoMauch fix_in_branch pi =>
2013-04-09 15:31 hgbot Checkin
2013-04-09 15:31 hgbot Note Added: 0057804
2013-04-09 15:31 hgbot Status scheduled => resolved
2013-04-09 15:31 hgbot Resolution open => fixed
2013-04-09 15:31 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/c0e933f438dc75587bb1588e7697a547496db0ae [^]
2013-04-09 15:38 AugustoMauch Note Added: 0057805
2013-04-09 15:41 AugustoMauch Note Added: 0057806
2013-04-15 14:14 shankarb Note Added: 0057906
2013-04-15 14:14 shankarb Status resolved => closed
2013-04-15 14:15 shankarb Fixed in Version => 3.0MP23
2013-04-16 19:18 hudsonbot Checkin
2013-04-16 19:18 hudsonbot Note Added: 0057941


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker