IDEMPIERE-2985 Recurring : implement Payment

This commit is contained in:
Nicolas Micoud 2016-01-20 14:55:05 +01:00
parent 3221fa3541
commit 6217046c4d
4 changed files with 40 additions and 1 deletions

View File

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

View File

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

View File

@ -128,6 +128,26 @@ public class MRecurring extends X_C_Recurring
msg += journal.getDocumentNo(); msg += journal.getDocumentNo();
setLastPO(journal); 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 else
return "Invalid @RecurringType@ = " + getRecurringType(); return "Invalid @RecurringType@ = " + getRecurringType();
run.saveEx(get_TrxName()); run.saveEx(get_TrxName());

View File

@ -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 */ /** Standard Constructor */
public X_C_Recurring (Properties ctx, int C_Recurring_ID, String trxName) 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"; public static final String RECURRINGTYPE_GLJournal = "G";
/** Project = J */ /** Project = J */
public static final String RECURRINGTYPE_Project = "J"; public static final String RECURRINGTYPE_Project = "J";
/** Payment = P */
public static final String RECURRINGTYPE_Payment = "P";
/** Set Recurring Type. /** Set Recurring Type.
@param RecurringType @param RecurringType
Type of Recurring Document Type of Recurring Document