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(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();
}
@ -904,7 +906,7 @@ public class DataEngine
if (display != null && !rs.wasNull())
{
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

View File

@ -36,10 +36,9 @@ public class PrintDataColumn
* @param columnSize Column Size
* @param alias Alias in query or the same as column name or null
* @param isPageBreak if true force page break after function
* @param foreignColumnName name foreign
*/
public PrintDataColumn (int AD_Column_ID, String columnName,
int displayType, int columnSize,
String alias, boolean isPageBreak)
public PrintDataColumn(int AD_Column_ID, String columnName,int displayType, int columnSize,String alias, boolean isPageBreak, String foreignColumnName)
{
m_AD_Column_ID = AD_Column_ID;
m_columnName = columnName;
@ -51,10 +50,17 @@ public class PrintDataColumn
if (m_alias == null)
m_alias = columnName;
m_pageBreak = isPageBreak;
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 String m_columnName;
private String m_foreignColumnName;
private int m_displayType;
private int m_columnSize;
private String m_alias;
@ -81,6 +87,18 @@ public class PrintDataColumn
return m_columnName;
} // 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
* @return display type

View File

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

View File

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