IDEMPIERE-3844: Fix Date+Time not respected in process parameter.

This commit is contained in:
Deepak Pansheriya 2018-12-27 16:07:27 +05:30
parent 0d0b1eb5c3
commit e964bd84e5
1 changed files with 13 additions and 11 deletions

View File

@ -27,6 +27,7 @@ import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
@ -86,7 +87,7 @@ public class MQuery implements Serializable
SQL = "SELECT ip.ParameterName,ip.P_String,ip.P_String_To," // 1..3
+ "ip.P_Number,ip.P_Number_To," // 4..5
+ "ip.P_Date,ip.P_Date_To, ip.Info,ip.Info_To, " // 6..9
+ "pp.Name, pp.IsRange " // 10..11
+ "pp.Name, pp.IsRange, pp.AD_Reference_ID " // 10..12
+ "FROM AD_PInstance_Para ip, AD_PInstance i, AD_Process_Para pp "
+ "WHERE i.AD_PInstance_ID=ip.AD_PInstance_ID"
+ " AND pp.AD_Process_ID=i.AD_Process_ID"
@ -97,7 +98,7 @@ public class MQuery implements Serializable
else
SQL = "SELECT ip.ParameterName,ip.P_String,ip.P_String_To, ip.P_Number,ip.P_Number_To,"
+ "ip.P_Date,ip.P_Date_To, ip.Info,ip.Info_To, "
+ "ppt.Name, pp.IsRange "
+ "ppt.Name, pp.IsRange, pp.AD_Reference_ID "
+ "FROM AD_PInstance_Para ip, AD_PInstance i, AD_Process_Para pp, AD_Process_Para_Trl ppt "
+ "WHERE i.AD_PInstance_ID=ip.AD_PInstance_ID"
+ " AND pp.AD_Process_ID=i.AD_Process_ID"
@ -146,6 +147,8 @@ public class MQuery implements Serializable
String Name = rs.getString(10);
boolean isRange = "Y".equals(rs.getString(11));
//
int Reference_ID = rs.getInt(12);
//
if (s_log.isLoggable(Level.FINE)) s_log.fine(ParameterName + " S=" + P_String + "-" + P_String_To
+ ", N=" + P_Number + "-" + P_Number_To + ", D=" + P_Date + "-" + P_Date_To
+ "; Name=" + Name + ", Info=" + Info + "-" + Info_To + ", Range=" + isRange);
@ -199,23 +202,22 @@ public class MQuery implements Serializable
// Date
else if (P_Date != null || P_Date_To != null)
{
String paramName = (Reference_ID == DisplayType.DateTime) ? ParameterName
: "TRUNC(" + ParameterName + ")";
if (P_Date_To == null)
{
if (isRange)
query.addRestriction("TRUNC("+ParameterName+")", MQuery.GREATER_EQUAL,
P_Date, Name, Info);
query.addRestriction(paramName, MQuery.GREATER_EQUAL, P_Date, Name, Info);
else
query.addRestriction("TRUNC("+ParameterName+")", MQuery.EQUAL,
P_Date, Name, Info);
query.addRestriction(paramName, MQuery.EQUAL, P_Date, Name, Info);
}
else // P_Date_To != null
else // P_Date_To != null
{
if (P_Date == null)
query.addRestriction("TRUNC("+ParameterName+")", MQuery.LESS_EQUAL,
P_Date_To, Name, Info);
query.addRestriction(paramName, MQuery.LESS_EQUAL, P_Date_To, Name, Info);
else
query.addRangeRestriction("TRUNC("+ParameterName+")",
P_Date, P_Date_To, Name, Info, Info_To);
query.addRangeRestriction(paramName, P_Date, P_Date_To, Name, Info, Info_To);
}
}
}