IDEMPIERE-1200 Check consistency of IBAN / peer review

This commit is contained in:
Carlos Ruiz 2017-02-17 21:15:45 +01:00
parent 04928f78b8
commit 98d73702f3
8 changed files with 17 additions and 18 deletions

View File

@ -3,8 +3,8 @@ SET DEFINE OFF
-- IBAN validation IDEMPIERE-1200
-- Jan 19, 2017 10:54:38 AM CET
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200086,0,0,TO_DATE('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','IBAN_VALIDATION','Y','Enables the validation of IBAN fields','D','S','1b324142-ae32-4cff-9ea9-792df3e4d142')
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200086,0,0,TO_DATE('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','IBAN_VALIDATION','Y','Enables the validation of IBAN fields','D','C','1b324142-ae32-4cff-9ea9-792df3e4d142')
;
SELECT register_migration_script('201701191158_IDEMPIERE-1200') FROM dual
;
SELECT register_migration_script('201701191158_IDEMPIERE-1200.sql') FROM dual
;

View File

@ -1,7 +1,7 @@
-- IBAN validation IDEMPIERE-1200
-- Jan 19, 2017 10:54:38 AM CET
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200086,0,0,TO_TIMESTAMP('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','IBAN_VALIDATION','Y','Enables the validation of IBAN fields','D','S','1b324142-ae32-4cff-9ea9-792df3e4d142')
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200086,0,0,TO_TIMESTAMP('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2017-01-19 10:54:37','YYYY-MM-DD HH24:MI:SS'),0,0,'Y','IBAN_VALIDATION','Y','Enables the validation of IBAN fields','D','C','1b324142-ae32-4cff-9ea9-792df3e4d142')
;
SELECT register_migration_script('201701191158_IDEMPIERE-1200') FROM dual
;
SELECT register_migration_script('201701191158_IDEMPIERE-1200.sql') FROM dual
;

View File

@ -37,7 +37,7 @@ public class MBPBankAccount extends X_C_BP_BankAccount
/**
*
*/
private static final long serialVersionUID = 2580706419593695062L;
private static final long serialVersionUID = 6826961806519015878L;
/**
* Get Accounts Of BPartner
@ -210,8 +210,7 @@ public class MBPBankAccount extends X_C_BP_BankAccount
setCreditCardVV(encrpytedCvv);
}
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, false,
Env.getContextAsInt(Env.getCtx(), "#AD_Client_ID"))) {
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, true, Env.getAD_Client_ID(Env.getCtx()))) {
if (!Util.isEmpty(getIBAN())) {
setIBAN(IBAN.normalizeIBAN(getIBAN()));
if (!IBAN.isCheckDigitValid(getIBAN())) {
@ -220,7 +219,7 @@ public class MBPBankAccount extends X_C_BP_BankAccount
}
}
}
return true;
} // beforeSave

View File

@ -36,7 +36,7 @@ public class MBankAccount extends X_C_BankAccount
/**
*
*/
private static final long serialVersionUID = 2392818253347168347L;
private static final long serialVersionUID = -110709935374907275L;
/**
* Get BankAccount from Cache
@ -132,8 +132,7 @@ public class MBankAccount extends X_C_BankAccount
protected boolean beforeSave(boolean newRecord) {
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, false,
Env.getContextAsInt(Env.getCtx(), "#AD_Client_ID"))) {
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, true, Env.getAD_Client_ID(Env.getCtx()))) {
if (!Util.isEmpty(getIBAN())) {
setIBAN(IBAN.normalizeIBAN(getIBAN()));
if (!IBAN.isCheckDigitValid(getIBAN())) {

View File

@ -798,8 +798,7 @@ public class MPayment extends X_C_Payment
}
}
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, false,
Env.getContextAsInt(Env.getCtx(), "#AD_Client_ID"))) {
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, true, Env.getAD_Client_ID(Env.getCtx()))) {
if (!Util.isEmpty(getIBAN())) {
setIBAN(IBAN.normalizeIBAN(getIBAN()));
if (!IBAN.isCheckDigitValid(getIBAN())) {

View File

@ -83,8 +83,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
setCreditCardVV(encrpytedCvv);
}
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, false,
Env.getContextAsInt(Env.getCtx(), "#AD_Client_ID"))) {
if (MSysConfig.getBooleanValue(MSysConfig.IBAN_VALIDATION, true, Env.getAD_Client_ID(Env.getCtx()))) {
if (!Util.isEmpty(getIBAN())) {
setIBAN(IBAN.normalizeIBAN(getIBAN()));
if (!IBAN.isCheckDigitValid(getIBAN())) {

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 6862004813052785789L;
private static final long serialVersionUID = -3599797130058840418L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";

View File

@ -1,3 +1,6 @@
// adapted from http://how-blogz.blogspot.de/2007/08/java-iban-check-digit-validation.html
// soastation.banking.IBAN
package org.compiere.util;
import java.math.BigInteger;