IDEMPIERE-1866 Via web services is not possible to send DateTime for Process
This commit is contained in:
parent
dc9f9ef963
commit
4dad044891
|
@ -15,7 +15,6 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -39,8 +38,6 @@ public class CompiereService {
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(CompiereService.class);
|
private static CLogger log = CLogger.getCLogger(CompiereService.class);
|
||||||
|
|
||||||
public final static String datePattern = "dd-MM-yyyy";
|
|
||||||
|
|
||||||
private Properties m_ctx;
|
private Properties m_ctx;
|
||||||
|
|
||||||
private int m_AD_Client_ID;
|
private int m_AD_Client_ID;
|
||||||
|
@ -56,31 +53,16 @@ public class CompiereService {
|
||||||
|
|
||||||
/** Localized Date format */
|
/** Localized Date format */
|
||||||
public SimpleDateFormat dateFormat = null;
|
public SimpleDateFormat dateFormat = null;
|
||||||
|
/** JDBC Date format */
|
||||||
|
public SimpleDateFormat dateFormatJDBC = null;
|
||||||
/** Localized Timestamp format */
|
/** Localized Timestamp format */
|
||||||
public SimpleDateFormat dateTimeFormat = null;
|
public SimpleDateFormat dateTimeFormat = null;
|
||||||
|
/** JDBC Timestamp format */
|
||||||
/** Localized Amount format */
|
public SimpleDateFormat dateTimeFormatJDBC = null;
|
||||||
public DecimalFormat amountFormat = null;
|
/** Localized Time format */
|
||||||
/** Localized Integer format */
|
public SimpleDateFormat timeFormat = null;
|
||||||
public DecimalFormat integerFormat = null;
|
/** JDBC Time format */
|
||||||
/** Localized Number format */
|
public SimpleDateFormat timeFormatJDBC = null;
|
||||||
public DecimalFormat numberFormat = null;
|
|
||||||
/** Localized Quantity format */
|
|
||||||
public DecimalFormat quantityFormat = null;
|
|
||||||
|
|
||||||
/** Localized Date format */
|
|
||||||
public SimpleDateFormat modelDateFormat = null;
|
|
||||||
/** Localized Timestamp format */
|
|
||||||
public SimpleDateFormat modelDateTimeFormat = null;
|
|
||||||
|
|
||||||
/** Localized Amount format */
|
|
||||||
public DecimalFormat modelAmountFormat = null;
|
|
||||||
/** Localized Integer format */
|
|
||||||
public DecimalFormat modelIntegerFormat = null;
|
|
||||||
/** Localized Number format */
|
|
||||||
public DecimalFormat modelNumberFormat = null;
|
|
||||||
/** Localized Quantity format */
|
|
||||||
public DecimalFormat modelQuantityFormat = null;
|
|
||||||
|
|
||||||
private Language m_language;
|
private Language m_language;
|
||||||
|
|
||||||
|
@ -137,17 +119,12 @@ public class CompiereService {
|
||||||
Env.setContext( m_ctx, "#AD_Language", "en_US" );
|
Env.setContext( m_ctx, "#AD_Language", "en_US" );
|
||||||
m_language = Language.getLanguage("en_US");
|
m_language = Language.getLanguage("en_US");
|
||||||
|
|
||||||
// These variables are needed for ADClient.exe
|
dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
|
||||||
Language m_lang2 = Language.getLanguage("pl_PL");
|
dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, m_language);
|
||||||
|
timeFormat = DisplayType.getDateFormat(DisplayType.Time, m_language);
|
||||||
|
dateFormatJDBC = DisplayType.getDateFormat_JDBC();
|
||||||
dateFormat = new SimpleDateFormat( datePattern );
|
dateTimeFormatJDBC = DisplayType.getTimestampFormat_Default();
|
||||||
dateTimeFormat = new SimpleDateFormat( datePattern );
|
timeFormatJDBC = DisplayType.getTimeFormat_Default();
|
||||||
|
|
||||||
amountFormat = DisplayType.getNumberFormat(DisplayType.Amount, m_lang2);
|
|
||||||
integerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_lang2);
|
|
||||||
numberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_lang2);
|
|
||||||
quantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_lang2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,13 +257,12 @@ public class CompiereService {
|
||||||
m_language = Language.getLanguage(Lang);
|
m_language = Language.getLanguage(Lang);
|
||||||
Env.verifyLanguage( getCtx(), m_language );
|
Env.verifyLanguage( getCtx(), m_language );
|
||||||
|
|
||||||
modelDateFormat = new SimpleDateFormat( datePattern );
|
dateFormat = DisplayType.getDateFormat(DisplayType.Date, m_language);
|
||||||
modelDateTimeFormat = new SimpleDateFormat( datePattern );
|
dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, m_language);
|
||||||
|
timeFormat = DisplayType.getDateFormat(DisplayType.Time, m_language);
|
||||||
modelAmountFormat = DisplayType.getNumberFormat(DisplayType.Amount, m_language);
|
dateFormatJDBC = DisplayType.getDateFormat_JDBC();
|
||||||
modelIntegerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_language);
|
dateTimeFormatJDBC = DisplayType.getTimestampFormat_Default();
|
||||||
modelNumberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_language);
|
timeFormatJDBC = DisplayType.getTimeFormat_Default();
|
||||||
modelQuantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_language);
|
|
||||||
|
|
||||||
// Set Date
|
// Set Date
|
||||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream;
|
||||||
import java.io.CharArrayWriter;
|
import java.io.CharArrayWriter;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -545,35 +546,50 @@ public class Process {
|
||||||
else if (DisplayType.isDate(displayType))
|
else if (DisplayType.isDate(displayType))
|
||||||
{
|
{
|
||||||
java.util.Date d;
|
java.util.Date d;
|
||||||
if (displayType == DisplayType.DateTime)
|
if (value.toString().length() > 0) {
|
||||||
|
if (displayType == DisplayType.DateTime) {
|
||||||
|
try {
|
||||||
|
d = m_cs.dateTimeFormatJDBC.parse(value.toString());
|
||||||
|
} catch (ParseException e) {
|
||||||
d = m_cs.dateTimeFormat.parse(value.toString());
|
d = m_cs.dateTimeFormat.parse(value.toString());
|
||||||
|
}
|
||||||
else
|
} else if (displayType == DisplayType.Time) {
|
||||||
|
try {
|
||||||
|
d = m_cs.timeFormatJDBC.parse(value.toString());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
d = m_cs.timeFormat.parse(value.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
d = m_cs.dateFormatJDBC.parse(value.toString());
|
||||||
|
} catch (ParseException e) {
|
||||||
d = m_cs.dateFormat.parse(value.toString());
|
d = m_cs.dateFormat.parse(value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timestamp ts = null;
|
Timestamp ts = new Timestamp(d.getTime());
|
||||||
ts = new Timestamp(d.getTime());
|
|
||||||
iPara.setP_Date(ts);
|
iPara.setP_Date(ts);
|
||||||
|
if (log.isLoggable(Level.FINE)) log.fine("fillParameter - " + key
|
||||||
|
+ " = " + valueString + " (=" + ts + "=)");
|
||||||
|
}
|
||||||
|
|
||||||
if (pPara.isRange())
|
if (pPara.isRange())
|
||||||
{
|
{
|
||||||
|
if (valueString2 != null && valueString2.length() > 0) {
|
||||||
if (displayType == DisplayType.DateTime)
|
if (displayType == DisplayType.DateTime)
|
||||||
d = m_cs.dateTimeFormat.parse(valueString2);
|
d = m_cs.dateTimeFormat.parse(valueString2.toString());
|
||||||
|
else if (displayType == DisplayType.Time)
|
||||||
|
d = m_cs.timeFormat.parse(valueString2.toString());
|
||||||
else
|
else
|
||||||
{
|
d = m_cs.dateFormat.parse(valueString2.toString());
|
||||||
if (valueString2 == null || valueString2.length() == 0)
|
|
||||||
d = new java.util.Date();
|
|
||||||
else
|
|
||||||
d = m_cs.dateFormat.parse(valueString2);
|
|
||||||
}
|
|
||||||
|
|
||||||
ts = new Timestamp(d.getTime());
|
Timestamp ts = new Timestamp(d.getTime());
|
||||||
iPara.setP_Date_To(ts);
|
iPara.setP_Date_To(ts);
|
||||||
|
if (log.isLoggable(Level.FINE)) log.fine("fillParameterTo - " + key
|
||||||
|
+ " = " + valueString + " (=" + ts + "=)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("fillParameter - " + key
|
|
||||||
+ " = " + valueString + " (=" + ts + "=)");
|
|
||||||
}
|
}
|
||||||
else if (DisplayType.YesNo == pPara.getAD_Reference_ID())
|
else if (DisplayType.YesNo == pPara.getAD_Reference_ID())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue