From 8efef1cb7d7b0fe7365a98715c4da4ed0384cf8c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 27 May 2014 10:25:58 -0500 Subject: [PATCH] IDEMPIERE-1967 Bank transfer process should allow for document number to be optional / based on patch from Carlos Augusto Sanchez (caaugustoss) --- .../i2.0/oracle/201405262306_IDEMPIERE-1967.sql | 10 ++++++++++ .../postgresql/201405262306_IDEMPIERE-1967.sql | 7 +++++++ .../src/org/eevolution/process/BankTransfer.java | 14 +++++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 migration/i2.0/oracle/201405262306_IDEMPIERE-1967.sql create mode 100644 migration/i2.0/postgresql/201405262306_IDEMPIERE-1967.sql diff --git a/migration/i2.0/oracle/201405262306_IDEMPIERE-1967.sql b/migration/i2.0/oracle/201405262306_IDEMPIERE-1967.sql new file mode 100644 index 0000000000..8bc80ae9ab --- /dev/null +++ b/migration/i2.0/oracle/201405262306_IDEMPIERE-1967.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 26, 2014 11:06:10 PM COT +-- IDEMPIERE-1967 Bank transfer process should allow for document number to be optional +UPDATE AD_Process_Para SET IsMandatory='N',Updated=TO_DATE('2014-05-26 22:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53251 +; + +SELECT register_migration_script('201405262306_IDEMPIERE-1967.sql') FROM dual +; diff --git a/migration/i2.0/postgresql/201405262306_IDEMPIERE-1967.sql b/migration/i2.0/postgresql/201405262306_IDEMPIERE-1967.sql new file mode 100644 index 0000000000..3029991ac2 --- /dev/null +++ b/migration/i2.0/postgresql/201405262306_IDEMPIERE-1967.sql @@ -0,0 +1,7 @@ +-- May 26, 2014 11:06:10 PM COT +-- IDEMPIERE-1967 Bank transfer process should allow for document number to be optional +UPDATE AD_Process_Para SET IsMandatory='N',Updated=TO_TIMESTAMP('2014-05-26 22:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53251 +; + +SELECT register_migration_script('201405262306_IDEMPIERE-1967.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/eevolution/process/BankTransfer.java b/org.adempiere.base/src/org/eevolution/process/BankTransfer.java index 15a7c416ba..fe3d20a235 100644 --- a/org.adempiere.base/src/org/eevolution/process/BankTransfer.java +++ b/org.adempiere.base/src/org/eevolution/process/BankTransfer.java @@ -26,6 +26,8 @@ import org.compiere.process.ProcessInfoParameter; import org.compiere.process.SvrProcess; import org.compiere.util.AdempiereUserError; import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; /** * Bank Transfer. Generate two Payments entry @@ -98,12 +100,12 @@ public class BankTransfer extends SvrProcess + " - Description="+p_Description+ " - Statement Date="+p_StatementDate+ " - Date Account="+p_DateAcct); + if (Env.getAD_Org_ID(getCtx()) == 0) + throw new AdempiereUserError(Msg.getMsg(getCtx(), "Org0NotAllowed")); + if (p_To_C_BankAccount_ID == 0 || p_From_C_BankAccount_ID == 0) throw new IllegalArgumentException("Banks required"); - if (p_DocumentNo == null || p_DocumentNo.length() == 0) - throw new IllegalArgumentException("Document No required"); - if (p_To_C_BankAccount_ID == p_From_C_BankAccount_ID) throw new AdempiereUserError ("Banks From and To must be different"); @@ -145,7 +147,8 @@ public class BankTransfer extends SvrProcess MPayment paymentBankFrom = new MPayment(getCtx(), 0 , get_TrxName()); paymentBankFrom.setC_BankAccount_ID(mBankFrom.getC_BankAccount_ID()); - paymentBankFrom.setDocumentNo(p_DocumentNo); + if (!Util.isEmpty(p_DocumentNo, true)) + paymentBankFrom.setDocumentNo(p_DocumentNo); paymentBankFrom.setDateAcct(p_DateAcct); paymentBankFrom.setDateTrx(p_StatementDate); paymentBankFrom.setTenderType(MPayment.TENDERTYPE_DirectDeposit); @@ -171,7 +174,8 @@ public class BankTransfer extends SvrProcess MPayment paymentBankTo = new MPayment(getCtx(), 0 , get_TrxName()); paymentBankTo.setC_BankAccount_ID(mBankTo.getC_BankAccount_ID()); - paymentBankTo.setDocumentNo(p_DocumentNo); + if (!Util.isEmpty(p_DocumentNo, true)) + paymentBankTo.setDocumentNo(p_DocumentNo); paymentBankTo.setDateAcct(p_DateAcct); paymentBankTo.setDateTrx(p_StatementDate); paymentBankTo.setTenderType(MPayment.TENDERTYPE_DirectDeposit);