Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] A. Platformmajoralways2017-01-27 15:252017-05-09 11:07
ReporterpsanjuanView Statuspublic 
Assigned Toinigosanchez 
PriorityurgentResolutionfixedFixed in Version3.0PR17Q2
StatusclosedFix in branchFixed in SCM revisione8c8153f375f
ProjectionnoneETAnoneTarget Version3.0PR17Q2
OSLinux 64 bitDatabasePostgreSQLJava version1.6.0_18
OS VersionProfessional ApplianceDatabase version8.3.9Ant version1.7.1
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
Regression levelProduction - Confirmed Stable
Regression date2016-05-24
Regression introduced in release3.0PR16Q3
Regression introduced by commit [^]
Triggers an Emergency PackNo

0035953: Fetching data when it is sorting by a null foreign key is not working as expected.

DescriptionFetching data when it is sorting by a null foreign key is not working as expected. The problem can be reproduced having a BP with additional identifier (Currency) that is a foreign key and not mandatory (nullable). If currency is null for a BP and data is sorted by BP column, fetching the data is not working as expected.
Steps To Reproduce- Login as "System Administrator - System" role.
- Go to [Module] window and put "Core" module in development mode.
- Go to [Tables and Columns] window and select "BusinessPartner" table.
- Go to [Column] subtab and open in form view "BP_Currency_ID" record.
- Check "Used as Record Identifiew" checkbox. Save it.
-Restart tomcat because model has changed.

- Login as "F&B International Group Admin" role.
- Go to [Business Partner] window and create a new one for testing purposes. [Currency field should be null]
- Go to [Location/Address] subtab and create a new test location for the new business partner.
- Go to [Sales Order] window and create a new sales order with the BP created in previously steps.
- Filter by "Document No." field using the document number generated for the new sales order. [Only the new sales order should be displayed in the grid]

- Sort by "Order Date" column and refresh the current data from the toolbar button. Check the record appears.
- Sort by "Business Partner" column and refresh the current data from the toolbar button. Check the record disappears.
Proposed SolutionIt seems that the reported case is not take into account properly and a inner join is used instead of left join > Review use of useInnerJoinMap map in AdvancedQueryBuilder class.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0035073 closedinigosanchez Fetching data when it is sorting by a null foreign key is not working as expected. 

-  Notes
hgbot (developer)
2017-05-09 10:12

Repository: erp/backports/3.0PR17Q2
Changeset: e8c8153f375f7804cd4dcb4e15fa11ce49fe18f0
Author: Inigo Sanchez <inigo.sanchez <at>>
Date: Tue May 09 10:11:24 2017 +0200
URL: [^]

Fixed issue 35953: Fetching data when it is sorting by a null FK is not working

Fetching data when it was sorting by a null foreign key was not retrieving any record when should
had been retrieved data.

When AdvancedQueryBuilder class is created order by clause and it is working in resolve joins a
canUseInnerJoin method is invoked. This method is used to check if the left join can be safely
replaced with inner join when it is building order by clause. This method is not take into account
all the posibilities.

The problem has been resolved by take into account when any property of the list is not mandatory
and is not primitive. In this case left join can not be replaced with inner join. The rest of the
cases can be safely replaced it.

M modules/org.openbravo.service.json/src/org/openbravo/service/json/
caristu (developer)
2017-05-09 11:07

Code reviewed + tested OK.

- Issue History
Date Modified Username Field Change
2017-05-09 10:04 inigosanchez Type defect => backport
2017-05-09 10:04 inigosanchez Target Version => 3.0PR17Q2
2017-05-09 10:10 inigosanchez Review Assigned To => caristu
2017-05-09 10:12 hgbot Checkin
2017-05-09 10:12 hgbot Note Added: 0096477
2017-05-09 10:12 hgbot Status scheduled => resolved
2017-05-09 10:12 hgbot Resolution open => fixed
2017-05-09 10:12 hgbot Fixed in SCM revision [^] => [^]
2017-05-09 11:07 caristu Note Added: 0096485
2017-05-09 11:07 caristu Status resolved => closed
2017-05-09 11:07 caristu Fixed in Version => 3.0PR17Q2

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker