From 6a1aff8d61156626947c5fc0969f526acb180274 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 5 May 2009 10:24:59 +0000 Subject: [PATCH] Missing translation https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2787097&group_id=176962 --- .../exceptions/BPartnerException.java | 50 +++++++++++++++++++ .../BPartnerNoAddressException.java | 39 +++++++++++++++ .../BPartnerNoBillToAddressException.java | 34 +++++++++++++ .../BPartnerNoShipToAddressException.java | 34 +++++++++++++ base/src/org/compiere/model/MInvoice.java | 3 +- base/src/org/compiere/model/MOrder.java | 11 ++-- .../461_BF2787097_BPartner_Exceptions.sql | 45 +++++++++++++++++ .../461_BF2787097_BPartner_Exceptions.sql | 45 +++++++++++++++++ 8 files changed, 254 insertions(+), 7 deletions(-) create mode 100644 base/src/org/adempiere/exceptions/BPartnerException.java create mode 100644 base/src/org/adempiere/exceptions/BPartnerNoAddressException.java create mode 100644 base/src/org/adempiere/exceptions/BPartnerNoBillToAddressException.java create mode 100644 base/src/org/adempiere/exceptions/BPartnerNoShipToAddressException.java create mode 100644 migration/353a-trunk/oracle/461_BF2787097_BPartner_Exceptions.sql create mode 100644 migration/353a-trunk/postgresql/461_BF2787097_BPartner_Exceptions.sql diff --git a/base/src/org/adempiere/exceptions/BPartnerException.java b/base/src/org/adempiere/exceptions/BPartnerException.java new file mode 100644 index 0000000000..b504c9e112 --- /dev/null +++ b/base/src/org/adempiere/exceptions/BPartnerException.java @@ -0,0 +1,50 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.exceptions; + +import org.compiere.model.I_C_BPartner; + +/** + * Thrown when an exception related to a BPartner happened. + * @author Teo Sarca, www.arhipac.ro + */ +public abstract class BPartnerException extends AdempiereException +{ + /** + * + */ + private static final long serialVersionUID = -4311798678799373821L; + private final int C_BPartner_ID; + + BPartnerException(String message, I_C_BPartner bp) + { + super(message+" - "+(bp == null ? "?" : bp.getValue()+"_"+bp.getName())); + if (bp != null) + { + this.C_BPartner_ID = bp.getC_BPartner_ID(); + } + else + { + this.C_BPartner_ID = -1; + } + } + + /** + * @return the c_BPartner_ID + */ + public int getC_BPartner_ID() + { + return C_BPartner_ID; + } +} diff --git a/base/src/org/adempiere/exceptions/BPartnerNoAddressException.java b/base/src/org/adempiere/exceptions/BPartnerNoAddressException.java new file mode 100644 index 0000000000..79f6ab089c --- /dev/null +++ b/base/src/org/adempiere/exceptions/BPartnerNoAddressException.java @@ -0,0 +1,39 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.exceptions; + +import org.compiere.model.I_C_BPartner; + +/** + * Thrown when an location/address is required for a BPartner but not found. + * @author Teo Sarca, www.arhipac.ro + */ +public class BPartnerNoAddressException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = -1892858395845764918L; + public static final String AD_Message = "BPartnerNoAddress"; + + /** + * @param message + * @param bp + */ + public BPartnerNoAddressException(I_C_BPartner bp) + { + super(AD_Message, bp); + } + +} diff --git a/base/src/org/adempiere/exceptions/BPartnerNoBillToAddressException.java b/base/src/org/adempiere/exceptions/BPartnerNoBillToAddressException.java new file mode 100644 index 0000000000..14bdeab0a5 --- /dev/null +++ b/base/src/org/adempiere/exceptions/BPartnerNoBillToAddressException.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.exceptions; + +import org.compiere.model.I_C_BPartner; + +/** + * Thrown when Bill To Address is required for a BPartner but not found. + * @author Teo Sarca, www.arhipac.ro + */ +public class BPartnerNoBillToAddressException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = -8423260338845096466L; + public static final String AD_Message = "BPartnerNoBillToAddress"; + + public BPartnerNoBillToAddressException(I_C_BPartner bp) + { + super(AD_Message, bp); + } +} diff --git a/base/src/org/adempiere/exceptions/BPartnerNoShipToAddressException.java b/base/src/org/adempiere/exceptions/BPartnerNoShipToAddressException.java new file mode 100644 index 0000000000..a5fe03bbd9 --- /dev/null +++ b/base/src/org/adempiere/exceptions/BPartnerNoShipToAddressException.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 2009 SC ARHIPAC SERVICE SRL. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.exceptions; + +import org.compiere.model.I_C_BPartner; + +/** + * Thrown when Ship To Address is required for a BPartner but not found. + * @author Teo Sarca, www.arhipac.ro + */ +public class BPartnerNoShipToAddressException extends BPartnerException +{ + /** + * + */ + private static final long serialVersionUID = 4388496060894704270L; + public static final String AD_Message = "BPartnerNoShipToAddress"; + + public BPartnerNoShipToAddressException(I_C_BPartner bp) + { + super(AD_Message, bp); + } +} diff --git a/base/src/org/compiere/model/MInvoice.java b/base/src/org/compiere/model/MInvoice.java index ab8aff1a2d..a2b5e616c7 100644 --- a/base/src/org/compiere/model/MInvoice.java +++ b/base/src/org/compiere/model/MInvoice.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.BPartnerNoAddressException; import org.adempiere.exceptions.DBException; import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; @@ -405,7 +406,7 @@ public class MInvoice extends X_C_Invoice implements DocAction setC_BPartner_Location_ID(locs[0].getC_BPartner_Location_ID()); } if (getC_BPartner_Location_ID() == 0) - log.log(Level.SEVERE, "Has no To Address: " + bp); + log.log(Level.SEVERE, new BPartnerNoAddressException(bp).getLocalizedMessage()); //TODO: throw exception? // Set Contact MUser[] contacts = bp.getContacts(false); diff --git a/base/src/org/compiere/model/MOrder.java b/base/src/org/compiere/model/MOrder.java index 7a07270f81..9eda779cb7 100644 --- a/base/src/org/compiere/model/MOrder.java +++ b/base/src/org/compiere/model/MOrder.java @@ -26,7 +26,8 @@ import java.util.Properties; import java.util.logging.Level; import java.util.regex.Pattern; -import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.BPartnerNoBillToAddressException; +import org.adempiere.exceptions.BPartnerNoShipToAddressException; import org.adempiere.exceptions.FillMandatoryException; import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; @@ -477,14 +478,12 @@ public class MOrder extends X_C_Order implements DocAction } if (getC_BPartner_Location_ID() == 0) { - log.log(Level.SEVERE, "MOrder.setBPartner - Has no Ship To Address: " + bp); - throw new AdempiereException("MOrder.setBPartner - Has no Ship To Address: "+bp); + throw new BPartnerNoShipToAddressException(bp); } if (getBill_Location_ID() == 0) - { - log.log(Level.SEVERE, "MOrder.setBPartner - Has no Bill To Address: " + bp); - throw new AdempiereException("MOrder.setBPartner - Has no Bill To Address: "+bp); + { + throw new BPartnerNoBillToAddressException(bp); } // Set Contact diff --git a/migration/353a-trunk/oracle/461_BF2787097_BPartner_Exceptions.sql b/migration/353a-trunk/oracle/461_BF2787097_BPartner_Exceptions.sql new file mode 100644 index 0000000000..e04a9aceb9 --- /dev/null +++ b/migration/353a-trunk/oracle/461_BF2787097_BPartner_Exceptions.sql @@ -0,0 +1,45 @@ +-- 05.05.2009 12:30:29 EEST +-- - +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Ship To Address',0,'Y',TO_DATE('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoShipToAddress',53056) +; + +-- 05.05.2009 12:30:29 EEST +-- - +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53056 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- 05.05.2009 12:31:21 EEST +-- - +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de expeditie',Updated=TO_DATE('2009-05-05 12:31:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53056 AND AD_Language='ro_RO' +; + +-- 05.05.2009 12:32:08 EEST +-- - +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Bill To Address',0,'Y',TO_DATE('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoBillToAddress',53057) +; + +-- 05.05.2009 12:32:08 EEST +-- - +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53057 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- 05.05.2009 12:32:27 EEST +-- - +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de facturare',Updated=TO_DATE('2009-05-05 12:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53057 AND AD_Language='ro_RO' +; + +-- 05.05.2009 12:48:47 EEST +-- - +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Address',0,'Y',TO_DATE('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoAddress',53058) +; + +-- 05.05.2009 12:48:47 EEST +-- - +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53058 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- 05.05.2009 12:49:10 EEST +-- - +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are nici o locatie definita',Updated=TO_DATE('2009-05-05 12:49:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53058 AND AD_Language='ro_RO' +; + diff --git a/migration/353a-trunk/postgresql/461_BF2787097_BPartner_Exceptions.sql b/migration/353a-trunk/postgresql/461_BF2787097_BPartner_Exceptions.sql new file mode 100644 index 0000000000..abf61d48c2 --- /dev/null +++ b/migration/353a-trunk/postgresql/461_BF2787097_BPartner_Exceptions.sql @@ -0,0 +1,45 @@ +-- 05.05.2009 12:30:29 EEST +-- - +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Ship To Address',0,'Y',TO_TIMESTAMP('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-05 12:30:26','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoShipToAddress',53056) +; + +-- 05.05.2009 12:30:29 EEST +-- - +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53056 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- 05.05.2009 12:31:21 EEST +-- - +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de expeditie',Updated=TO_TIMESTAMP('2009-05-05 12:31:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53056 AND AD_Language='ro_RO' +; + +-- 05.05.2009 12:32:08 EEST +-- - +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Bill To Address',0,'Y',TO_TIMESTAMP('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-05 12:32:00','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoBillToAddress',53057) +; + +-- 05.05.2009 12:32:08 EEST +-- - +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53057 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- 05.05.2009 12:32:27 EEST +-- - +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are definita adresa de facturare',Updated=TO_TIMESTAMP('2009-05-05 12:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53057 AND AD_Language='ro_RO' +; + +-- 05.05.2009 12:48:47 EEST +-- - +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('E','Business Partner has no Address',0,'Y',TO_TIMESTAMP('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-05-05 12:48:42','YYYY-MM-DD HH24:MI:SS'),0,0,0,'D','BPartnerNoAddress',53058) +; + +-- 05.05.2009 12:48:47 EEST +-- - +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53058 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- 05.05.2009 12:49:10 EEST +-- - +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Partenerul nu are nici o locatie definita',Updated=TO_TIMESTAMP('2009-05-05 12:49:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53058 AND AD_Language='ro_RO' +; +