removing unused fields in journal entry
This commit is contained in:
+2
-11
@@ -13752,18 +13752,11 @@ No Request Body:
|
||||
<td class=fielddesc>An additional field that is used to store additional information about the entry (Ex: chequeNo)
|
||||
</td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>useAccountingRule</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class=fielddesc>This flag denotes the journal entry should post on basis of Predefined accounting rule or general Journal Entry procudure. <br>If the flag is true the journal entry is posted on basis of predefined accounting rule.
|
||||
</td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>accountingRule</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class=fielddesc>Denotes the accounting rule id for posting journal entries, this parameter should pass in request body when <b>useAccountingRule</b> is true.
|
||||
<td class=fielddesc>Denotes the accounting rule id for posting journal entries.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -13966,7 +13959,7 @@ GET https://DomainName/api/v1/journalentries?transactionId=PB37X8Y21EQUY4S
|
||||
<td><div class="mifosXHeading2">Mandatory Fields</div></td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>officeId, transactionDate, useAccountingRule
|
||||
<td>officeId, transactionDate
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
+6
-19
@@ -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<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-13
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user