Repository: incubator-fineract
Updated Branches:
  refs/heads/develop e444aca44 -> 1873db645


FINERACT-321 - Manual Journal entries should not allowed to reverse after 
accounting closure is done for that branch


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/5f744536
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/5f744536
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/5f744536

Branch: refs/heads/develop
Commit: 5f74453606db080ae96fafbd58b0a5df96b5362c
Parents: 8cc560c
Author: nazeer1100126 <nazeer.sh...@confluxtechnologies.com>
Authored: Fri Mar 17 17:49:05 2017 +0530
Committer: nazeer1100126 <nazeer.sh...@confluxtechnologies.com>
Committed: Fri Mar 17 17:49:05 2017 +0530

----------------------------------------------------------------------
 ...rnalEntryWritePlatformServiceJpaRepositoryImpl.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5f744536/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
index 207cdc9..b556014 100755
--- 
a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
@@ -325,6 +325,19 @@ public class 
JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
         final boolean useDefaultComment = StringUtils.isBlank(reversalComment);
 
         validateCommentForReversal(reversalComment);
+        
+        //Before reversal validate accounting closure is done for that branch 
or not.
+        final Date journalEntriesTransactionDate = 
journalEntries.get(0).getTransactionDate();
+        final GLClosure latestGLClosureByBranch = 
this.glClosureRepository.getLatestGLClosureByBranch(officeId);
+        if (latestGLClosureByBranch != null) {
+            if 
(latestGLClosureByBranch.getClosingDate().after(journalEntriesTransactionDate)
+                    || 
latestGLClosureByBranch.getClosingDate().equals(journalEntriesTransactionDate)) 
{
+                final String accountName = null;
+                final String accountGLCode = null;
+                throw new 
JournalEntryInvalidException(GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED,
+                        latestGLClosureByBranch.getClosingDate(), accountName, 
accountGLCode);
+            }
+        }
 
         for (final JournalEntry journalEntry : journalEntries) {
             JournalEntry reversalJournalEntry;

Reply via email to