From 38c6ca185c62f37ae0435d18e543c5a217f9ad1e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 11 Dec 2013 12:18:16 -0500 Subject: [PATCH] IDEMPIERE-1558 Performance indicators display fails using context variables in measure calculation / based on patch from Jesus Garcia (j2garcia) --- org.adempiere.base/src/org/compiere/model/MMeasure.java | 2 ++ org.adempiere.base/src/org/compiere/model/MMeasureCalc.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MMeasure.java b/org.adempiere.base/src/org/compiere/model/MMeasure.java index 2210fc5f4e..aac86ad6d4 100644 --- a/org.adempiere.base/src/org/compiere/model/MMeasure.java +++ b/org.adempiere.base/src/org/compiere/model/MMeasure.java @@ -109,6 +109,8 @@ public class MMeasure extends X_PA_Measure String sql = mc.getSqlBarChart(goal.getRestrictions(false), goal.getMeasureDisplay(), goal.getDateFrom(), MRole.getDefault()); // logged in role + if (sql.indexOf("@") >= 0) + sql = Env.parseContext(getCtx(), 0, sql, false, false); PreparedStatement pstmt = null; ResultSet rs = null; try diff --git a/org.adempiere.base/src/org/compiere/model/MMeasureCalc.java b/org.adempiere.base/src/org/compiere/model/MMeasureCalc.java index 8f86fa39c5..ccc13d6096 100644 --- a/org.adempiere.base/src/org/compiere/model/MMeasureCalc.java +++ b/org.adempiere.base/src/org/compiere/model/MMeasureCalc.java @@ -235,6 +235,8 @@ public class MMeasureCalc extends X_PA_MeasureCalc .append("')=TRUNC(").append(DB.TO_DATE(date)).append(",'").append(trunc).append("')"); } String finalSQL = addRestrictions(sql.toString(), restrictions, role); + if (finalSQL.indexOf("@") >= 0) + finalSQL = Env.parseContext(getCtx(), 0, finalSQL, false, false); // Execute StringBuilder where = new StringBuilder(); PreparedStatement pstmt = null;