IDEMPIERE-5191 SEARCH FAILURE BY DATE AND HOUR / IDEMPIERE-4962 IDEMPIERE-4724 (#1188)

This commit is contained in:
Carlos Ruiz 2022-02-18 06:32:45 +01:00 committed by GitHub
parent adeaa0f1ed
commit bedf226a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 10 deletions

View File

@ -165,8 +165,12 @@ public class InventoryValue extends SvrProcess
// Update Constants
// YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format
String myDate = p_DateValue.toString();
sql = new StringBuilder ("UPDATE T_InventoryValue SET ")
.append("DateValue=TO_DATE('").append(myDate.substring(0,10))
sql = new StringBuilder ("UPDATE T_InventoryValue SET DateValue=");
if (DB.isPostgreSQL())
sql.append("TO_TIMESTAMP('");
else
sql.append("TO_DATE('");
sql.append(myDate.substring(0,10))
.append(" 23:59:59','YYYY-MM-DD HH24:MI:SS'),")
.append("M_PriceList_Version_ID=").append(p_M_PriceList_Version_ID).append(",")
.append("C_Currency_ID=").append(p_C_Currency_ID)

View File

@ -388,10 +388,14 @@ public final class ImpFormat
if (!concat) {
entry.append(row.getColumnName());
entry.append("=");
if (row.isString())
if (row.isString()) {
entry.append("'");
else if (row.isDate())
entry.append("TO_DATE('");
} else if (row.isDate()) {
if (DB.isPostgreSQL())
entry.append("TO_TIMESTAMP('");
else
entry.append("TO_DATE('");
}
}
}

View File

@ -434,19 +434,19 @@ public class DB_PostgreSQL implements AdempiereDatabase
* @param time Date to be converted
* @param dayOnly true if time set to 00:00:00
*
* @return TO_DATE('2001-01-30 18:10:20',''YYYY-MM-DD HH24:MI:SS')
* or TO_DATE('2001-01-30',''YYYY-MM-DD')
* @return TO_TIMESTAMP('2001-01-30 18:10:20',''YYYY-MM-DD HH24:MI:SS')
* or TO_TIMESTAMP('2001-01-30',''YYYY-MM-DD')
*/
public String TO_DATE (Timestamp time, boolean dayOnly)
{
if (time == null)
{
if (dayOnly)
return "current_date()";
return "current_date()";
return "current_date";
return "current_timestamp";
}
StringBuilder dateString = new StringBuilder("TO_DATE('");
StringBuilder dateString = new StringBuilder("TO_TIMESTAMP('");
// YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format
String myDate = time.toString();
if (dayOnly)