Openbravo Issue Tracking System - Retail Modules
View Issue Details
0033786Retail ModulesWeb POSpublic2016-08-24 05:582016-09-20 13:02
sureshbabu 
marvintm 
immediatemajoralways
closedfixed 
5
 
RR16Q4 
guilleaer
OBPS
Pre packaging ( pi )
No
0033786: [STORE SERVER 1613] At POS Terminal type window,when the user clicks the Best seller tab, system throws java error message.
At POS Terminal type window, after selecting the Has Bestsellers checkbox when the user clicks the Best seller tab, system throws java error message.
 Log into ERP backend

2- Go to POS Terminal Type window and select CAEN Generic Cashier record
3- Click on Has Bestsellers checkbox
4- click Best Sellers tab,

Actual result : Following error appears and not able to add records to the tab

Error:
org.openbravo.base.exception.OBSecurityException: Entity BEST_PRODUCT_TTYPE_VIEW is not accessible by this role/user: BUT Admin/Openbravo
​SER QA
Issue History
2016-08-24 05:58sureshbabuNew Issue
2016-08-24 05:58sureshbabuAssigned To => mtaal
2016-08-24 05:58sureshbabuOBNetwork customer => No
2016-08-24 05:58sureshbabuTriggers an Emergency Pack => No
2016-08-24 05:58sureshbabuTag Attached: ​SER QA
2016-08-26 13:32mtaalAssigned Tomtaal => Retail
2016-08-26 13:32mtaalCategoryStoreServer => Web POS
2016-09-08 11:35VictorVillarOBNetwork customerNo => Yes
2016-09-08 11:35VictorVillarResolution time => 1473890400
2016-09-08 11:35VictorVillarRegression level => Pre packaging ( pi )
2016-09-08 11:35VictorVillarPrioritylow => immediate
2016-09-08 11:35VictorVillarSeveritytrivial => critical
2016-09-14 18:42hgbotCheckin
2016-09-14 18:42hgbotNote Added: 0089960
2016-09-14 18:42hgbotStatusnew => resolved
2016-09-14 18:42hgbotResolutionopen => fixed
2016-09-14 18:42hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.bestsellers/rev/ed35833d0f6d2828795828a514ca0baa27fc61a9 [^]
2016-09-19 09:20marvintmAssigned ToRetail => marvintm
2016-09-19 18:56marvintmSeveritycritical => major
2016-09-20 13:02guilleaerReview Assigned To => guilleaer
2016-09-20 13:02guilleaerStatusresolved => closed
2016-09-20 13:02guilleaerFixed in Version => RR16Q4

Notes
(0089960)
hgbot   
2016-09-14 18:42   
Repository: erp/pmods/org.openbravo.retail.bestsellers
Changeset: ed35833d0f6d2828795828a514ca0baa27fc61a9
Author: Antonio Moreno <antonio.moreno <at> openbravo.com>
Date: Wed Sep 14 18:42:31 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.bestsellers/rev/ed35833d0f6d2828795828a514ca0baa27fc61a9 [^]

Fixed issue 33786. The Best Sellers tab in POS Terminal Type window will work again.
- The root cause of the problem was that before, there was no security check for the datasource requests triggered by tabs related to datasources instead of physical tables. The datasource defined in the Bestsellers module is used in a tab, but the datasource itself defined its corresponding entity to be a database view. The reason for this is that a datasource obviously cannot be queried via a database query, and the datasource implementation wanted to rely on the standard OB implementation for the fetch part, because the only required functionality was to be able to change the underlying table in a more convenient way.
- As now the security check ensures that you have access to the underlying entity, and as the entity defined in the datasource was different from the entity defined for the tab, the window itself gave error in Openbravo unless you explicitly gave access to the datasource-based entity in the 'Role Access' window, which shouldn't be required for users in general.
- The first part of the solution is therefore to properly define the entity in the datasource as the table associated to this datasource, and to the window tab. This ensures that the security check correctly identifies the datasource request as authorized, as the user has permission for the window.
- The second part of the solution is to dynamically reset the entity received as a parameter for fetch requests, reassigning it to a database view, which will then work correctly in the database query executed to get the data for the fetch.

---
M src/org/openbravo/retail/bestsellers/BestSellersByTerminalTypeDatasource.java
---