Commit 674e5f96 authored by Víctor Martínez Romanos's avatar Víctor Martínez Romanos
Browse files

Related to ISSUE-46178: Code review improvements

Removed setFilterOnReadableOrganization(false) because it has no sense. Note that
just after this, the flow gets the list of editable organizations using:
  Utility.getContext(conn, vars, "#User_Org", "LoginHandler")
and it iterates over them (and their parent tree) to get the ledger configuration.

The ledger configuration must be in a readable organization (either in an editable
organization or in a parent editable/readable organization), so the filter by
readable organization should be in.

Note that ideally we should filter by the editable organizations and their parents,
which is what later on is going to be used, however the purpose of this fix is to
avoid performance penalty, so having a fast (although inaccurate query in some corner
cases) is a good approach.

Apart from that the method has been renamed to be more clear.
parent 3694254d
......@@ -302,7 +302,7 @@ public class LoginUtils {
// Get General Ledger of context organizations
// Before going for all organizations, check if any org has an accounting schema
if (ArrayUtils.isEmpty(attr) && existsOrgWithledgerConfigured()) {
if (ArrayUtils.isEmpty(attr) && existsAnyOrgWithLedgerConfigured()) {
String[] orgList = Utility.getContext(conn, vars, "#User_Org", "LoginHandler")
.replace("'", "")
......@@ -421,13 +421,10 @@ public class LoginUtils {
return true;
private static boolean existsOrgWithledgerConfigured() {
private static boolean existsAnyOrgWithLedgerConfigured() {
OBCriteria<Organization> orgCriteria = OBDal.getInstance().createCriteria(Organization.class);
return orgCriteria.uniqueResult() != null;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment