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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0046217
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminoralways2021-04-06 13:472022-02-01 07:24
ReportervmromanosView Statuspublic 
Assigned ToTriage Platform Base 
PrioritynormalResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0046217: Organization entity and OBCriteria.setFilterOnReadableOrganization(true) won't work

DescriptionIn OBCriteria.initialize() we have the following code:

    if (isFilterOnReadableOrganization() && e.isOrganizationPartOfKey()) {
      add(Restrictions.in("id." + PROPERTY_ORGANIZATION + ".id",
          (Object[]) obContext.getReadableOrganizations()));

    } else if (isFilterOnReadableOrganization() && e.isOrganizationEnabled()) {
      add(Restrictions.in(PROPERTY_ORGANIZATION + ".id",
          (Object[]) obContext.getReadableOrganizations()));
    }

In order to add the readable organizations filter the entity should either isOrganizationPartOfKey() or isOrganizationEnabled().


Both methods depend on variables set at Property.initializeName() method:
   
    if (getName().equals("organization")) {
      setClientOrOrganization(true);
      getEntity().setOrganizationEnabled(true);
      if (isId() || isPartOfCompositeId()) {
        getEntity().setOrganizationPartOfKey(true);
      }
    }

In the case of the Organization entity we don't have a property called "organization" because it's actually the entity's "id", so Organization is never set as organizationEnabled or organizationPartOfKey, so the OBCriteria never adds the filter over the readable organizations.


Note this is a corner case that should only happen when querying the Organization entity using the OBCriteria. Any other entity should be safe.

Right now any OBCriteria over the Organization entity doesn't add any filter to readable organizations, which means the query is run for every organization (unless the OBCriteria instance adds an explicit filter over the organization's ids).
Steps To ReproduceCreate a simple OBCriteria over Organization entity. Example:

OBCriteria<Organization> orgCriteria = OBDal.getInstance().createCriteria(Organization.class);
orgCriteria.setMaxResults(1);
orgCriteria.uniqueResult();

Set a breakpoint at OBCriteria.initialize() [in the above code].
Verify isFilterOnReadableOrganization() is true, but the Restriction over the readable organizations is not added.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0046178 closedmarkmm82 Avoid trying to find the general ledger configuration if it is not configured in any organization 

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2021-04-06 13:47 vmromanos New Issue
2021-04-06 13:47 vmromanos Assigned To => platform
2021-04-06 13:47 vmromanos Modules => Core
2021-04-06 13:47 vmromanos Triggers an Emergency Pack => No
2021-04-06 14:24 vmromanos Relationship added related to 0046178
2022-02-01 07:24 alostale Assigned To platform => Triage Platform Base


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker