IDEMPIERE-888 NPE when opening an account as report from Trial Balance

This commit is contained in:
Carlos Ruiz 2013-05-01 10:50:18 -05:00
parent 87de4029eb
commit 3507559ef1
4 changed files with 58 additions and 13 deletions

View File

@ -404,7 +404,9 @@ public class DataEngine
groupByColumns.add(m_synonym+display); groupByColumns.add(m_synonym+display);
groupByColumns.add(lookupSQL); groupByColumns.add(lookupSQL);
// //
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak); TableReference tr = getTableReference(AD_Reference_Value_ID);
String foreignColumnName = tr.KeyColumn;
pdc = new PrintDataColumn(AD_Column_ID, ColumnName, AD_Reference_ID, FieldLength, orderName, isPageBreak, foreignColumnName);
synonymNext(); synonymNext();
} }
@ -904,7 +906,7 @@ public class DataEngine
if (display != null && !rs.wasNull()) if (display != null && !rs.wasNull())
{ {
KeyNamePair pp = new KeyNamePair(id, display); KeyNamePair pp = new KeyNamePair(id, display);
pde = new PrintDataElement(pdc.getColumnName(), pp, pdc.getDisplayType(), pdc.getFormatPattern()); pde = new PrintDataElement(pdc.getColumnName(), pp, pdc.getDisplayType(), pdc.getFormatPattern(), pdc.getForeignColumnName());
} }
} }
else else

View File

@ -36,10 +36,9 @@ public class PrintDataColumn
* @param columnSize Column Size * @param columnSize Column Size
* @param alias Alias in query or the same as column name or null * @param alias Alias in query or the same as column name or null
* @param isPageBreak if true force page break after function * @param isPageBreak if true force page break after function
* @param foreignColumnName name foreign
*/ */
public PrintDataColumn (int AD_Column_ID, String columnName, public PrintDataColumn(int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak, String foreignColumnName)
int displayType, int columnSize,
String alias, boolean isPageBreak)
{ {
m_AD_Column_ID = AD_Column_ID; m_AD_Column_ID = AD_Column_ID;
m_columnName = columnName; m_columnName = columnName;
@ -51,15 +50,22 @@ public class PrintDataColumn
if (m_alias == null) if (m_alias == null)
m_alias = columnName; m_alias = columnName;
m_pageBreak = isPageBreak; m_pageBreak = isPageBreak;
} // PrintDataColumn m_foreignColumnName = foreignColumnName;
}
public PrintDataColumn (int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak)
{
this(AD_Column_ID, columnName, displayType, columnSize, alias, isPageBreak, null);
} // PrintDataColumn
private int m_AD_Column_ID; private int m_AD_Column_ID;
private String m_columnName; private String m_columnName;
private String m_foreignColumnName;
private int m_displayType; private int m_displayType;
private int m_columnSize; private int m_columnSize;
private String m_alias; private String m_alias;
private boolean m_pageBreak; private boolean m_pageBreak;
private String m_FormatPattern; private String m_FormatPattern;
/*************************************************************************/ /*************************************************************************/
@ -81,6 +87,18 @@ public class PrintDataColumn
return m_columnName; return m_columnName;
} // getColumnName } // getColumnName
/**
* Get ForeignColumn Name
* @return column foreign name
*/
public String getForeignColumnName()
{
if (m_foreignColumnName == null)
return m_columnName;
else
return m_foreignColumnName;
} // getForeignColumnName
/** /**
* Get Display Type * Get Display Type
* @return display type * @return display type

View File

@ -36,10 +36,9 @@ import org.compiere.util.NamePair;
public class PrintDataElement implements Serializable public class PrintDataElement implements Serializable
{ {
/** /**
* generated serialize id *
*/ */
private static final long serialVersionUID = -4823568539698752659L; private static final long serialVersionUID = 2177482817458457236L;
/** /**
* Print Data Element Constructor * Print Data Element Constructor
@ -48,8 +47,9 @@ public class PrintDataElement implements Serializable
* @param displayType optional displayType * @param displayType optional displayType
* @param isPKey is primary key * @param isPKey is primary key
* @param isPageBreak if true force page break * @param isPageBreak if true force page break
* @param foreignColumnName name foreign
*/ */
public PrintDataElement (String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format) public PrintDataElement (String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format, String foreignColumnName)
{ {
if (columnName == null) if (columnName == null)
throw new IllegalArgumentException("PrintDataElement - Name cannot be null"); throw new IllegalArgumentException("PrintDataElement - Name cannot be null");
@ -59,8 +59,14 @@ public class PrintDataElement implements Serializable
m_isPKey = isPKey; m_isPKey = isPKey;
m_isPageBreak = isPageBreak; m_isPageBreak = isPageBreak;
m_formatPattern = format; m_formatPattern = format;
m_foreignColumnName = foreignColumnName;
} // PrintDataElement } // PrintDataElement
public PrintDataElement(String columnName, Serializable value, int displayType, String pattern, String foreignColumnName)
{
this (columnName, value, displayType, false, false, pattern, foreignColumnName);
} // PrintDataElement
/** /**
* Print Data Element Constructor * Print Data Element Constructor
* @param columnName name * @param columnName name
@ -70,9 +76,14 @@ public class PrintDataElement implements Serializable
*/ */
public PrintDataElement(String columnName, Serializable value, int displayType, String pattern) public PrintDataElement(String columnName, Serializable value, int displayType, String pattern)
{ {
this (columnName, value, displayType, false, false, pattern); this (columnName, value, displayType, false, false, pattern, null);
} // PrintDataElement } // PrintDataElement
public PrintDataElement (String columnName, Serializable value, int displayType, boolean isPKey, boolean isPageBreak, String format)
{
this(columnName, value, displayType, isPKey, isPageBreak, format, null);
}
/** Data Name */ /** Data Name */
private String m_columnName; private String m_columnName;
/** Data Value */ /** Data Value */
@ -85,6 +96,8 @@ public class PrintDataElement implements Serializable
private boolean m_isPageBreak; private boolean m_isPageBreak;
/** Value format pattern */ /** Value format pattern */
private String m_formatPattern; private String m_formatPattern;
/** Value foreign name */
private String m_foreignColumnName;
/** XML Element Name */ /** XML Element Name */
@ -103,6 +116,18 @@ public class PrintDataElement implements Serializable
{ {
return m_columnName; return m_columnName;
} // getName } // getName
/**
* Get ForeignName
* @return name
*/
public String getForeignColumnName() {
if (m_foreignColumnName == null)
return m_columnName;
else
return m_foreignColumnName;
}
/** /**
* Get Node Value * Get Node Value

View File

@ -79,7 +79,7 @@ public class HTMLExtension implements IHTMLExtension {
href.setStyle("text-decoration: none; font-size: 11px; vertical-align: middle;"); href.setStyle("text-decoration: none; font-size: 11px; vertical-align: middle;");
href.addAttribute("onclick", "parent.drillDown('" href.addAttribute("onclick", "parent.drillDown('"
+ componentId + "', '" + componentId + "', '"
+ dataElement.getColumnName() + "', '" + dataElement.getForeignColumnName() + "', '"
+ dataElement.getValueAsString() + "')"); + dataElement.getValueAsString() + "')");
report.addElement(href); report.addElement(href);
menu.addElement(report); menu.addElement(report);