From 4c22d862be774eba88063ef6def8f38072419dcb Mon Sep 17 00:00:00 2001 From: Diego Ruiz <12065321+d-ruiz@users.noreply.github.com> Date: Sat, 9 May 2020 15:40:27 +0200 Subject: [PATCH] IDEMPIERE-1376 Error message not translated in Validate Business Partner (#45) --- .../i7.1z/oracle/202005091335_IDEMPIERE-1376.sql.sql | 10 ++++++++++ .../postgresql/202005091335_IDEMPIERE-1376.sql.sql | 10 ++++++++++ .../src/org/compiere/process/BPartnerOrgLink.java | 3 ++- .../src/org/compiere/process/BPartnerOrgUnLink.java | 4 +++- .../src/org/compiere/process/BPartnerValidate.java | 4 ++-- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 migration/i7.1z/oracle/202005091335_IDEMPIERE-1376.sql.sql create mode 100644 migration/i7.1z/postgresql/202005091335_IDEMPIERE-1376.sql.sql diff --git a/migration/i7.1z/oracle/202005091335_IDEMPIERE-1376.sql.sql b/migration/i7.1z/oracle/202005091335_IDEMPIERE-1376.sql.sql new file mode 100644 index 0000000000..54218bb255 --- /dev/null +++ b/migration/i7.1z/oracle/202005091335_IDEMPIERE-1376.sql.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1376 Error message not translated in Validate Business Partner +-- May 9, 2020, 1:29:48 PM CEST +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 ('E','No Business Partner/Group selected',0,0,'Y',TO_DATE('2020-05-09 13:29:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-09 13:29:48','YYYY-MM-DD HH24:MI:SS'),100,200613,'BPartnerGroupNotSelected','D','83b41219-8ef2-4a58-87f0-bca896cdb8f8') +; + +SELECT register_migration_script('202005091335_IDEMPIERE-1376.sql') FROM dual +; diff --git a/migration/i7.1z/postgresql/202005091335_IDEMPIERE-1376.sql.sql b/migration/i7.1z/postgresql/202005091335_IDEMPIERE-1376.sql.sql new file mode 100644 index 0000000000..54218bb255 --- /dev/null +++ b/migration/i7.1z/postgresql/202005091335_IDEMPIERE-1376.sql.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1376 Error message not translated in Validate Business Partner +-- May 9, 2020, 1:29:48 PM CEST +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 ('E','No Business Partner/Group selected',0,0,'Y',TO_DATE('2020-05-09 13:29:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-05-09 13:29:48','YYYY-MM-DD HH24:MI:SS'),100,200613,'BPartnerGroupNotSelected','D','83b41219-8ef2-4a58-87f0-bca896cdb8f8') +; + +SELECT register_migration_script('202005091335_IDEMPIERE-1376.sql') FROM dual +; diff --git a/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgLink.java b/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgLink.java index b9e59240f5..5b894757db 100644 --- a/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgLink.java +++ b/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgLink.java @@ -27,6 +27,7 @@ import org.compiere.model.MRole; import org.compiere.model.MRoleOrgAccess; import org.compiere.model.MWarehouse; import org.compiere.util.AdempiereUserError; +import org.compiere.util.Msg; /** * Link Business Partner to Organization. @@ -85,7 +86,7 @@ public class BPartnerOrgLink extends SvrProcess throw new AdempiereUserError ("No Business Partner ID"); MBPartner bp = new MBPartner (getCtx(), p_C_BPartner_ID, get_TrxName()); if (bp.get_ID() == 0) - throw new AdempiereUserError ("Business Partner not found - C_BPartner_ID=" + p_C_BPartner_ID); + throw new AdempiereUserError (Msg.getMsg(getCtx(), "BPartnerNotFound") + " - C_BPartner_ID=" + p_C_BPartner_ID); // BP Location MBPartnerLocation[] locs = bp.getLocations(false); if (locs == null || locs.length == 0) diff --git a/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgUnLink.java b/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgUnLink.java index a422612e5e..497063b76a 100644 --- a/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgUnLink.java +++ b/org.adempiere.base.process/src/org/compiere/process/BPartnerOrgUnLink.java @@ -20,6 +20,8 @@ import java.math.BigDecimal; import java.util.logging.Level; import org.compiere.model.MBPartner; +import org.compiere.util.AdempiereUserError; +import org.compiere.util.Msg; /** * UnLink Business Partner from Organization @@ -62,7 +64,7 @@ public class BPartnerOrgUnLink extends SvrProcess throw new IllegalArgumentException ("No Business Partner ID"); MBPartner bp = new MBPartner (getCtx(), p_C_BPartner_ID, get_TrxName()); if (bp.get_ID() == 0) - throw new IllegalArgumentException ("Business Partner not found - C_BPartner_ID=" + p_C_BPartner_ID); + throw new AdempiereUserError (Msg.getMsg(getCtx(), "BPartnerNotFound") + " - C_BPartner_ID=" + p_C_BPartner_ID); // if (bp.getAD_OrgBP_ID() == 0) throw new IllegalArgumentException ("Business Partner not linked to an Organization"); diff --git a/org.adempiere.base.process/src/org/compiere/process/BPartnerValidate.java b/org.adempiere.base.process/src/org/compiere/process/BPartnerValidate.java index 67b7b2b71b..5bb9627b6c 100644 --- a/org.adempiere.base.process/src/org/compiere/process/BPartnerValidate.java +++ b/org.adempiere.base.process/src/org/compiere/process/BPartnerValidate.java @@ -74,13 +74,13 @@ public class BPartnerValidate extends SvrProcess { if (log.isLoggable(Level.INFO)) log.info("C_BPartner_ID=" + p_C_BPartner_ID + ", C_BP_Group_ID=" + p_C_BP_Group_ID); if (p_C_BPartner_ID == 0 && p_C_BP_Group_ID == 0) - throw new AdempiereUserError ("No Business Partner/Group selected"); + throw new AdempiereUserError (Msg.getMsg(getCtx(), "BPartnerGroupNotSelected")); if (p_C_BP_Group_ID == 0) { MBPartner bp = new MBPartner (getCtx(), p_C_BPartner_ID, get_TrxName()); if (bp.get_ID() == 0) - throw new AdempiereUserError ("Business Partner not found - C_BPartner_ID=" + p_C_BPartner_ID); + throw new AdempiereUserError (Msg.getMsg(getCtx(), "BPartnerNotFound") + " - C_BPartner_ID=" + p_C_BPartner_ID); checkBP (bp); } else