Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027253Openbravo ERPA. Platformpublic2014-07-31 19:372014-08-04 08:58
caristu 
shankarb 
highmajoralways
closedunable to reproduce 
5
 
3.0PR14Q4 
shankarb
Core
No
0027253: @additional_filters@ is not working as expected in HQL query selectors
The @additional_filters@ appends automatically the implicit filter by Client and accessible Organizations[1]. This is not applied properly under some circumstances.


[1] http://wiki.openbravo.com/wiki/Selector_Example [^]
1) Log-in as F&B International Group Admin, create a new sales price list for F&B International Group. Set it as default.
2) Add one product from F&B España and another one from F&B US to the price list
3) Log-in as F&B España Admin, Go to the [Sales Invoice] window and create a new record for F&B España
4) Go to the [Lines] tab and click on the product selector. Notice that it is possible to select the product from F&B US.
No tags attached.
related to defect 00272523.0PR14Q4 closed vmromanos Invoice lines with products that doesn't belong to the natural tree of the organization in the header 
Issue History
2014-07-31 19:37caristuNew Issue
2014-07-31 19:37caristuAssigned To => AugustoMauch
2014-07-31 19:37caristuModules => Core
2014-07-31 19:37caristuResolution time => 1407967200
2014-07-31 19:37caristuTriggers an Emergency Pack => No
2014-07-31 19:37caristuIssue Monitored: networkb
2014-07-31 19:37caristuRelationship addedrelated to 0027252
2014-07-31 19:39caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6222#r6222
2014-07-31 19:42caristuResolution time1407967200 => 1408658400
2014-07-31 19:43caristuTarget Version => 3.0PR14Q4
2014-08-04 06:16shankarbAssigned ToAugustoMauch => shankarb
2014-08-04 06:16shankarbStatusnew => scheduled
2014-08-04 06:16shankarbfix_in_branch => pi
2014-08-04 08:58shankarbReview Assigned To => shankarb
2014-08-04 08:58shankarbNote Added: 0069057
2014-08-04 08:58shankarbStatusscheduled => closed
2014-08-04 08:58shankarbResolutionopen => unable to reproduce

Notes
(0069057)
shankarb   
2014-08-04 08:58   
The @additional_filters@ are applied correctly. They are applied on the base table of the hql query.

Here is the selector query and the second one is the query at runtime. if you check, the additional org filters are applied properly, but it is being applied on the base table PricingProductPrice pp and not on product e.

Selector Query:
select e.searchKey as searchKey, e.id as id, plv as priceListVersion, plv.name as priceListVersionName, c.id as currency, pp.priceLimit as priceLimit, e.name as productName, e.uOM as uOM, pp.standardPrice as standardPrice, pp.listPrice as netListPrice, pl.salesPriceList as salesPriceList, e.characteristicDescription as chDescription, gp.name as genericProduct
from PricingProductPrice pp
join pp.product e
join pp.priceListVersion plv
join plv.priceList pl
left join pl.currency c
left join e.genericProduct gp
where e.isGeneric = 'N'
and plv.active = 'Y'
  and @additional_filters@

Runtime Query:
QueryImpl(select e.searchKey as searchKey, e.id as id, plv as priceListVersion, plv.name as priceListVersionName, c.id as currency, pp.priceLimit as priceLimit, e.name as productName, e.uOM as uOM, pp.standardPrice as standardPrice, pp.listPrice as netListPrice, pl.salesPriceList as salesPriceList, e.characteristicDescription as chDescription, gp.name as genericProduct
from PricingProductPrice pp
join pp.product e
join pp.priceListVersion plv
join plv.priceList pl
left join pl.currency c
left join e.genericProduct gp
where e.isGeneric = 'N'
and plv.active = 'Y'
  and pp.client.id in ('0', '23C59575B9CF467C9620760EB255B389')
 AND pp.organization in ('E443A31992CB4635AFCAEABE7183CE85','0','19404EAD144C49A0AF37D54377CF452D','B843C30461EA4501935CB1D125C9C25A')
 AND ( pl.salesPriceList = true AND c.id = '102')
 AND lower(plv.name) LIKE '%04-08-2014%'
 ORDER BY 7)

Updated the wiki, http://wiki.openbravo.com/wiki/Selector_Example [^] to reflect where the additional filters will be applied.