IDEMPIERE-1461 Zoom Condition doesn't work on empty fields / fix reported issue from hieplq, also fixes IDEMPIERE-1862

This commit is contained in:
Carlos Ruiz 2014-04-16 10:23:56 -05:00
parent 3f0f694709
commit ae3f1fbecf
3 changed files with 19 additions and 7 deletions

View File

@ -575,7 +575,7 @@ public final class MLookup extends Lookup implements Serializable
if (m_info.ZoomWindowPO == 0 || query == null) if (m_info.ZoomWindowPO == 0 || query == null)
return m_info.ZoomWindow; return m_info.ZoomWindow;
// Need to check SO/PO // Need to check SO/PO
boolean isSOTrx = DB.isSOTrx(m_info.TableName, query.getWhereClause(false)); boolean isSOTrx = DB.isSOTrx(m_info.TableName, query.getWhereClause(false), m_info.WindowNo);
// //
return getZoom(isSOTrx); return getZoom(isSOTrx);
} // getZoom } // getZoom

View File

@ -1695,9 +1695,10 @@ public final class DB
* Assumes Sales Order. Queries IsSOTrx of table with where clause * Assumes Sales Order. Queries IsSOTrx of table with where clause
* @param TableName table * @param TableName table
* @param whereClause where clause * @param whereClause where clause
* @param windowNo
* @return true (default) or false if tested that not SO * @return true (default) or false if tested that not SO
*/ */
public static boolean isSOTrx (String TableName, String whereClause) public static boolean isSOTrx (String TableName, String whereClause, int windowNo)
{ {
if (TableName == null || TableName.length() == 0) if (TableName == null || TableName.length() == 0)
{ {
@ -1710,7 +1711,7 @@ public final class DB
return true; return true;
} }
// //
boolean isSOTrx = true; Boolean isSOTrx = null;
boolean noIsSOTrxColumn = false; boolean noIsSOTrxColumn = false;
if (MTable.get(Env.getCtx(), TableName).getColumn("IsSOTrx") == null) { if (MTable.get(Env.getCtx(), TableName).getColumn("IsSOTrx") == null) {
noIsSOTrxColumn = true; noIsSOTrxColumn = true;
@ -1724,7 +1725,7 @@ public final class DB
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql, null);
rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
if (rs.next ()) if (rs.next ())
isSOTrx = "Y".equals(rs.getString(1)); isSOTrx = Boolean.valueOf("Y".equals(rs.getString(1)));
} }
catch (Exception e) catch (Exception e)
{ {
@ -1754,7 +1755,7 @@ public final class DB
pstmt2 = DB.prepareStatement (sql, null); pstmt2 = DB.prepareStatement (sql, null);
rs2 = pstmt2.executeQuery (); rs2 = pstmt2.executeQuery ();
if (rs2.next ()) if (rs2.next ())
isSOTrx = "Y".equals(rs2.getString(1)); isSOTrx = Boolean.valueOf("Y".equals(rs2.getString(1)));
} }
catch (Exception ee) catch (Exception ee)
{ {
@ -1770,9 +1771,20 @@ public final class DB
} }
if (noIsSOTrxColumn) if (noIsSOTrxColumn)
if (log.isLoggable(Level.FINEST))log.log(Level.FINEST, TableName + " - No SOTrx"); if (log.isLoggable(Level.FINEST))log.log(Level.FINEST, TableName + " - No SOTrx");
return isSOTrx; if (isSOTrx == null) {
if (windowNo >= 0) {
// check context
isSOTrx = Boolean.valueOf("Y".equals(Env.getContext(Env.getCtx(), windowNo, "IsSOTrx")));
} else {
isSOTrx = Boolean.TRUE;
}
}
return isSOTrx.booleanValue();
} // isSOTrx } // isSOTrx
public static boolean isSOTrx (String TableName, String whereClause) {
return isSOTrx (TableName, whereClause, -1);
}
/************************************************************************** /**************************************************************************
* Get next number for Key column = 0 is Error. * Get next number for Key column = 0 is Error.

View File

@ -1874,7 +1874,7 @@ public final class Env
if (table.getPO_Window_ID() != 0) if (table.getPO_Window_ID() != 0)
{ {
String whereClause = table.getTableName() + "_ID=" + Record_ID; String whereClause = table.getTableName() + "_ID=" + Record_ID;
isSOTrx = DB.isSOTrx(table.getTableName(), whereClause); isSOTrx = DB.isSOTrx(table.getTableName(), whereClause, windowNo);
if (!isSOTrx) if (!isSOTrx)
AD_Window_ID = table.getPO_Window_ID(); AD_Window_ID = table.getPO_Window_ID();
} }