Merge fe2e6271b1b7

This commit is contained in:
Heng Sin Low 2013-05-02 17:32:46 +08:00
commit b226869ad4
8 changed files with 89 additions and 65 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,15 +50,22 @@ public class PrintDataColumn
if (m_alias == null)
m_alias = columnName;
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 String m_columnName;
private String m_foreignColumnName;
private int m_displayType;
private int m_columnSize;
private String m_alias;
private boolean m_pageBreak;
private String m_FormatPattern;
private String m_FormatPattern;
/*************************************************************************/
@ -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,8 +59,14 @@ 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
/**
* Print Data Element Constructor
* @param columnName name
@ -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 */
@ -103,6 +116,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

View File

@ -1286,9 +1286,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
StringBuilder sb = new StringBuilder();
String msg = e.getMessage();
StringBuilder adMessage = new StringBuilder();
String origmsg = null;
if (msg != null && msg.length() > 0)
{
adMessage.append(Msg.getMsg(Env.getCtx(), e.getAD_Message()));
origmsg = Msg.getMsg(Env.getCtx(), e.getAD_Message());
adMessage.append(origmsg);
}
String info = e.getInfo();
if (info != null && info.length() > 0)
@ -1320,7 +1322,14 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
adMessage.append(tail);
}
sb.append(MessageFormat.format(adMessage.toString(), arguments));
if ( arguments.length == 1
&& origmsg != null
&& origmsg.equals(arguments[0])) { // check dup message
sb.append(origmsg);
} else {
String adMessageQuot = Util.replace(adMessage.toString(), "'", "''");
sb.append(MessageFormat.format(adMessageQuot, arguments));
}
}
else
{

View File

@ -295,9 +295,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
private ColumnInfo createLookupColumnInfo(TableInfo[] tableInfos,
GridField gridField, MInfoColumn infoColumn) {
String columnName = gridField.getColumnName();
int AD_Reference_Value_ID = 0;
String validationCode = "";
MLookupInfo lookupInfo = MLookupFactory.getLookupInfo(Env.getCtx(), p_WindowNo, 0, infoColumn.getAD_Reference_ID(), Env.getLanguage(Env.getCtx()), columnName, AD_Reference_Value_ID, false, validationCode);
MLookupInfo lookupInfo = MLookupFactory.getLookupInfo(Env.getCtx(), p_WindowNo, 0, infoColumn.getAD_Reference_ID(), Env.getLanguage(Env.getCtx()), columnName, infoColumn.getAD_Reference_Value_ID(), false, validationCode);
String displayColumn = lookupInfo.DisplayColumn;
int index = infoColumn.getSelectClause().indexOf(".");

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);

View File

@ -13,6 +13,9 @@
*****************************************************************************/
package org.compiere.apps.form;
import static org.compiere.model.SystemIDs.PROCESS_M_INOUT_GENERATERMA_MANUAL;
import static org.compiere.model.SystemIDs.PROCESS_M_INOUT_GENERATE_MANUAL;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -24,12 +27,10 @@ import java.util.logging.Level;
import org.compiere.apps.IStatusBar;
import org.compiere.minigrid.IDColumn;
import org.compiere.minigrid.IMiniTable;
import org.compiere.model.MOrder;
import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MPrivateAccess;
import org.compiere.model.MRMA;
import static org.compiere.model.SystemIDs.*;
import org.compiere.model.MRole;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
@ -93,7 +94,8 @@ public class InOutGen extends GenForm
// Create SQL
StringBuilder sql = new StringBuilder(
"SELECT C_Order_ID, o.Name, dt.Name, DocumentNo, bp.Name, DateOrdered, TotalLines "
+ "FROM M_InOut_Candidate_v ic, AD_Org o, C_BPartner bp, C_DocType dt "
// use C_Order instead of M_InOut_Candidate_v for access purposes, will be replaced later
+ "FROM C_Order ic, AD_Org o, C_BPartner bp, C_DocType dt "
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID"
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
+ " AND ic.C_DocType_ID=dt.C_DocType_ID"
@ -103,21 +105,11 @@ public class InOutGen extends GenForm
sql.append(" AND ic.M_Warehouse_ID=").append(m_M_Warehouse_ID);
if (m_C_BPartner_ID != null)
sql.append(" AND ic.C_BPartner_ID=").append(m_C_BPartner_ID);
// bug - [ 1713317 ] Generate Shipments (manual) show locked records
/* begin - Exclude locked records; @Trifon */
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MOrder.Table_ID, AD_User_ID);
if (lockedIDs != null)
{
if (sql.length() > 0)
sql.append(" AND ");
sql.append("C_Order_ID").append(lockedIDs);
}
/* eng - Exclude locked records; @Trifon */
//
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
sql = new StringBuilder(MRole.getDefault().addAccessSQL(sql.toString(), "ic", true, false));
// Replace C_Order by M_InOut_Candidate_v
int idxtable = sql.indexOf(" C_Order ");
sql.replace(idxtable, idxtable+" C_Order ".length(), " M_InOut_Candidate_v ");
return sql.toString();
}
@ -149,14 +141,8 @@ public class InOutGen extends GenForm
if (m_C_BPartner_ID != null)
sql.append(" AND bp.C_BPartner_ID=").append(m_C_BPartner_ID);
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MRMA.Table_ID, AD_User_ID);
if (lockedIDs != null)
{
sql.append(" AND rma.M_RMA_ID").append(lockedIDs);
}
sql.append(" ORDER BY org.Name, bp.Name, rma.Created ");
sql = new StringBuilder(MRole.getDefault().addAccessSQL(sql.toString(), "rma", true, false));
return sql.toString();
}

