From 0ffcc794b32c365389a16e228a8715dfd472638f Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Sat, 30 Mar 2024 04:02:46 +0100 Subject: [PATCH] IDEMPIERE-6077: Translation of QueryMoreThanOneRecordsFound (#2282) https://idempiere.atlassian.net/browse/IDEMPIERE-6077 --- migration/iD11/oracle/202403291639_IDEMPIERE-6077.sql | 10 ++++++++++ .../iD11/postgresql/202403291639_IDEMPIERE-6077.sql | 7 +++++++ org.adempiere.base/src/org/compiere/model/Query.java | 7 ++++--- 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 migration/iD11/oracle/202403291639_IDEMPIERE-6077.sql create mode 100644 migration/iD11/postgresql/202403291639_IDEMPIERE-6077.sql diff --git a/migration/iD11/oracle/202403291639_IDEMPIERE-6077.sql b/migration/iD11/oracle/202403291639_IDEMPIERE-6077.sql new file mode 100644 index 0000000000..a44870e86a --- /dev/null +++ b/migration/iD11/oracle/202403291639_IDEMPIERE-6077.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-6077 +SELECT register_migration_script('202403291639_IDEMPIERE-6077.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 29, 2024, 4:39:08 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','The query returns more than one record',0,0,'Y',TO_TIMESTAMP('2024-03-29 16:39:08','YYYY-MM-DD HH24:MI:SS'),10,TO_TIMESTAMP('2024-03-29 16:39:08','YYYY-MM-DD HH24:MI:SS'),10,200880,'QueryMoreThanOneRecordsFound','D','f17d9113-2d74-4822-bfb2-21fa8db41021') +; + diff --git a/migration/iD11/postgresql/202403291639_IDEMPIERE-6077.sql b/migration/iD11/postgresql/202403291639_IDEMPIERE-6077.sql new file mode 100644 index 0000000000..505dbf4f6e --- /dev/null +++ b/migration/iD11/postgresql/202403291639_IDEMPIERE-6077.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-6077 +SELECT register_migration_script('202403291639_IDEMPIERE-6077.sql') FROM dual; + +-- Mar 29, 2024, 4:39:08 PM CET +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','The query returns more than one record',0,0,'Y',TO_TIMESTAMP('2024-03-29 16:39:08','YYYY-MM-DD HH24:MI:SS'),10,TO_TIMESTAMP('2024-03-29 16:39:08','YYYY-MM-DD HH24:MI:SS'),10,200880,'QueryMoreThanOneRecordsFound','D','f17d9113-2d74-4822-bfb2-21fa8db41021') +; + diff --git a/org.adempiere.base/src/org/compiere/model/Query.java b/org.adempiere.base/src/org/compiere/model/Query.java index 3c7c625b72..95749bed37 100644 --- a/org.adempiere.base/src/org/compiere/model/Query.java +++ b/org.adempiere.base/src/org/compiere/model/Query.java @@ -39,6 +39,7 @@ import org.adempiere.exceptions.DBException; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Msg; import org.compiere.util.Util; /** @@ -410,7 +411,7 @@ public class Query } if (rs.next()) { - throw new DBException("QueryMoreThanOneRecordsFound"); // TODO : translate + throw new DBException(Msg.getMsg(Env.getCtx(), "QueryMoreThanOneRecordsFound")); } } catch (SQLException e) @@ -483,7 +484,7 @@ public class Query } if (assumeOnlyOneResult && rs.next()) { - throw new DBException("QueryMoreThanOneRecordsFound"); // TODO : translate + throw new DBException(Msg.getMsg(Env.getCtx(), "QueryMoreThanOneRecordsFound")); } } catch (SQLException e) @@ -598,7 +599,7 @@ public class Query } if (rs.next()) { - throw new DBException("QueryMoreThanOneRecordsFound"); // TODO : translate + throw new DBException(Msg.getMsg(Env.getCtx(), "QueryMoreThanOneRecordsFound")); } } catch (SQLException e)