From 7e632fe9a2256125ea2b0f1582930d07a1bfed13 Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Mon, 7 Nov 2016 18:20:58 +0100 Subject: [PATCH] IDEMPIERE-3240 Web services error when a parameter is range --- .../org/idempiere/adinterface/Process.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java index 21aecdf1c1..344359068f 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/Process.java @@ -514,7 +514,7 @@ public class Process { dataField = fmap.get( key+"_2" ); if (dataField != null && !Util.isEmpty(dataField.getVal())) { - valueString2 = dataField.toString(); + valueString2 = dataField.getVal(); if (requestCtx != null && valueString2.charAt(0) == '@') { Object value = ModelADServiceImpl.parseVariable(m_cs, requestCtx, iPara.getParameterName(), valueString2); @@ -598,12 +598,28 @@ public class Process { if (pPara.isRange()) { if (valueString2 != null && valueString2.length() > 0) { - if (displayType == DisplayType.DateTime) - d = m_cs.dateTimeFormat.parse(valueString2.toString()); - else if (displayType == DisplayType.Time) - d = m_cs.timeFormat.parse(valueString2.toString()); - else - d = m_cs.dateFormat.parse(valueString2.toString()); + if (displayType == DisplayType.DateTime) { + try { + d = m_cs.dateTimeFormatJDBC.parse(valueString2); + } catch (ParseException e) { + d = m_cs.dateTimeFormat.parse(valueString2); + } + } + else if (displayType == DisplayType.Time) { + try { + d = m_cs.timeFormatJDBC.parse(valueString2); + } catch (ParseException e) { + d = m_cs.timeFormat.parse(valueString2); + } + } + else { + try { + d = m_cs.dateFormatJDBC.parse(valueString2); + } catch (ParseException e) { + d = m_cs.dateFormat.parse(valueString2); + } + } + Timestamp ts = new Timestamp(d.getTime()); iPara.setP_Date_To(ts);