Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032231Openbravo ERPA. Platformpublic2016-02-15 13:262016-03-17 10:56
maite 
caristu 
urgentmajoralways
closedfixed 
5
 
3.0PR16Q23.0PR16Q2 
alostale
Core
No
0032231: "OBSERDS_RoleHasNoFieldAccess" error thrown with specific role definition and Total Gross Amount with no decimals
If you define a role with NO access to an specific tab but access to an specific field in Sales Order window, when editing the allowed field error "Saving failed. F&B International Group Admin does not have access to the field Total Gross Amount" is obtained only in case Total Gross Amount has not decimals
0. Access Sales Order window and create header for any org and bp
1. Access Role window, select "F&B International Group Admin" and go to Window Access tab. Access "Sales Order" window and access "Tab Access" to set "Header - Sales Order" and NOT editable tab. Access to "field access" tab and set "Description - Header - Sales Order" as "Editable field"
2. Logout/login
3. Access previous order and add any line setting price of 100 and qty=1 (to ensure that Total Gross Amount has no decimals). Save line
4. Access Order header, edit description field and save. Error "Saving failed. F&B International Group Admin does not have access to the field Total Gross Amount" is raised

NOTE: if Total Gross Amount is a decimal number then error is not raised
Error is raised by DefaultDataSourceService.java:261, when following code is executed:

String newValue = getValue(data, key);
String oldValue = getValue(oldData, key);
if (oldValue == null && newValue != null || oldValue != null
&& !oldValue.equals(newValue)) {
throw new RuntimeException(KernelUtils.getInstance().getI18N(
"OBSERDS_RoleHasNoFieldAccess",
No tags attached.
related to defect 0032292 closed caristu "OBSERDS_RoleHasNoFieldAccess" error thrown with specific role definition in Field tab 
Issue History
2016-02-15 13:26maiteNew Issue
2016-02-15 13:26maiteAssigned To => platform
2016-02-15 13:26maiteModules => Core
2016-02-15 13:26maiteResolution time => 1458514800
2016-02-15 13:26maiteTriggers an Emergency Pack => No
2016-02-15 13:26maiteIssue Monitored: networkb
2016-02-16 10:07caristuAssigned Toplatform => caristu
2016-02-16 10:07caristuStatusnew => scheduled
2016-02-16 10:17hgbotCheckin
2016-02-16 10:17hgbotNote Added: 0084230
2016-02-16 10:17hgbotStatusscheduled => resolved
2016-02-16 10:17hgbotResolutionopen => fixed
2016-02-16 10:17hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/c400203ec54f07b313cdfc3efc538bccef4f7716 [^]
2016-02-16 10:19caristuReview Assigned To => alostale
2016-02-16 10:19caristuIssue Monitored: alostale
2016-02-19 11:00alostaleNote Added: 0084349
2016-02-19 11:00alostaleStatusresolved => new
2016-02-19 11:00alostaleResolutionfixed => open
2016-02-19 13:10hgbotCheckin
2016-02-19 13:10hgbotNote Added: 0084367
2016-02-19 13:16caristuRelationship addedrelated to 0032292
2016-02-19 13:24caristuStatusnew => scheduled
2016-02-19 13:24caristuStatusscheduled => resolved
2016-02-19 13:24caristuResolutionopen => fixed
2016-02-26 09:03alostaleNote Added: 0084539
2016-02-26 09:03alostaleStatusresolved => closed
2016-02-26 09:03alostaleFixed in Version => 3.0PR16Q2
2016-02-26 09:03alostaleNote Edited: 0084539bug_revision_view_page.php?bugnote_id=0084539#r11260
2016-02-26 09:04alostaleNote Edited: 0084539bug_revision_view_page.php?bugnote_id=0084539#r11261
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085142
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085157

Notes
(0084230)
hgbot   
2016-02-16 10:17   
Repository: erp/devel/pi
Changeset: c400203ec54f07b313cdfc3efc538bccef4f7716
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Feb 16 10:15:42 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/c400203ec54f07b313cdfc3efc538bccef4f7716 [^]

fixes issue 32231: wrong number comparison when checking field access of a role

When checking the access of a numeric field, if it is an integer, the client sends the value without decimal places. This value is compared with the current value stored in the database which already stores the value with decimals. So, the comparison of the string values determines that they are different as for example we are comparing '100' with '100.00'.

To solve the problem, for this type of fields now the numeric value is compared instead of using its string representation.

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java
---
(0084349)
alostale   
2016-02-19 11:00   
Reopening current fix throws NPE if values are null.

Steps to reproduce it:
 1. Create a System Admin manual role
 2. Give read only access to Windows Tabs And Fields > Field
 3. Give edit access to Description field
 4. Using that role
 5. Open any existing Window
 6. Edit description for any field where Record Sort No. is empty and save
    -> ERROR
         NPE: can be seen in the log
         In UI the field continues as in Edit, save is not performed
(0084367)
hgbot   
2016-02-19 13:10   
Repository: erp/devel/pi
Changeset: f58e58d7e308b6824b5cfa65bd33188d7a806e1a
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Feb 19 13:09:01 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/f58e58d7e308b6824b5cfa65bd33188d7a806e1a [^]

related to issue 32231: check if values are null

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java
---
(0084539)
alostale   
2016-02-26 09:03   
(edited on: 2016-02-26 09:04)
Code reviewed

Tested with specified steps to reproduce as well as with limited role explained in note above.

(0085142)
hudsonbot   
2016-03-17 10:56   
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/b22fb0500156 [^]
Maturity status: Test
(0085157)
hudsonbot   
2016-03-17 10:56   
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/b22fb0500156 [^]
Maturity status: Test