diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java index c60cf9ba6..c879012c6 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java @@ -72,10 +72,9 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure } // shouldn't be before an existing accounting closure final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(officeId); - if (latestGLClosure != null) { - if (DateUtils.isAfter(latestGLClosure.getClosingDate(), closureDate)) { - throw new GLClosureInvalidException(GlClosureInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate()); - } + if (latestGLClosure != null && DateUtils.isAfter(latestGLClosure.getClosingDate(), closureDate)) { + throw new GLClosureInvalidException(GlClosureInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate()); + } final GLClosure glClosure = GLClosure.fromJson(office, command); diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUpdateException.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUpdateException.java index 14c4259a0..3386d4e88 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUpdateException.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidUpdateException.java @@ -31,17 +31,17 @@ public class GLAccountInvalidUpdateException extends AbstractPlatformDomainRuleE TRANSANCTIONS_LOGGED; public String errorMessage() { - if (name().toString().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) { + if (name().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) { return "This Usage of this (detail) GL Account as it already has transactions logged against it"; } - return name().toString(); + return name(); } public String errorCode() { - if (name().toString().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) { + if (name().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) { return "error.msg.glaccount.glcode.invalid.update.transactions.logged"; } - return name().toString(); + return name(); } } diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntryJsonInputParams.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntryJsonInputParams.java index 2fa4256e2..27d8ed30a 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntryJsonInputParams.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntryJsonInputParams.java @@ -52,7 +52,7 @@ public enum JournalEntryJsonInputParams { @Override public String toString() { - return name().replaceAll("_", " "); + return name().replace("_", " "); } public String getValue() {