View File

@ -30,8 +30,8 @@ import org.compiere.minigrid.IMiniTable;
import org.compiere.model.MOrder;
import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MPrivateAccess;
import org.compiere.model.MRMA;
import org.compiere.model.MRole;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
@ -93,7 +93,8 @@ public class InvoiceGen extends GenForm
{
StringBuilder sql = new StringBuilder(
"SELECT C_Order_ID, o.Name, dt.Name, DocumentNo, bp.Name, DateOrdered, TotalLines "
+ "FROM C_Invoice_Candidate_v ic, AD_Org o, C_BPartner bp, C_DocType dt "
// use C_Order instead of C_Invoice_Candidate_v for access purposes, will be replaced later
+ "FROM C_Order ic, AD_Org o, C_BPartner bp, C_DocType dt "
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID"
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
+ " AND ic.C_DocType_ID=dt.C_DocType_ID"
@ -103,21 +104,11 @@ public class InvoiceGen extends GenForm
sql.append(" AND ic.AD_Org_ID=").append(m_AD_Org_ID);
if (m_C_BPartner_ID != null)
sql.append(" AND ic.C_BPartner_ID=").append(m_C_BPartner_ID);
// bug - [ 1713337 ] "Generate Invoices (manual)" show locked records.
/* begin - Exclude locked records; @Trifon */
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MOrder.Table_ID, AD_User_ID);
if (lockedIDs != null)
{
if (sql.length() > 0)
sql.append(" AND ");
sql.append("C_Order_ID").append(lockedIDs);
}
/* eng - Exclude locked records; @Trifon */
//
sql.append(" ORDER BY o.Name,bp.Name,DateOrdered");
sql = new StringBuilder(MRole.getDefault().addAccessSQL(sql.toString(), "ic", true, false));
// Replace C_Order by C_Invoice_Candidate_v
int idxtable = sql.indexOf(" C_Order ");
sql.replace(idxtable, idxtable+" C_Order ".length(), " C_Invoice_Candidate_v ");
return sql.toString();
}
@ -151,14 +142,8 @@ public class InvoiceGen extends GenForm
if (m_C_BPartner_ID != null)
sql.append(" AND bp.C_BPartner_ID=").append(m_C_BPartner_ID);
int AD_User_ID = Env.getContextAsInt(Env.getCtx(), "#AD_User_ID");
String lockedIDs = MPrivateAccess.getLockedRecordWhere(MRMA.Table_ID, AD_User_ID);
if (lockedIDs != null)
{
sql.append(" AND rma.M_RMA_ID").append(lockedIDs);
}
sql.append(" ORDER BY org.Name, bp.Name, rma.Created ");
sql = new StringBuilder(MRole.getDefault().addAccessSQL(sql.toString(), "rma", true, false));
return sql.toString();
}