IDEMPIERE-1967 Bank transfer process should allow for document number to be optional / based on patch from Carlos Augusto Sanchez (caaugustoss)

This commit is contained in:
Carlos Ruiz 2014-05-27 10:25:58 -05:00
parent 269a20ae82
commit 8efef1cb7d
3 changed files with 26 additions and 5 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -26,6 +26,8 @@ import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess; import org.compiere.process.SvrProcess;
import org.compiere.util.AdempiereUserError; import org.compiere.util.AdempiereUserError;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
/** /**
* Bank Transfer. Generate two Payments entry * Bank Transfer. Generate two Payments entry
@ -98,12 +100,12 @@ public class BankTransfer extends SvrProcess
+ " - Description="+p_Description+ " - Statement Date="+p_StatementDate+ + " - Description="+p_Description+ " - Statement Date="+p_StatementDate+
" - Date Account="+p_DateAcct); " - 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) if (p_To_C_BankAccount_ID == 0 || p_From_C_BankAccount_ID == 0)
throw new IllegalArgumentException("Banks required"); 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) if (p_To_C_BankAccount_ID == p_From_C_BankAccount_ID)
throw new AdempiereUserError ("Banks From and To must be different"); 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()); MPayment paymentBankFrom = new MPayment(getCtx(), 0 , get_TrxName());
paymentBankFrom.setC_BankAccount_ID(mBankFrom.getC_BankAccount_ID()); 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.setDateAcct(p_DateAcct);
paymentBankFrom.setDateTrx(p_StatementDate); paymentBankFrom.setDateTrx(p_StatementDate);
paymentBankFrom.setTenderType(MPayment.TENDERTYPE_DirectDeposit); paymentBankFrom.setTenderType(MPayment.TENDERTYPE_DirectDeposit);
@ -171,7 +174,8 @@ public class BankTransfer extends SvrProcess
MPayment paymentBankTo = new MPayment(getCtx(), 0 , get_TrxName()); MPayment paymentBankTo = new MPayment(getCtx(), 0 , get_TrxName());
paymentBankTo.setC_BankAccount_ID(mBankTo.getC_BankAccount_ID()); 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.setDateAcct(p_DateAcct);
paymentBankTo.setDateTrx(p_StatementDate); paymentBankTo.setDateTrx(p_StatementDate);
paymentBankTo.setTenderType(MPayment.TENDERTYPE_DirectDeposit); paymentBankTo.setTenderType(MPayment.TENDERTYPE_DirectDeposit);