Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032375Openbravo ERPA. Platformpublic2016-02-29 14:122016-03-17 10:56
ngarcia 
alostale 
highminorrandom
closedfixed 
5
 
3.0PR16Q2 
caristu
Core
No
0032375: preferences incorrectly resolve client visibility
Having the same preference with two records defined as:
  1. visible at System client
  2. visible at specific client


Behavior when retrieving the value for this property is undefined:
  1. Sometimes it can correctly return client specific value, which is the expected behavior
  2. Some other times a PropertyConflictException is thrown
1. Go to Preferences window
2. Create a preference with system client visibility
3. Create the same preference with different value and visibility for concrete client
4. Try to retrieve that preference's value for that concrete client:
  -> sometimes PropertyConflictException will be thrown, whereas some others specific client value will be obtained
1. Make property resolution predictable so, in case of conflict, it always works in the same manner.
2. Implement proper handling of client visibility resolution. Preferences.isHigherPriority method needs to be revisited for client level resolution, this is current code which is incorrect:
    if ((pref2.getVisibleAtClient() == null || pref2.getVisibleAtClient().getId().equals("0"))
        && pref1.getVisibleAtClient() != null && !pref1.getVisibleAtClient().getId().equals("0")) {
      return 1;
    }
No tags attached.
has duplicate defect 0033156 closed platform Preferences.getPreferenceValue triggers not needed ad_client (+ probably ad_org loads) 
Issue History
2016-02-29 14:12ngarciaNew Issue
2016-02-29 14:12ngarciaAssigned To => platform
2016-02-29 14:12ngarciaModules => Core
2016-02-29 14:12ngarciaTriggers an Emergency Pack => No
2016-02-29 14:12ngarciaIssue Monitored: networkb
2016-02-29 14:17ngarciaSummaryisHigerPriority function of Preferences class returns 0 when pref2 is defined as client level and pref1 as system level => isHigherPriority function of Preferences class returns 0 when pref2 is defined as client level and pref1 as system level
2016-02-29 14:17ngarciaDescription Updatedbug_revision_view_page.php?rev_id=11273#r11273
2016-03-04 08:32alostaleReproducibilitysometimes => random
2016-03-04 08:32alostaleSummaryisHigherPriority function of Preferences class returns 0 when pref2 is defined as client level and pref1 as system level => preferences incorrectly resolve client visibility
2016-03-04 08:32alostaleDescription Updatedbug_revision_view_page.php?rev_id=11344#r11344
2016-03-04 08:32alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11346#r11346
2016-03-04 08:32alostaleProposed Solution updated
2016-03-04 09:06alostaleAssigned Toplatform => alostale
2016-03-04 09:06alostaleReview Assigned To => caristu
2016-03-04 09:08hgbotCheckin
2016-03-04 09:08hgbotNote Added: 0084707
2016-03-04 09:08hgbotCheckin
2016-03-04 09:08hgbotNote Added: 0084708
2016-03-04 09:08hgbotCheckin
2016-03-04 09:08hgbotNote Added: 0084709
2016-03-04 09:08hgbotStatusnew => resolved
2016-03-04 09:08hgbotResolutionopen => fixed
2016-03-04 09:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/94f9263bb271e8f1a9ec9959ed26449c1b3dc02b [^]
2016-03-04 09:09hgbotCheckin
2016-03-04 09:09hgbotNote Added: 0084710
2016-03-07 09:58caristuNote Added: 0084754
2016-03-07 09:58caristuStatusresolved => closed
2016-03-07 09:58caristuFixed in Version => 3.0PR16Q2
2016-03-07 09:59caristuNote Edited: 0084754bug_revision_view_page.php?bugnote_id=0084754#r11373
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085180
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085181
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085182
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085183
2016-06-06 14:17shuehnerRelationship addedhas duplicate 0033156

Notes
(0084707)
hgbot   
2016-03-04 09:08   
Repository: erp/devel/pi
Changeset: 6a656a96298bee7337800296a14d8c9d869afbdb
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Mar 04 08:45:40 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/6a656a96298bee7337800296a14d8c9d869afbdb [^]

related to bug 32375: preferences incorrectly resolve client visibility

  Small code clean up:
    -isHigherPriority renamed to getHighestPriority: by convention is* are boolean
     getters which was not the case of this one
    -removed unneded brackets in condition which didn't help to make the code more
     readable

---
M src/org/openbravo/erpCommon/businessUtility/Preferences.java
---
(0084708)
hgbot   
2016-03-04 09:08   
Repository: erp/devel/pi
Changeset: bc3e4c65d7b1bb7a9ecd5185fbf412b5ac6518a6
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Mar 04 08:48:31 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/bc3e4c65d7b1bb7a9ecd5185fbf412b5ac6518a6 [^]

related to bug 32375: make preference resolution more consistent

  In case of several preferences defined for a given property/attribute, the
  result of getting value could be undetermistic.

  Solved by sorting by preference's id in these cases.

---
M src/org/openbravo/erpCommon/businessUtility/Preferences.java
---
(0084709)
hgbot   
2016-03-04 09:08   
Repository: erp/devel/pi
Changeset: 94f9263bb271e8f1a9ec9959ed26449c1b3dc02b
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Mar 04 08:50:01 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/94f9263bb271e8f1a9ec9959ed26449c1b3dc02b [^]

fixed bug 32375: preferences incorrectly resolve client visibility

  Reimplemented client visibility resolution to correctly handle the case of
  2 preference candidates with different client visibility.

---
M src/org/openbravo/erpCommon/businessUtility/Preferences.java
---
(0084710)
hgbot   
2016-03-04 09:09   
Repository: erp/devel/pi
Changeset: d7b14fb65c2b82e5459cbd31363a7b92599d07ff
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Mar 04 08:51:01 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/d7b14fb65c2b82e5459cbd31363a7b92599d07ff [^]

related to bug 32375: added test case covering preference's client visibility

---
M src-test/src/org/openbravo/test/preference/PreferenceTest.java
---
(0084754)
caristu   
2016-03-07 09:58   
(edited on: 2016-03-07 09:59)
Code review + tested OK

Tested creating two preferences, both with different value and one with visibility for the system client and the other one for the specific client. Now it is always returned the client specific value, when we are logged in that client.

(0085180)
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
(0085181)
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
(0085182)
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
(0085183)
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