IDEMPIERE-2954 Hardcoded messages when an error occurs on converting currencies in invoices / peer review

This commit is contained in:
Carlos Ruiz 2016-01-20 17:17:44 +01:00
parent 2d840a2f4d
commit 810128a020
6 changed files with 38 additions and 14 deletions

View File

@ -14,11 +14,11 @@ UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currenc
; ;
-- Jan 20, 2016 3:34:38 PM CET -- Jan 20, 2016 3:34:38 PM CET
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_DATE('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency')
; ;
-- Jan 20, 2016 3:35:50 PM CET -- Jan 20, 2016 3:35:50 PM CET
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency')
; ;
-- Jan 20, 2016 3:36:05 PM CET -- Jan 20, 2016 3:36:05 PM CET
@ -37,5 +37,17 @@ UPDATE AD_Message SET EntityType='D',Updated=TO_DATE('2016-01-20 15:36:20','YYYY
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency') INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_DATE('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency')
; ;
-- Jan 20, 2016 4:47:30 PM CET
UPDATE AD_Message SET MsgText='Could not convert currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_DATE('2016-01-20 16:47:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200394
;
-- Jan 20, 2016 4:47:33 PM CET
UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_DATE('2016-01-20 16:47:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200393
;
-- Jan 20, 2016 4:47:37 PM CET
UPDATE AD_Message SET MsgText='Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_DATE('2016-01-20 16:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200396
;
SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual
; ;

View File

@ -11,11 +11,11 @@ UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currenc
; ;
-- Jan 20, 2016 3:34:38 PM CET -- Jan 20, 2016 3:34:38 PM CET
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency') INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200394,'64dd01ce-7afb-4db6-8641-bd80f7248ecd',0,TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert currency {0} to base currency {1} - converstion type : {2} / Date : {3}','I',TO_TIMESTAMP('2016-01-20 15:34:37','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingCurrencyToBaseCurrency')
; ;
-- Jan 20, 2016 3:35:50 PM CET -- Jan 20, 2016 3:35:50 PM CET
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'U','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency') INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200395,'66d383a0-ad94-435c-ac96-f03903fcda59',0,TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert allocation currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:35:50','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingAllocationCurrencyToBaseCurrency')
; ;
-- Jan 20, 2016 3:36:05 PM CET -- Jan 20, 2016 3:36:05 PM CET
@ -34,5 +34,17 @@ UPDATE AD_Message SET EntityType='D',Updated=TO_TIMESTAMP('2016-01-20 15:36:20',
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency') INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Message_UU,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,200396,'449bfa95-a175-4862-98c2-525c6a564c60',0,TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3}','I',TO_TIMESTAMP('2016-01-20 15:36:59','YYYY-MM-DD HH24:MI:SS'),0,'ErrorConvertingInvoiceCurrencyToBaseCurrency')
; ;
-- Jan 20, 2016 4:47:30 PM CET
UPDATE AD_Message SET MsgText='Could not convert currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_TIMESTAMP('2016-01-20 16:47:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200394
;
-- Jan 20, 2016 4:47:33 PM CET
UPDATE AD_Message SET MsgText='Could not convert currency {0} to project currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_TIMESTAMP('2016-01-20 16:47:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200393
;
-- Jan 20, 2016 4:47:37 PM CET
UPDATE AD_Message SET MsgText='Could not convert invoice currency {0} to base currency {1} - conversion type : {2} / conversion date : {3,date,short}',Updated=TO_TIMESTAMP('2016-01-20 16:47:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200396
;
SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual SELECT register_migration_script('201601201427_IDEMPIERE-2954.sql') FROM dual
; ;

View File

@ -967,7 +967,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
if (amt == null) if (amt == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency",
getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName());
return false; return false;
} }
openBalanceDiff = openBalanceDiff.add(amt); openBalanceDiff = openBalanceDiff.add(amt);
@ -980,7 +980,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
if (amt == null) if (amt == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency",
getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName()); getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), convTypeID, paymentDate, get_TrxName());
return false; return false;
} }
openBalanceDiff = openBalanceDiff.add(amt); openBalanceDiff = openBalanceDiff.add(amt);
@ -992,7 +992,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
if (allocAmtBase == null) if (allocAmtBase == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency",
getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), convTypeID, getDateAcct(), get_TrxName()); getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), convTypeID, getDateAcct(), get_TrxName());
return false; return false;
} }
@ -1007,7 +1007,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
if (amt == null) if (amt == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingAllocationCurrencyToBaseCurrency",
getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName());
return false; return false;
} }
openBalanceDiff = openBalanceDiff.add(amt); openBalanceDiff = openBalanceDiff.add(amt);
@ -1034,7 +1034,7 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
if (invAmtAccted == null) if (invAmtAccted == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingInvoiceCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingInvoiceCurrencyToBaseCurrency",
getC_Currency_ID(), invoice.getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName()); invoice.getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), invoice.getC_ConversionType_ID(), invoice.getDateAcct(), get_TrxName());
return false; return false;
} }

View File

@ -107,7 +107,7 @@ public final class MConversionRateUtil
public static String getErrorMessage(Properties ctx, String adMessage, int currencyFromID, int currencyToID, int convertionTypeID, Timestamp date, String trxName) public static String getErrorMessage(Properties ctx, String adMessage, int currencyFromID, int currencyToID, int convertionTypeID, Timestamp date, String trxName)
{ {
String retValue = Msg.getMsg(ctx, adMessage, String retValue = Msg.getMsg(ctx, adMessage,
new Object[] {MCurrency.get(ctx, currencyFromID).getISO_Code(), MCurrency.get(ctx, currencyFromID).getISO_Code(), new MConversionType(ctx, convertionTypeID, trxName).getName(), date}); new Object[] {MCurrency.get(ctx, currencyFromID).getISO_Code(), MCurrency.get(ctx, currencyToID).getISO_Code(), new MConversionType(ctx, convertionTypeID, trxName).getName(), date});
return retValue; return retValue;
} }
} }

View File

@ -1898,7 +1898,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (invAmt == null) if (invAmt == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency",
getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName());
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Total Balance // Total Balance

View File

@ -1982,7 +1982,7 @@ public class MPayment extends X_C_Payment
if (payAmt == null) if (payAmt == null)
{ {
m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency", m_processMsg = MConversionRateUtil.getErrorMessage(getCtx(), "ErrorConvertingCurrencyToBaseCurrency",
getC_Currency_ID(), MClient.get(Env.getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName()); getC_Currency_ID(), MClient.get(getCtx()).getC_Currency_ID(), getC_ConversionType_ID(), getDateAcct(), get_TrxName());
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Total Balance // Total Balance