Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0035073Openbravo ERPA. Platformpublic2017-01-27 15:252017-05-29 17:43
psanjuan 
inigosanchez 
urgentmajoralways
closedfixed 
30Professional Appliance
 
3.0PR17Q3 
caristu
Core
Production - Confirmed Stable
2016-05-24
3.0PR16Q3
https://code.openbravo.com/erp/devel/pi/rev/9105dfe33d79e5b7ba39a2680064f7c48c402701 [^]
No
0035073: Fetching data when it is sorting by a null foreign key is not working as expected.
Fetching 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.
- 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.
It 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.
No tags attached.
depends on backport 00359533.0PR17Q2 closed inigosanchez Fetching data when it is sorting by a null foreign key is not working as expected. 
depends on backport 00359543.0PR17Q1.1 closed inigosanchez Fetching data when it is sorting by a null foreign key is not working as expected. 
caused by feature request 0033015 closed caristu Performance Improvements in Product Selector 
Issue History
2017-01-27 15:25psanjuanNew Issue
2017-01-27 15:25psanjuanAssigned To => platform
2017-01-27 15:25psanjuanModules => Core
2017-01-27 15:25psanjuanTriggers an Emergency Pack => No
2017-01-27 15:27psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14384#r14384
2017-01-27 15:43psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14387#r14387
2017-02-02 14:47NaroaIriarteAssigned Toplatform => NaroaIriarte
2017-02-03 10:13NaroaIriarteAssigned ToNaroaIriarte => psanjuan
2017-02-03 10:13NaroaIriarteStatusnew => feedback
2017-04-07 10:34ngarciaResolution time => 1493330400
2017-04-07 10:34ngarciaReproducibilitysometimes => always
2017-04-07 10:34ngarciaStatusfeedback => new
2017-04-07 10:34ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=14978#r14978
2017-04-07 10:35ngarciaAssigned Topsanjuan => platform
2017-04-07 10:35ngarciaIssue Monitored: networkb
2017-04-07 10:53ngarciaIssue Monitored: ngarcia
2017-05-04 11:29inigosanchezAssigned Toplatform => inigosanchez
2017-05-04 11:29inigosanchezStatusnew => scheduled
2017-05-04 13:41inigosanchezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15108#r15108
2017-05-04 13:42inigosanchezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15109#r15109
2017-05-04 13:49inigosanchezDescription Updatedbug_revision_view_page.php?rev_id=15111#r15111
2017-05-04 17:46inigosanchezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15114#r15114
2017-05-05 11:13inigosanchezSummaryTax Parameter tab does not show records while it should => Fetching data when it is sorting by a null foreign key is not working as expected.
2017-05-05 11:13inigosanchezDescription Updatedbug_revision_view_page.php?rev_id=15115#r15115
2017-05-05 11:13inigosanchezProposed Solution updated
2017-05-05 11:14inigosanchezRelationship addedcaused by 0033015
2017-05-05 11:16inigosanchezRegression level => Production - Confirmed Stable
2017-05-05 11:16inigosanchezRegression date => 2016-05-24
2017-05-05 11:16inigosanchezRegression introduced in release => 3.0PR16Q3
2017-05-05 11:16inigosanchezRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/9105dfe33d79e5b7ba39a2680064f7c48c402701 [^]
2017-05-08 16:52inigosanchezNote Added: 0096460
2017-05-09 10:01hgbotCheckin
2017-05-09 10:01hgbotNote Added: 0096472
2017-05-09 10:01hgbotStatusscheduled => resolved
2017-05-09 10:01hgbotResolutionopen => fixed
2017-05-09 10:01hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/33afd778e515a8e5df2eff4286683edbb7656fec [^]
2017-05-09 10:03inigosanchezStatusresolved => new
2017-05-09 10:03inigosanchezResolutionfixed => open
2017-05-09 10:04inigosanchezStatusnew => scheduled
2017-05-09 10:09inigosanchezReview Assigned To => caristu
2017-05-09 10:09inigosanchezStatusscheduled => resolved
2017-05-09 11:05caristuNote Added: 0096483
2017-05-09 11:05caristuStatusresolved => closed
2017-05-09 11:05caristuFixed in Version => 3.0PR17Q3
2017-05-17 09:09caristuResolutionopen => fixed
2017-05-29 17:43hudsonbotCheckin
2017-05-29 17:43hudsonbotNote Added: 0096951

Notes
(0096460)
inigosanchez   
2017-05-08 16:52   
Added a test case in TestLink 3.0 Test Suite > Regression test cases > Test cases for 3.0PR16Q3 > 35073:Fetching data when it is sorting by a null FK should be work as expect.

Pending: Try to automate a JUnit test case > fetch data with not mandatory & not primitive case
(0096472)
hgbot   
2017-05-09 10:01   
Repository: erp/devel/pi
Changeset: 33afd778e515a8e5df2eff4286683edbb7656fec
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue May 09 09:59:56 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/33afd778e515a8e5df2eff4286683edbb7656fec [^]

Fixed issue 35073: 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/AdvancedQueryBuilder.java
---
(0096483)
caristu   
2017-05-09 11:05   
Code reviewed + tested OK.
(0096951)
hudsonbot   
2017-05-29 17:43   
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/1ee70113bdc4 [^]
Maturity status: Test