From 7ca98829515c47a1c95fa6851a107938846c3114 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Wed, 4 Feb 2009 22:18:24 +0000 Subject: [PATCH] FR [ 1776045 ] Add ReActivate action to GL Journal https://sourceforge.net/tracker/?func=detail&atid=879335&aid=1776045&group_id=176962 --- base/src/org/compiere/model/MJournal.java | 17 +++++++++-- .../src/org/compiere/model/MJournalBatch.java | 29 ++++++++++++++++--- .../org/compiere/process/DocumentEngine.java | 1 + 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/base/src/org/compiere/model/MJournal.java b/base/src/org/compiere/model/MJournal.java index 4d47feae34..ff2b9e6135 100644 --- a/base/src/org/compiere/model/MJournal.java +++ b/base/src/org/compiere/model/MJournal.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * + * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * @@ -39,6 +39,7 @@ import org.compiere.util.Msg; * @author Teo Sarca, SC ARHIPAC SERVICE SRL *
  • BF [ 1619150 ] Usability/Consistency: reversed gl journal description *
  • BF [ 1775358 ] GL Journal DateAcct/C_Period_ID issue + *
  • FR [ 1776045 ] Add ReActivate action to GL Journal * @author victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com *
  • FR [ 1948157 ] Is necessary the reference for document reverse * @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1948157&group_id=176962 @@ -48,6 +49,11 @@ import org.compiere.util.Msg; */ public class MJournal extends X_GL_Journal implements DocAction { + /** + * + */ + private static final long serialVersionUID = 5461368562157627495L; + /** * Standard Constructor * @param ctx context @@ -754,12 +760,19 @@ public class MJournal extends X_GL_Journal implements DocAction if (m_processMsg != null) return false; + // teo_sarca - FR [ 1776045 ] Add ReActivate action to GL Journal + MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); + MFactAcct.deleteEx(MJournal.Table_ID, get_ID(), get_TrxName()); + setPosted(false); + setProcessed(false); + setDocAction(DOCACTION_Complete); + // After reActivate m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); if (m_processMsg != null) return false; - return false; + return true; } // reActivateIt diff --git a/base/src/org/compiere/model/MJournalBatch.java b/base/src/org/compiere/model/MJournalBatch.java index a397ce3767..697bd36919 100644 --- a/base/src/org/compiere/model/MJournalBatch.java +++ b/base/src/org/compiere/model/MJournalBatch.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * + * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; import org.compiere.util.DB; @@ -41,10 +42,17 @@ import org.compiere.util.Msg; * @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1948157&group_id=176962 *
  • FR [ 2520591 ] Support multiples calendar for Org * @see http://sourceforge.net/tracker2/?func=detail&atid=879335&aid=2520591&group_id=176962 + * @author Teo Sarca, www.arhipac.ro + *
  • FR [ 1776045 ] Add ReActivate action to GL Journal * @version $Id: MJournalBatch.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ */ public class MJournalBatch extends X_GL_JournalBatch implements DocAction { + /** + * + */ + private static final long serialVersionUID = -2494833602067696046L; + /** * Create new Journal Batch by copying * @param ctx context @@ -738,9 +746,22 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction if (m_processMsg != null) return false; - // setProcessed(false); - if (! reverseCorrectIt()) - return false; + for (MJournal journal : getJournals(true)) + { + if (DOCSTATUS_Completed.equals(journal.getDocStatus())) + { + if (journal.processIt(DOCACTION_Re_Activate)) + { + journal.saveEx(); + } + else + { + throw new AdempiereException(journal.getProcessMsg()); + } + } + } + setProcessed(false); + setDocAction(DOCACTION_Complete); // After reActivate m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE); diff --git a/base/src/org/compiere/process/DocumentEngine.java b/base/src/org/compiere/process/DocumentEngine.java index 47b80aca84..ec40d6f17a 100644 --- a/base/src/org/compiere/process/DocumentEngine.java +++ b/base/src/org/compiere/process/DocumentEngine.java @@ -990,6 +990,7 @@ public class DocumentEngine implements DocAction { options[index++] = DocumentEngine.ACTION_Reverse_Correct; options[index++] = DocumentEngine.ACTION_Reverse_Accrual; + options[index++] = DocumentEngine.ACTION_ReActivate; } } /********************