commit
fb3e730ad6
|
@ -0,0 +1,65 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software, you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
|
||||
public class MReportView extends X_AD_ReportView {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5674822764517548357L;
|
||||
|
||||
/** Static Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MReportView.class);
|
||||
/** Cache */
|
||||
static private CCache<Integer,MReportView> s_cache = new CCache<Integer,MReportView>(Table_Name, 30, 60);
|
||||
|
||||
|
||||
public MReportView(Properties ctx, int AD_ReportView_ID, String trxName) {
|
||||
super(ctx, AD_ReportView_ID, trxName);
|
||||
}
|
||||
|
||||
public MReportView(Properties ctx, ResultSet rs, String trxName) {
|
||||
super(ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ctx
|
||||
* @param AD_ReportView_ID
|
||||
* @return
|
||||
*/
|
||||
public static MReportView get (Properties ctx, int AD_ReportView_ID) {
|
||||
if(AD_ReportView_ID==0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer key = Integer.valueOf(AD_ReportView_ID);
|
||||
MReportView retValue = (MReportView)s_cache.get(key);
|
||||
if (retValue == null)
|
||||
{
|
||||
retValue = new MReportView (ctx, AD_ReportView_ID, null);
|
||||
s_cache.put(key, retValue);
|
||||
}
|
||||
return retValue;
|
||||
} // get
|
||||
}
|
|
@ -30,6 +30,7 @@ import java.util.regex.Pattern;
|
|||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MReportView;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.CLogMgt;
|
||||
|
@ -709,7 +710,7 @@ public class DataEngine
|
|||
}
|
||||
|
||||
// Add ORDER BY clause
|
||||
if (orderColumns != null)
|
||||
if (orderColumns != null && orderColumns.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < orderColumns.size(); i++)
|
||||
{
|
||||
|
@ -723,7 +724,15 @@ public class DataEngine
|
|||
finalSQL.append(by);
|
||||
}
|
||||
} // order by
|
||||
|
||||
else if (format.getAD_ReportView_ID() > 0)
|
||||
{
|
||||
MReportView reportView = MReportView.get(Env.getCtx(),format.getAD_ReportView_ID());
|
||||
|
||||
if (reportView!=null && !Util.isEmpty(reportView.getOrderByClause(), true))
|
||||
{
|
||||
finalSQL.append(" ORDER BY ").append(reportView.getOrderByClause());
|
||||
}
|
||||
} // Report view order by clause.
|
||||
|
||||
// Print Data
|
||||
PrintData pd = new PrintData (ctx, reportName);
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.compiere.model.I_AD_ReportView;
|
|||
import org.compiere.model.I_AD_Table;
|
||||
import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||
import org.compiere.model.X_AD_Package_Imp_Detail;
|
||||
import org.compiere.model.X_AD_ReportView;
|
||||
import org.compiere.model.MReportView;
|
||||
import org.compiere.model.X_AD_ReportView_Col;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -50,11 +50,11 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
|||
public void startElement(PIPOContext ctx, Element element)
|
||||
throws SAXException {
|
||||
|
||||
List<String> excludes = defaultExcludeList(X_AD_ReportView.Table_Name);
|
||||
List<String> excludes = defaultExcludeList(MReportView.Table_Name);
|
||||
|
||||
X_AD_ReportView mReportview = findPO(ctx, element);
|
||||
MReportView mReportview = findPO(ctx, element);
|
||||
if (mReportview == null) {
|
||||
mReportview = new X_AD_ReportView(ctx.ctx, 0, getTrxName(ctx));
|
||||
mReportview = new MReportView(ctx.ctx, 0, getTrxName(ctx));
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, mReportview, element, this);
|
||||
List<String> notfound = filler.autoFill(excludes);
|
||||
|
@ -65,11 +65,11 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
if (mReportview.is_new() || mReportview.is_Changed()) {
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_ReportView.Table_Name,
|
||||
X_AD_ReportView.Table_ID);
|
||||
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, MReportView.Table_Name,
|
||||
MReportView.Table_ID);
|
||||
String action = null;
|
||||
if (!mReportview.is_new()) {
|
||||
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_ReportView.Table_Name, mReportview);
|
||||
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), MReportView.Table_Name, mReportview);
|
||||
action = "Update";
|
||||
} else {
|
||||
action = "New";
|
||||
|
@ -97,7 +97,7 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
|
||||
AttributesImpl atts = new AttributesImpl();
|
||||
X_AD_ReportView m_Reportview = new X_AD_ReportView(ctx.ctx, AD_ReportView_ID, getTrxName(ctx));
|
||||
MReportView m_Reportview = new MReportView(ctx.ctx, AD_ReportView_ID, getTrxName(ctx));
|
||||
|
||||
// Export Table if neccessary
|
||||
ElementHandler tableHandler = packOut.getHandler(I_AD_Table.Table_Name);
|
||||
|
@ -133,7 +133,7 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
if (createElement) {
|
||||
document.endElement("", "", X_AD_ReportView.Table_Name);
|
||||
document.endElement("", "", MReportView.Table_Name);
|
||||
}
|
||||
|
||||
sql = "SELECT AD_PrintFormat_ID FROM AD_PrintFormat WHERE AD_ReportView_ID="
|
||||
|
@ -165,10 +165,10 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
private void createReportViewBinding(PIPOContext ctx, TransformerHandler document,
|
||||
X_AD_ReportView m_Reportview) {
|
||||
MReportView m_Reportview) {
|
||||
|
||||
PoExporter filler = new PoExporter(ctx, document, m_Reportview);
|
||||
List<String> excludes = defaultExcludeList(X_AD_ReportView.Table_Name);
|
||||
List<String> excludes = defaultExcludeList(MReportView.Table_Name);
|
||||
if (m_Reportview.getAD_ReportView_ID() <= PackOut.MAX_OFFICIAL_ID)
|
||||
filler.add("AD_ReportView_ID", new AttributesImpl());
|
||||
filler.export(excludes);
|
||||
|
|
|
@ -73,7 +73,7 @@ import org.compiere.model.MSysConfig;
|
|||
import org.compiere.model.MUser;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.SystemIDs;
|
||||
import org.compiere.model.X_AD_ReportView;
|
||||
import org.compiere.model.MReportView;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
|
@ -542,7 +542,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
{
|
||||
if (pr.getAD_ReportView_ID() > 0)
|
||||
{
|
||||
X_AD_ReportView m_Reportview = new X_AD_ReportView(m_ctx, pr.getAD_ReportView_ID(), null);
|
||||
MReportView m_Reportview = MReportView.get(m_ctx, pr.getAD_ReportView_ID());
|
||||
table_ID = m_Reportview.getAD_Table_ID();
|
||||
}
|
||||
else if (pr.getAD_PrintFormat_ID() > 0)
|
||||
|
|
Loading…
Reference in New Issue