- {{#if noteTypeId === 100}}
+ {{#if noteType.id === 100}}
{{/if}}
- {{#if noteTypeId === 200}}
+ {{#if noteType.id === 200}}
{{/if}}
- {{#if noteTypeId === 300}}
+ {{#if noteType.id === 300}}
{{/if}}
@@ -607,7 +607,7 @@
- {{=loanTermInMonths}} / ({{=loanTermInDays}} )
+ {{=expectedLoanTermInMonths}} / ({{=expectedLoanTermInDays}} )
{{#if closedOnDate !== null}}
diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/NoteData.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/NoteData.java
index 16cc225f3..e5f52dbe2 100644
--- a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/NoteData.java
+++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/NoteData.java
@@ -10,7 +10,7 @@ public class NoteData {
private Long clientId;
private Long loanId;
private Long loanTransactionId;
- private Integer noteTypeId;
+ private EnumOptionData noteType;
private String note;
@@ -26,14 +26,14 @@ public class NoteData {
}
public NoteData(Long id, Long clientId, Long loanId,
- Long transactionId, Integer noteTypeId, String note,
+ Long transactionId, EnumOptionData noteType, String note,
DateTime createdDate, Long createdById, String createdByUsername,
DateTime lastModifiedDate, Long lastModifiedById, String updatedByUsername) {
this.id = id;
this.clientId = clientId;
this.loanId = loanId;
this.loanTransactionId = transactionId;
- this.noteTypeId = noteTypeId;
+ this.noteType = noteType;
this.note = note;
this.createdOn = createdDate;
this.createdById = createdById;
@@ -131,11 +131,11 @@ public class NoteData {
this.updatedOn = updatedOn;
}
- public Integer getNoteTypeId() {
- return noteTypeId;
+ public EnumOptionData getNoteType() {
+ return noteType;
}
- public void setNoteTypeId(Integer noteTypeId) {
- this.noteTypeId = noteTypeId;
+ public void setNoteType(EnumOptionData noteType) {
+ this.noteType = noteType;
}
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/Note.java b/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/Note.java
index 72d692941..579b7f1f5 100644
--- a/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/Note.java
+++ b/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/Note.java
@@ -44,18 +44,23 @@ public class Note extends AbstractAuditableCustom
{
private Integer noteTypeId;
public enum NoteType {
- CLIENT(100), LOAN(200), LOAN_TRANSACTION(300);
+ CLIENT(100, "noteType.client"), LOAN(200, "noteType.loan"), LOAN_TRANSACTION(300, "noteType.loan.transaction");
- private int value;
+ private Integer value;
+ private String code;
- NoteType(int value) { this.value = value; }
+ NoteType(final Integer value, final String code) { this.value = value; this.code = code; }
- public int getValue() { return value; }
+ public Integer getValue() { return value; }
- public static NoteType parse(int id) {
+ public String getCode() {
+ return code;
+ }
+
+ public static NoteType parse(Integer id) {
NoteType right = null; // Default
for (NoteType item : NoteType.values()) {
- if (item.getValue()==id) {
+ if (item.getValue().intValue() == id.intValue()) {
right = item;
break;
}
diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/NoteEnumerations.java b/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/NoteEnumerations.java
new file mode 100644
index 000000000..dba8639a6
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosng/platform/client/domain/NoteEnumerations.java
@@ -0,0 +1,27 @@
+package org.mifosng.platform.client.domain;
+
+import org.mifosng.platform.api.data.EnumOptionData;
+import org.mifosng.platform.client.domain.Note.NoteType;
+
+public class NoteEnumerations {
+
+ public static EnumOptionData noteType(final Integer id) {
+ return noteType(Note.NoteType.parse(id));
+ }
+
+ public static EnumOptionData noteType(NoteType type) {
+ EnumOptionData optionData = null;
+ switch (type) {
+ case CLIENT:
+ optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Client note");
+ break;
+ case LOAN:
+ optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Loan note");
+ break;
+ case LOAN_TRANSACTION:
+ optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Loan transaction note");
+ break;
+ }
+ return optionData;
+ }
+}
diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/client/service/ClientReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/client/service/ClientReadPlatformServiceImpl.java
index cb44a54ef..26d32c753 100644
--- a/mifosng-provider/src/main/java/org/mifosng/platform/client/service/ClientReadPlatformServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosng/platform/client/service/ClientReadPlatformServiceImpl.java
@@ -15,9 +15,11 @@ import org.mifosng.platform.api.data.AppUserData;
import org.mifosng.platform.api.data.ClientData;
import org.mifosng.platform.api.data.ClientLoanAccountSummaryCollectionData;
import org.mifosng.platform.api.data.ClientLoanAccountSummaryData;
+import org.mifosng.platform.api.data.EnumOptionData;
import org.mifosng.platform.api.data.NoteData;
import org.mifosng.platform.api.data.OfficeData;
import org.mifosng.platform.api.data.OfficeLookup;
+import org.mifosng.platform.client.domain.NoteEnumerations;
import org.mifosng.platform.exceptions.ClientNotFoundException;
import org.mifosng.platform.exceptions.NoteNotFoundException;
import org.mifosng.platform.infrastructure.JdbcSupport;
@@ -306,6 +308,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
Long loanId = JdbcSupport.getLong(rs, "loanId");
Long transactionId = JdbcSupport.getLong(rs, "transactionId");
Integer noteTypeId = JdbcSupport.getInteger(rs, "noteTypeEnum");
+ EnumOptionData noteType = NoteEnumerations.noteType(noteTypeId);
String note = rs.getString("note");
DateTime createdDate = JdbcSupport.getDateTime(rs, "createdDate");
@@ -317,7 +320,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
String updatedByUsername = findUserById(createdById, allUsers);
return new NoteData(id, clientId, loanId, transactionId,
- noteTypeId, note, createdDate, createdById,
+ noteType, note, createdDate, createdById,
createdByUsername, lastModifiedDate, lastModifiedById,
updatedByUsername);
}
diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loanschedule/domain/PeriodicInterestRateCalculator.java b/mifosng-provider/src/main/java/org/mifosng/platform/loanschedule/domain/PeriodicInterestRateCalculator.java
index 9c2d781d0..8c8f9c827 100644
--- a/mifosng-provider/src/main/java/org/mifosng/platform/loanschedule/domain/PeriodicInterestRateCalculator.java
+++ b/mifosng-provider/src/main/java/org/mifosng/platform/loanschedule/domain/PeriodicInterestRateCalculator.java
@@ -60,6 +60,8 @@ public class PeriodicInterestRateCalculator {
case EQUAL_INSTALLMENTS:
principalDue = totalDuePerInstallment.minus(interestForInstallment);
break;
+ case INVALID:
+ break;
}
return principalDue;