From 2238b7d7370b94b15a30395c97cff1ad7a137bcb Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Fri, 1 Feb 2013 11:57:45 +0800 Subject: [PATCH 1/2] IDEMPIERE-60 - Bizidium must not save credit card number --- .../src/org/compiere/model/MBPBankAccount.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java b/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java index e82db3abab..008cd4f932 100644 --- a/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java +++ b/org.adempiere.base/src/org/compiere/model/MBPBankAccount.java @@ -180,9 +180,20 @@ public class MBPBankAccount extends X_C_BP_BankAccount // maintain routing on bank level if (isACH() && getBank() != null) setRoutingNo(null); - // + // + if (getCreditCardNumber() != null) + { + String encrpytedCCNo = PaymentUtil.encrpytCreditCard(getCreditCardNumber()); + if (!encrpytedCCNo.equals(getCreditCardNumber())) + setCreditCardNumber(encrpytedCCNo); + } + if (getCreditCardVV() != null) - setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV())); + { + String encrpytedCvv = PaymentUtil.encrpytCvv(getCreditCardVV()); + if (!encrpytedCvv.equals(getCreditCardVV())) + setCreditCardVV(encrpytedCvv); + } return true; } // beforeSave From ee18c0a27bd972e50b03a6ad9a54fe51001c1a44 Mon Sep 17 00:00:00 2001 From: Elaine Tan Date: Mon, 4 Feb 2013 14:16:02 +0800 Subject: [PATCH 2/2] Fix the version of install package --- .../plugin/utils/AdempiereActivator.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AdempiereActivator.java b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AdempiereActivator.java index 5566639762..fea64d8fde 100644 --- a/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AdempiereActivator.java +++ b/org.adempiere.plugin.utils/src/org/adempiere/plugin/utils/AdempiereActivator.java @@ -48,19 +48,43 @@ public class AdempiereActivator implements BundleActivator { private void installPackage() { String trxName = Trx.createTrxName(); try { - String where = "Name=? AND PK_Version=?"; + + // e.g. 1.0.0.qualifier, check only the "1.0.0" part + String version = getVersion(); + if (version != null) + { + int count = 0; + int index = -1; + for(int i = 0; i < version.length(); i++) + { + if(version.charAt(i) == '.') + count++; + + if (count == 3) + { + index = i; + break; + } + } + + if (index == -1) + index = version.length(); + version = version.substring(0, index); + } + + String where = "Name=? AND PK_Version LIKE ?"; Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name, where.toString(), trxName); - q.setParameters(new Object[] { getName(), getVersion() }); + q.setParameters(new Object[] { getName(), version + "%" }); X_AD_Package_Imp pkg = q.first(); if (pkg == null) { packIn(trxName); install(); if (logger.isLoggable(Level.INFO)) - logger.info(getName() + " " + getVersion() + " installed."); + logger.info(getName() + " " + version + " installed."); } else { if (logger.isLoggable(Level.INFO)) - logger.info(getName() + " " + getVersion() + " was installed: " + logger.info(getName() + " " + version + " was installed: " + pkg.getCreated()); } Trx.get(trxName, false).commit();