diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index cc84995f5..271487e94 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -13752,18 +13752,11 @@ No Request Body:
An additional field that is used to store additional information about the entry (Ex: chequeNo)
|
-
- | useAccountingRule |
-
-
- This flag denotes the journal entry should post on basis of Predefined accounting rule or general Journal Entry procudure. If the flag is true the journal entry is posted on basis of predefined accounting rule.
- |
-
| accountingRule |
- | Denotes the accounting rule id for posting journal entries, this parameter should pass in request body when useAccountingRule is true.
+ | Denotes the accounting rule id for posting journal entries.
|
@@ -13966,7 +13959,7 @@ GET https://DomainName/api/v1/journalentries?transactionId=PB37X8Y21EQUY4S
Mandatory Fields |
- | officeId, transactionDate, useAccountingRule
+ | officeId, transactionDate
|
@@ -14020,7 +14013,6 @@ Request Body:
"officeId": 1,
"transactionDate": "06 December 2012",
"comments": "Gifts for staff",
-"useAccountingRule": "false",
"locale": "en" ,
"dateFormat": "dd MMMM yyyy",
"credits":[{"glAccountId":1,
@@ -14055,7 +14047,6 @@ Request Body:
"transactionDate": "23 May 2013",
"referenceNumber": "547",
"comments": "asdf",
- "useAccountingRule": "true",
"accountingRule": "2",
"amount": "547"
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java
index 729b93ef3..22e45080b 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java
@@ -23,7 +23,6 @@ public class JournalEntryCommand {
private final LocalDate transactionDate;
private final String comments;
private final String referenceNumber;
- private final Boolean useAccountingRule;
private final Long accountingRuleId;
private final BigDecimal amount;
@@ -32,28 +31,17 @@ public class JournalEntryCommand {
public JournalEntryCommand(final Long officeId, final LocalDate transactionDate, final String comments,
final SingleDebitOrCreditEntryCommand[] credits, final SingleDebitOrCreditEntryCommand[] debits,
- final String referenceNumber, final Boolean useAccountingRule, final Long accountingRuleId, final BigDecimal amount) {
+ final String referenceNumber, final Long accountingRuleId, final BigDecimal amount) {
this.officeId = officeId;
this.transactionDate = transactionDate;
this.comments = comments;
this.credits = credits;
this.debits = debits;
this.referenceNumber = referenceNumber;
- this.useAccountingRule = useAccountingRule;
this.accountingRuleId = accountingRuleId;
this.amount = amount;
}
- public JournalEntryCommand(final Long officeId, final LocalDate transactionDate, final String comments, final String referenceNumber,
- final Boolean useAccountingRule, final Long accountingRuleId, final BigDecimal amount) {
- this(officeId, transactionDate, comments, null, null, referenceNumber, useAccountingRule, accountingRuleId, amount);
- }
-
- public JournalEntryCommand(Long officeId, LocalDate transactionDate, String comments, SingleDebitOrCreditEntryCommand[] credits,
- SingleDebitOrCreditEntryCommand[] debits, String referenceNumber, Boolean useAccountingRule) {
- this(officeId, transactionDate, comments, credits, debits, referenceNumber, useAccountingRule, null,null);
- }
-
public void validateForCreate() {
final List dataValidationErrors = new ArrayList();
@@ -66,11 +54,11 @@ public class JournalEntryCommand {
baseDataValidator.reset().parameter("comments").value(this.comments).ignoreIfNull().notExceedingLengthOf(500);
- baseDataValidator.reset().parameter("useAccountingRule").value(this.useAccountingRule).notNull();
-
baseDataValidator.reset().parameter("referenceNumber").value(this.referenceNumber).ignoreIfNull().notExceedingLengthOf(100);
- if (!this.useAccountingRule) {
+ baseDataValidator.reset().parameter("accountingRule").value(this.accountingRuleId).ignoreIfNull().longGreaterThanZero();
+
+ if (this.accountingRuleId == null) {
baseDataValidator.reset().parameter("credits").value(this.credits).notNull();
@@ -102,7 +90,6 @@ public class JournalEntryCommand {
}
}
} else {
- baseDataValidator.reset().parameter("accountingRule").value(this.accountingRuleId).notNull().longGreaterThanZero();
baseDataValidator.reset().parameter("amount").value(this.amount).notNull().zeroOrPositiveAmount();
}
@@ -147,8 +134,8 @@ public class JournalEntryCommand {
return this.referenceNumber;
}
- public Boolean getUseAccountingRule() {
- return this.useAccountingRule;
+ public Long getAccountingRuleId() {
+ return this.accountingRuleId;
}
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java
index e105c81ca..d0e243f45 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java
@@ -59,21 +59,12 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr
JournalEntryJsonInputParams.TRANSACTION_DATE.getValue(), element);
final String referenceNumber = this.fromApiJsonHelper.extractStringNamed(JournalEntryJsonInputParams.REFERENCE_NUMBER.getValue(),
element);
- final Boolean isPredefinedRuleEntry = this.fromApiJsonHelper.extractBooleanNamed(
- JournalEntryJsonInputParams.USE_ACCOUNTING_RULE.getValue(), element);
- final Boolean useAccountingRule = isPredefinedRuleEntry == null ? false : isPredefinedRuleEntry;
-
+ final Long accountingRuleId = this.fromApiJsonHelper.extractLongNamed(JournalEntryJsonInputParams.ACCOUNTING_RULE.getValue(),
+ element);
final JsonObject topLevelJsonElement = element.getAsJsonObject();
final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
- if (useAccountingRule) {
- final Long accountingRuleId = this.fromApiJsonHelper.extractLongNamed(JournalEntryJsonInputParams.ACCOUNTING_RULE.getValue(),
- element);
- final BigDecimal amount = this.fromApiJsonHelper.extractBigDecimalNamed(JournalEntryJsonInputParams.AMOUNT.getValue(), element,
- locale);
- return new JournalEntryCommand(officeId, transactionDate, comments, referenceNumber, useAccountingRule, accountingRuleId,
- amount);
- }
+ final BigDecimal amount = this.fromApiJsonHelper.extractBigDecimalNamed(JournalEntryJsonInputParams.AMOUNT.getValue(), element, locale);
SingleDebitOrCreditEntryCommand[] credits = null;
SingleDebitOrCreditEntryCommand[] debits = null;
@@ -87,7 +78,7 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr
debits = populateCreditsOrDebitsArray(topLevelJsonElement, locale, debits, JournalEntryJsonInputParams.DEBITS.getValue());
}
}
- return new JournalEntryCommand(officeId, transactionDate, comments, credits, debits, referenceNumber, useAccountingRule);
+ return new JournalEntryCommand(officeId, transactionDate, comments, credits, debits, referenceNumber, accountingRuleId, amount);
}
/**
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
index 6d131bbac..b4169a565 100755
--- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java
@@ -88,7 +88,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
final Office office = this.officeRepository.findOne(officeId);
if (office == null) { throw new OfficeNotFoundException(officeId); }
- final boolean useAccountingRule = command.booleanPrimitiveValueOfParameterNamed(JournalEntryJsonInputParams.USE_ACCOUNTING_RULE.getValue());
+ final Long accountRuleId = command.longValueOfParameterNamed(JournalEntryJsonInputParams.ACCOUNTING_RULE.getValue());
validateBusinessRulesForJournalEntries(journalEntryCommand);
@@ -98,7 +98,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
final String referenceNumber = journalEntryCommand.getReferenceNumber();
final boolean manualEntry = true;
- if (useAccountingRule) {
+ if (accountRuleId != null) {
final Long accountingRuleId = command.longValueOfParameterNamed(JournalEntryJsonInputParams.ACCOUNTING_RULE.getValue());
final BigDecimal amount = command.bigDecimalValueOfParameterNamed(JournalEntryJsonInputParams.AMOUNT.getValue());
@@ -218,7 +218,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) { throw new JournalEntryInvalidException(
GL_JOURNAL_ENTRY_INVALID_REASON.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(), null, null); }
}
- if(!command.getUseAccountingRule()) {
+ if(command.getAccountingRuleId() == null) {
/*** check if credits and debits are valid **/
final SingleDebitOrCreditEntryCommand[] credits = command.getCredits();
final SingleDebitOrCreditEntryCommand[] debits = command.getDebits();