IDEMPIERE-3350 Accounting Processor GL postings to "secondary" schema unreliable. MAcctSchema.isSkipOrgs should always check the full org tree.

This commit is contained in:
Heng Sin Low 2017-06-14 17:24:02 +08:00
parent 36409e56ba
commit e2a5b96126
3 changed files with 13 additions and 7 deletions

View File

@ -396,9 +396,8 @@ public class MAcctSchema extends X_C_AcctSchema
{
if (m_onlyOrgs == null)
{
m_onlyOrgs = MReportTree.getChildIDs(getCtx(),
0, MAcctSchemaElement.ELEMENTTYPE_Organization,
getAD_OrgOnly_ID());
MReportTree tree = new MReportTree (getCtx(), 0, true, MAcctSchemaElement.ELEMENTTYPE_Organization);
m_onlyOrgs = tree.getChildIDs(getAD_OrgOnly_ID());
}
return m_onlyOrgs;
} // getOnlyOrgs

View File

@ -253,7 +253,9 @@ public class MTree extends MTree_Base
if (!m_editable)
sql.append(" AND tn.IsActive='Y'");
sql.append(" ORDER BY COALESCE(tn.Parent_ID, -1), tn.SeqNo");
sql = new StringBuffer(MRole.getDefault().addAccessSQL(sql.toString(), "st", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)); // SQL_RO for Org_ID = 0
//do not check access if allNodes
if (AD_User_ID != -1)
sql = new StringBuffer(MRole.getDefault().addAccessSQL(sql.toString(), "st", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)); // SQL_RO for Org_ID = 0
}
if (log.isLoggable(Level.FINEST)) log.finest(sql.toString());
// The Node Loop

View File

@ -100,14 +100,19 @@ public class MReportTree
/** Map with Tree */
private static CCache<String,MReportTree> s_trees = new CCache<String,MReportTree>(null, "MReportTree", 20, false);
public MReportTree (Properties ctx, int PA_Hierarchy_ID, String ElementType)
{
this(ctx, PA_Hierarchy_ID, false, ElementType);
}
/**************************************************************************
* Report Tree
* @param ctx context
* @param PA_Hierarchy_ID optional hierarchy
* @param allNodes true to always get full tree
* @param ElementType Account Schema Element Type
*/
public MReportTree (Properties ctx, int PA_Hierarchy_ID, String ElementType)
public MReportTree (Properties ctx, int PA_Hierarchy_ID, boolean allNodes, String ElementType)
{
m_ElementType = ElementType;
m_TreeType = m_ElementType;
@ -127,7 +132,7 @@ public class MReportTree
+ ", PA_Hierarchy_ID=" + PA_Hierarchy_ID);
//
boolean clientTree = true;
m_tree = new MTree (ctx, AD_Tree_ID, true, clientTree, null); // include inactive and empty summary nodes
m_tree = new MTree (ctx, AD_Tree_ID, true, clientTree, allNodes, null); // include inactive and empty summary nodes
// remove summary nodes without children
m_tree.trimTree();
} // MReportTree