From 6217046c4dfa9e140b1cffe6b683dcfe636034b9 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 20 Jan 2016 14:55:05 +0100 Subject: [PATCH] IDEMPIERE-2985 Recurring : implement Payment --- .../oracle/201512231444_IDEMPIERE-2985.sql | 10 ++++++++++ .../201512231444_IDEMPIERE-2985.sql | 7 +++++++ .../src/org/compiere/model/MRecurring.java | 20 +++++++++++++++++++ .../src/org/compiere/model/X_C_Recurring.java | 4 +++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql create mode 100644 migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql diff --git a/migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql b/migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql new file mode 100644 index 0000000000..816a619394 --- /dev/null +++ b/migration/i3.1/oracle/201512231444_IDEMPIERE-2985.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2985 : Recurring : implement Payment +-- Dec 23, 2015 2:43:32 PM CET +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200345,'Payment',282,'P',0,0,'Y',TO_DATE('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,'D','b3e77f8d-0d0d-4bf5-bb42-d998fb0c728c') +; + +SELECT register_migration_script('201512231444_IDEMPIERE-2985.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql b/migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql new file mode 100644 index 0000000000..4ecac66161 --- /dev/null +++ b/migration/i3.1/postgresql/201512231444_IDEMPIERE-2985.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-2985 : Recurring : implement Payment +-- Dec 23, 2015 2:43:32 PM CET +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200345,'Payment',282,'P',0,0,'Y',TO_TIMESTAMP('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-12-23 14:43:31','YYYY-MM-DD HH24:MI:SS'),100,'D','b3e77f8d-0d0d-4bf5-bb42-d998fb0c728c') +; + +SELECT register_migration_script('201512231444_IDEMPIERE-2985.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MRecurring.java b/org.adempiere.base/src/org/compiere/model/MRecurring.java index 1c4e1f14b4..9c22649641 100644 --- a/org.adempiere.base/src/org/compiere/model/MRecurring.java +++ b/org.adempiere.base/src/org/compiere/model/MRecurring.java @@ -128,6 +128,26 @@ public class MRecurring extends X_C_Recurring msg += journal.getDocumentNo(); setLastPO(journal); } + else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Payment)) + { + MPayment from = new MPayment(getCtx(), getC_Payment_ID(), get_TrxName()); + MPayment to = new MPayment(getCtx(), 0, get_TrxName()); + copyValues(from, to); + to.setAD_Org_ID(from.getAD_Org_ID()); + to.setIsReconciled(false); // can't be already on a bank statement + to.setDateAcct(dateDoc); + to.setDateTrx(dateDoc); + to.setDocumentNo(""); + to.setProcessed(false); + to.setPosted(false); + to.setDocStatus(MPayment.DOCSTATUS_Drafted); + to.setDocAction(MPayment.DOCACTION_Complete); + to.saveEx(); + + run.setC_Payment_ID(to.getC_Payment_ID()); + msg += to.getDocumentNo(); + setLastPO(to); + } else return "Invalid @RecurringType@ = " + getRecurringType(); run.saveEx(get_TrxName()); diff --git a/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java b/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java index 676bb50079..d63b05af91 100644 --- a/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java +++ b/org.adempiere.base/src/org/compiere/model/X_C_Recurring.java @@ -31,7 +31,7 @@ public class X_C_Recurring extends PO implements I_C_Recurring, I_Persistent /** * */ - private static final long serialVersionUID = 20151030L; + private static final long serialVersionUID = 20151223L; /** Standard Constructor */ public X_C_Recurring (Properties ctx, int C_Recurring_ID, String trxName) @@ -452,6 +452,8 @@ public class X_C_Recurring extends PO implements I_C_Recurring, I_Persistent public static final String RECURRINGTYPE_GLJournal = "G"; /** Project = J */ public static final String RECURRINGTYPE_Project = "J"; + /** Payment = P */ + public static final String RECURRINGTYPE_Payment = "P"; /** Set Recurring Type. @param RecurringType Type of Recurring Document