The Tab Sort without parent column

http://sourceforge.net/tracker/?func=detail&aid=2826406&group_id=176962&atid=879335

kind regards
Victor Perez
www.e-evolution.com
This commit is contained in:
vpj-cd 2009-07-24 07:21:32 +00:00
parent 8d64acf527
commit 40163bcf52
2 changed files with 43 additions and 8 deletions

View File

@ -70,6 +70,9 @@ import org.compiere.util.NamePair;
* *
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* FR [ 1779410 ] VSortTab: display ID for not visible columns * FR [ 1779410 ] VSortTab: display ID for not visible columns
* @author victor.perez@e-evolution.com, e-Evolution
* FR [ 2826406 ] The Tab Sort without parent column
* <li> https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2826406&group_id=176962
*/ */
public class VSortTab extends CPanel implements APanelTab public class VSortTab extends CPanel implements APanelTab
{ {
@ -417,7 +420,11 @@ public class VSortTab extends CPanel implements APanelTab
if (m_IdentifierTranslated) if (m_IdentifierTranslated)
sql.append(", ").append(m_TableName).append("_Trl tt"); sql.append(", ").append(m_TableName).append("_Trl tt");
// Where // Where
//FR [ 2826406 ]
if(m_ParentColumnName != null)
{
sql.append(" WHERE t.").append(m_ParentColumnName).append("=?"); sql.append(" WHERE t.").append(m_ParentColumnName).append("=?");
}
if (m_IdentifierTranslated) if (m_IdentifierTranslated)
sql.append(" AND t.").append(m_KeyColumnName).append("=tt.").append(m_KeyColumnName) sql.append(" AND t.").append(m_KeyColumnName).append("=tt.").append(m_KeyColumnName)
.append(" AND tt.AD_Language=?"); .append(" AND tt.AD_Language=?");
@ -426,16 +433,27 @@ public class VSortTab extends CPanel implements APanelTab
if (m_ColumnYesNoName != null) if (m_ColumnYesNoName != null)
sql.append("6 DESC,"); // t.IsDisplayed DESC sql.append("6 DESC,"); // t.IsDisplayed DESC
sql.append("3,2"); // t.SeqNo, tt.Name sql.append("3,2"); // t.SeqNo, tt.Name
int ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, m_ParentColumnName); //FR [ 2826406 ]
int ID = 0;
if(m_ParentColumnName != null)
{
ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, m_ParentColumnName);
log.fine(sql.toString() + " - ID=" + ID); log.fine(sql.toString() + " - ID=" + ID);
}
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql.toString(), null); pstmt = DB.prepareStatement(sql.toString(), null);
//FR [ 2826406 ]
if(m_ParentColumnName != null)
{
pstmt.setInt(1, ID); pstmt.setInt(1, ID);
}
if (m_IdentifierTranslated) if (m_IdentifierTranslated)
pstmt.setString(2, Env.getAD_Language(Env.getCtx())); pstmt.setString(2, Env.getAD_Language(Env.getCtx()));
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {

View File

@ -60,6 +60,9 @@ import org.zkoss.zul.event.ListDataEvent;
* @author Teo Sarca, SC ARHIPAC SERVICE SRL * @author Teo Sarca, SC ARHIPAC SERVICE SRL
* FR [ 1779410 ] VSortTab: display ID for not visible columns * FR [ 1779410 ] VSortTab: display ID for not visible columns
* *
* @author victor.perez@e-evolution.com, e-Evolution
* FR [ 2826406 ] The Tab Sort without parent column
* <li> https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2826406&group_id=176962
* Zk Port * Zk Port
* @author Low Heng Sin * @author Low Heng Sin
*/ */
@ -398,7 +401,11 @@ public class ADSortTab extends Panel implements IADTabpanel
if (m_IdentifierTranslated) if (m_IdentifierTranslated)
sql.append(", ").append(m_TableName).append("_Trl tt"); sql.append(", ").append(m_TableName).append("_Trl tt");
// Where // Where
//FR [ 2826406 ]
if(m_ParentColumnName != null)
{
sql.append(" WHERE t.").append(m_ParentColumnName).append("=?"); sql.append(" WHERE t.").append(m_ParentColumnName).append("=?");
}
if (m_IdentifierTranslated) if (m_IdentifierTranslated)
sql.append(" AND t.").append(m_KeyColumnName).append("=tt.").append(m_KeyColumnName) sql.append(" AND t.").append(m_KeyColumnName).append("=tt.").append(m_KeyColumnName)
.append(" AND tt.AD_Language=?"); .append(" AND tt.AD_Language=?");
@ -407,16 +414,26 @@ public class ADSortTab extends Panel implements IADTabpanel
if (m_ColumnYesNoName != null) if (m_ColumnYesNoName != null)
sql.append("6 DESC,"); // t.IsDisplayed DESC sql.append("6 DESC,"); // t.IsDisplayed DESC
sql.append("3,2"); // t.SeqNo, tt.Name sql.append("3,2"); // t.SeqNo, tt.Name
int ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, m_ParentColumnName); //FR [ 2826406 ]
int ID = 0;
if(m_ParentColumnName != null)
{
ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, m_ParentColumnName);
log.fine(sql.toString() + " - ID=" + ID); log.fine(sql.toString() + " - ID=" + ID);
}
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql.toString(), null); pstmt = DB.prepareStatement(sql.toString(), null);
//FR [ 2826406 ]
if(m_ParentColumnName != null)
{
pstmt.setInt(1, ID); pstmt.setInt(1, ID);
}
if (m_IdentifierTranslated) if (m_IdentifierTranslated)
pstmt.setString(2, Env.getAD_Language(Env.getCtx())); pstmt.setString(2, Env.getAD_Language(Env.getCtx()));
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {