Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0026085Openbravo ERPB. User interfacepublic2014-03-25 17:272014-05-12 09:18
jonalegriaesarte 
guillermogil 
urgentmajorhave not tried
closedfixed 
5
pi 
3.0PR14Q33.0PR14Q3 
alostale
Core
No
0026085: Location is not correctly filtered in grid view, if the country does not have region
Location is not correctly filtered in grid view, if the country does not have region
- Warehouse and bins
- Filter by location, it works fine
- Select one and change the country of the location, select one without region (Anguilla for example). Save it
- Try to filter, notice that the location does not appear as an option
No tags attached.
Issue History
2014-03-25 17:27jonalegriaesarteNew Issue
2014-03-25 17:27jonalegriaesarteAssigned To => AugustoMauch
2014-03-25 17:27jonalegriaesarteModules => Core
2014-03-25 17:27jonalegriaesarteResolution time => 1398808800
2014-03-25 17:27jonalegriaesarteTriggers an Emergency Pack => No
2014-03-25 17:52daniOpenbravoIssue Monitored: daniOpenbravo
2014-05-05 17:00alostaleNote Added: 0066820
2014-05-05 17:00alostaleAssigned ToAugustoMauch => guilleaer
2014-05-06 08:23guillermogilAssigned Toguilleaer => guillermogil
2014-05-08 11:04guillermogilIssue Monitored: alostale
2014-05-08 11:04guillermogilReview Assigned To => alostale
2014-05-08 11:41hgbotCheckin
2014-05-08 11:41hgbotNote Added: 0067020
2014-05-08 11:41hgbotStatusnew => resolved
2014-05-08 11:41hgbotResolutionopen => fixed
2014-05-08 11:41hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e16d7577a0754fa07c6d3883d77eaa5f2c0754c1 [^]
2014-05-09 16:21hudsonbotCheckin
2014-05-09 16:21hudsonbotNote Added: 0067072
2014-05-12 09:18alostaleNote Added: 0067083
2014-05-12 09:18alostaleStatusresolved => closed
2014-05-12 09:18alostaleFixed in Version => PR14Q3

Notes
(0066820)
alostale   
2014-05-05 17:00   
Problem is in nullable properties that are part of the identifier of a FK.

In this case the query is

from Warehouse as e left join e.locationAddress as join_0 where ( upper((COALESCE(to_char(join_0.addressLine1),'') || ' - ' || COALESCE(to_char(join_0.addressLine2),'') || ' - ' || COALESCE(to_char(join_0.postalCode),'') || ' - ' || COALESCE(to_char(join_0.cityName),'') || ' - ' || (COALESCE(to_char(join_0.region.name),'')) || ' - ' || (COALESCE(to_char((select name from CountryTrl as t where t.country = join_0.country and t.language.language='en_US')), to_char(join_0.country.name), '')))) like upper(:alias_0) escape '|' ) order by e.name,e.id


this part: join_0.region.name creates an inner join with region table which results in no row in case of empty region

Left join should be used instead:

from Warehouse as e
 left join e.locationAddress as join_0 left join join_0.region r
 where ( upper((COALESCE(to_char(join_0.addressLine1),'') || ' - ' || COALESCE(to_char(join_0.addressLine2),'') || ' - ' || COALESCE(to_char(join_0.postalCode),'') || ' - ' || COALESCE(to_char(join_0.cityName),'') || ' - ' || (COALESCE(to_char(r.name),'')) || ' - ' || (COALESCE(to_char((select name from CountryTrl as t where t.country = join_0.country and t.language.language='en_US')), to_char(join_0.country.name), '')))) like upper('%pam%') escape '|' ) order by e.name,e.id
(0067020)
hgbot   
2014-05-08 11:41   
Repository: erp/devel/pi
Changeset: e16d7577a0754fa07c6d3883d77eaa5f2c0754c1
Author: Guillermo Gil <guillermo.gil <at> openbravo.com>
Date: Thu May 08 11:09:49 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e16d7577a0754fa07c6d3883d77eaa5f2c0754c1 [^]

Fixed issue 26085:Location is not correctly filtered in grid view

If the country does not have a region it was not filtered.
Added new joins if the property is referenced and it can allow null values. Prefix modified to take into account the alias of the joins.

---
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0067072)
hudsonbot   
2014-05-09 16:21   
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/e8c0af2263a0 [^]
Maturity status: Test
(0067083)
alostale   
2014-05-12 09:18   
code reviewed
verified new left join is only added for nullable properties in identifier and in other cases same query as before is generated