From 971eaecf4327aedd03843c86f421c313fedf7fc5 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Thu, 18 Jul 2013 20:08:25 +0530 Subject: [PATCH] IDEMPIERE-1157: Adding functinality to add charts on the standard windows --- .../src/org/compiere/model/MChartDatasource.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MChartDatasource.java b/org.adempiere.base/src/org/compiere/model/MChartDatasource.java index 3e63ed9aa7..6ab754de16 100644 --- a/org.adempiere.base/src/org/compiere/model/MChartDatasource.java +++ b/org.adempiere.base/src/org/compiere/model/MChartDatasource.java @@ -118,6 +118,17 @@ public class MChartDatasource extends X_AD_ChartDatasource { sql += category + "<=TRUNC(" + DB.TO_DATE(new Timestamp(endDate.getTime())) + ", '" + unit + "') "; } + int startIndex=0; + if ((startIndex = sql.indexOf('@')) != -1){ + String variable = sql.substring(startIndex); + int endIndex = variable.indexOf('@',1); + if(endIndex != -1){ + variable = variable.substring(0,endIndex+1); + String val = Env.getContext(getCtx(), variable.replace('@',' ').trim()); + sql=sql.replaceFirst(variable, val); + } + } + MRole role = MRole.getDefault(getCtx(), false); sql = role.addAccessSQL(sql, null, true, false);