IDEMPIERE-2507 Search definition not working for tables without IsSOTrx
This commit is contained in:
parent
9c3473e21b
commit
a3b50d0306
|
@ -38,6 +38,7 @@ import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.model.I_C_Payment;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
|
@ -158,15 +159,20 @@ public abstract class AbstractDocumentSearch {
|
||||||
sqlSO.append(Env.parseContext(Env.getCtx(), -1, " AND AD_Client_ID=@#AD_Client_ID@", false, true));
|
sqlSO.append(Env.parseContext(Env.getCtx(), -1, " AND AD_Client_ID=@#AD_Client_ID@", false, true));
|
||||||
|
|
||||||
if (msd.getPO_Window_ID() != 0) {
|
if (msd.getPO_Window_ID() != 0) {
|
||||||
sqlPO = new StringBuilder(sqlSO.toString()).append(" AND IsSOTrx='N'");
|
sqlPO = new StringBuilder(sqlSO.toString());
|
||||||
sqlSO.append(" AND IsSOTrx='Y'");
|
String columntrx = "IsSOTrx";
|
||||||
|
if (I_C_Payment.Table_Name.equals(table.getTableName())) {
|
||||||
|
columntrx = "IsReceipt";
|
||||||
|
}
|
||||||
|
sqlPO.append(" AND ").append(columntrx).append("='N'");
|
||||||
|
sqlSO.append(" AND ").append(columntrx).append("='Y'");
|
||||||
|
pstmtPO = DB.prepareStatement(sqlPO.toString(), null);
|
||||||
}
|
}
|
||||||
pstmtSO = DB.prepareStatement(sqlSO.toString(), null);
|
pstmtSO = DB.prepareStatement(sqlSO.toString(), null);
|
||||||
pstmtPO = DB.prepareStatement(sqlPO.toString(), null);
|
|
||||||
// search for a Integer
|
// search for a Integer
|
||||||
if (msd.getDataType().equals(MSearchDefinition.DATATYPE_INTEGER)) {
|
if (msd.getDataType().equals(MSearchDefinition.DATATYPE_INTEGER)) {
|
||||||
pstmtSO.setInt(1, Integer.valueOf(searchString.replaceAll("\\D", "")));
|
pstmtSO.setInt(1, Integer.valueOf(searchString.replaceAll("\\D", "")));
|
||||||
if (msd.getPO_Window_ID() != 0) {
|
if (pstmtPO != null) {
|
||||||
pstmtPO.setInt(1, Integer.valueOf(searchString.replaceAll("\\D", "")));
|
pstmtPO.setInt(1, Integer.valueOf(searchString.replaceAll("\\D", "")));
|
||||||
}
|
}
|
||||||
// search for a String
|
// search for a String
|
||||||
|
@ -175,7 +181,7 @@ public abstract class AbstractDocumentSearch {
|
||||||
pstmtSO.setString(1, searchString);
|
pstmtSO.setString(1, searchString);
|
||||||
else
|
else
|
||||||
pstmtSO.setString(1, searchString+"%");
|
pstmtSO.setString(1, searchString+"%");
|
||||||
if (msd.getPO_Window_ID() != 0) {
|
if (pstmtPO != null) {
|
||||||
if (searchString.endsWith("%"))
|
if (searchString.endsWith("%"))
|
||||||
pstmtPO.setString(1, searchString);
|
pstmtPO.setString(1, searchString);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue