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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0031268
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajorhave not tried2015-10-27 13:272015-10-28 16:06
ReporteradrianromeroView Statuspublic 
Assigned Toadrianromero 
PriorityurgentResolutionfixedFixed in VersionRR16Q1
StatusclosedFix in branchFixed in SCM revision5f300c6e1659
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomarvintm
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0031268: SimpleQueryBuilder replacement order of criterias is incorrect.

DescriptionThe order of replacement tags provided by SimpleQueryBuilder is not correct.

The problem is that $filtersCriteria and $hqlCriteria are the last tags to be replaced but the filters defined in $filtersCriteria and $hqlCriteria may contain tags that has been replaced previously so will not be replaced
Steps To ReproduceThis is the current order of replacement in getHQLQuery()
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/file/8e517c8e2c1c/src/org/openbravo/mobile/core/process/SimpleQueryBuilder.java#l429 [^]

For example filtering Business Partners in the Business Partners list in POS, the LocName (Localization Name) property includes the tags $naturalOrgCriteria and $readableSimpleClientCriteria that are not processed because the $filtersCriteria is replaced at the end ant the following error is raised:


serviceSuccess error: status: -1, error.message: unexpected AST node: . near line 34, column 725 [SELECT bpl.businessPartner.id as id,
bpl.businessPartner.organization.id as organization,
bpl.businessPartner.name as name,
bpl.businessPartner.name as _identifier,
bpl.businessPartner.searchKey as searchKey,
bpl.businessPartner.description as description,
bpl.businessPartner.taxID as taxID,
bpl.businessPartner.sOBPTaxCategory.id as taxCategory,
bpl.businessPartner.priceList.id as priceList,
bpl.businessPartner.paymentMethod.id as paymentMethod,
bpl.businessPartner.paymentTerms.id as paymentTerms,
bpl.businessPartner.invoiceTerms as invoiceTerms,
(select max(bpls.id) as bpLocId from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.invoiceToAddress = true and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) as locId,
(select max(bpls.id) as bpLocId from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.shipToAddress = true and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) as locShipId,
(select max(COALESCE(bpls.locationAddress.addressLine1, bpls.locationAddress.addressLine2, bpls.locationAddress.postalCode, bpls.locationAddress.cityName)) from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.invoiceToAddress = true and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) as locName,
(select max(COALESCE(bpls.locationAddress.addressLine1, bpls.locationAddress.addressLine2, bpls.locationAddress.postalCode, bpls.locationAddress.cityName)) as nameShipTo from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.shipToAddress = true and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) as locShipName,
ulist.email as email,
ulist.id as contactId,
ulist.phone as phone,
ulist.firstName as firstName,
ulist.lastName as lastName,
plist.priceIncludesTax as priceIncludesTax,
plist.name as priceListName,
(select max(bpls.locationAddress.cityName) from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.shipToAddress = true and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) as cityName,
(select max(bpls.locationAddress.postalCode) from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.shipToAddress = true and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) as postalCode,
bpl.locationAddress.country.name as countryName,
bpl.businessPartner.businessPartnerCategory.id as businessPartnerCategory,
bpl.businessPartner.businessPartnerCategory.name as businessPartnerCategory_name,
bpl.businessPartner.creditLimit as creditLimit,
bpl.businessPartner.creditUsed as creditUsed,
bpl.businessPartner.taxExempt as taxExempt,
bpl.businessPartner.customerBlocking as customerBlocking,
bpl.businessPartner.salesOrder as salesOrderBlocking,
(case when bpl.active = 'Y' and bpl.businessPartner.active = 'Y' then true else false end) as active FROM BusinessPartnerLocation AS bpl left outer join bpl.businessPartner.aDUserList AS ulist left outer join bpl.businessPartner.priceList AS plist WHERE ( (upper(bpl.businessPartner.searchKey) like upper('b%') OR upper(bpl.businessPartner.name) like upper('b%') OR upper(bpl.businessPartner.taxID) like upper('b%') OR upper((select max(COALESCE(bpls.locationAddress.addressLine1, bpls.locationAddress.addressLine2, bpls.locationAddress.postalCode, bpls.locationAddress.cityName)) as nameShipTo from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.shipToAddress = true and bpls.$readableSimpleClientCriteria AND bpls.$naturalOrgCriteria group by bpls.businessPartner.id)) like upper('b%') OR upper((select max(COALESCE(bpls.locationAddress.addressLine1, bpls.locationAddress.addressLine2, bpls.locationAddress.postalCode, bpls.locationAddress.cityName)) from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and bpls.invoiceToAddress = true and bpls.$readableSimpleClientCriteria AND bpls.$naturalOrgCriteria group by bpls.businessPartner.id)) like upper('b%') OR upper(ulist.phone) like upper('b%') OR upper(ulist.email) like upper('b%')) ) AND bpl.businessPartner.customer = true AND bpl.businessPartner.priceList IS NOT NULL AND ( (bpl.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpl.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) AND (( (bpl.active = 'Y') ) AND ( (bpl.businessPartner.active = 'Y') )) and bpl.id in (select max(bpls.id) as bpLocId from BusinessPartnerLocation AS bpls where bpls.businessPartner.id=bpl.businessPartner.id and ( (bpls.client.id in ('39363B0921BB4293B48383844325E84C', '0')) ) AND (bpls.organization.id in ('D270A5AC50874F8BA67A88EE977F8E3B', '0', '14B1927026BE471E9B85FE699BCA61C2', '67839EEFA49E44AC969BD60093FCC899', 'BF129721D9FB4EB0819509934153E972')) group by bpls.businessPartner.id) and (not exists (select 1 from ADUser usr where usr.businessPartner = bpl.businessPartner)) ORDER BY bpl.businessPartner.name]; line: serviceSuccess (http://localhost:8080/openbravo/web/js/gen/5a4256db9f784eed43bd8859d6f8b899_WebPOS.js:1033:10 [^]) (*,+)
Proposed SolutionPut the lines that executes the replacement of $filtersCriteria and $hqlCriteria at the very beginning of the method getHQLQuery() in class SimpleQueryBuilder

See the attached diff.
TagsNo tags attached.
Attached Filesdiff file icon issue31268.diff [^] (1,608 bytes) 2015-10-27 13:38 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0081355)
hgbot (developer)
2015-10-27 16:03

Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 5f300c6e16595af756e66bc3eb88d89d737c2d08
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Tue Oct 27 13:34:35 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/5f300c6e16595af756e66bc3eb88d89d737c2d08 [^]

Fixes issue 0031268: SimpleQueryBuilder replacement order of criterias is incorrect.
* and are moved to the begining of the method getHQLQuery() to avoid dependency problems

---
M src/org/openbravo/mobile/core/process/SimpleQueryBuilder.java
---

- Issue History
Date Modified Username Field Change
2015-10-27 13:27 adrianromero New Issue
2015-10-27 13:27 adrianromero Assigned To => adrianromero
2015-10-27 13:27 adrianromero Triggers an Emergency Pack => No
2015-10-27 13:37 adrianromero Proposed Solution updated
2015-10-27 13:38 adrianromero File Added: issue31268.diff
2015-10-27 13:58 adrianromero Review Assigned To => marvintm
2015-10-27 16:03 hgbot Checkin
2015-10-27 16:03 hgbot Note Added: 0081355
2015-10-27 16:03 hgbot Status new => resolved
2015-10-27 16:03 hgbot Resolution open => fixed
2015-10-27 16:03 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/5f300c6e16595af756e66bc3eb88d89d737c2d08 [^]
2015-10-28 16:06 marvintm Status resolved => closed
2015-10-28 16:06 marvintm Fixed in Version => RR16Q1


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker