diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidDeleteException.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidDeleteException.java index 9ddcb1c43..ac0839b33 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidDeleteException.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/exception/GLAccountInvalidDeleteException.java @@ -28,24 +28,24 @@ public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleE /*** Enum of reasons for invalid delete **/ public enum GlAccountInvalidDeleteReason { - TRANSANCTIONS_LOGGED, HAS_CHILDREN; + TRANSACTIONS_LOGGED, HAS_CHILDREN; public String errorMessage() { - if (name().toString().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) { + if (name().equalsIgnoreCase("TRANSACTIONS_LOGGED")) { return "This GL Account cannot be deleted as it has transactions logged against it"; - } else if (name().toString().equalsIgnoreCase("HAS_CHILDREN")) { - return "Cannot delete this Header GL Account without first deleting or reassinging its children"; + } else if (name().equalsIgnoreCase("HAS_CHILDREN")) { + return "Cannot delete this Header GL Account without first deleting or reassigning its children"; } - return name().toString(); + return name(); } public String errorCode() { - if (name().toString().equalsIgnoreCase("TRANSANCTIONS_LOGGED")) { + if (name().equalsIgnoreCase("TRANSACTIONS_LOGGED")) { return "error.msg.glaccount.glcode.invalid.delete.transactions.logged"; - } else if (name().toString().equalsIgnoreCase("HAS_CHILDREN")) { + } else if (name().equalsIgnoreCase("HAS_CHILDREN")) { return "error.msg.glaccount.glcode.invalid.delete.has.children"; } - return name().toString(); + return name(); } } diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java index cc672fc71..ea929ab7f 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java @@ -194,7 +194,7 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount final boolean journalEntriesForAccountExist = this.glJournalEntryRepository .exists((root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("glAccountId"), glAccountId)); if (journalEntriesForAccountExist) { - throw new GLAccountInvalidDeleteException(GlAccountInvalidDeleteReason.TRANSANCTIONS_LOGGED, glAccountId); + throw new GLAccountInvalidDeleteException(GlAccountInvalidDeleteReason.TRANSACTIONS_LOGGED, glAccountId); } this.glAccountRepository.delete(glAccount);