update noteTypeid to be more descriptive in response as per other enum values.
This commit is contained in:
@@ -278,13 +278,13 @@
|
||||
<div>
|
||||
<div class="notespacer">
|
||||
<span class="ui-icon ui-icon-note" style="float: left; margin-right: 5px;"></span>
|
||||
{{#if noteTypeId === 100}}
|
||||
{{#if noteType.id === 100}}
|
||||
<span><spring:message code="widget.notes.label.client.note"/></span>
|
||||
{{/if}}
|
||||
{{#if noteTypeId === 200}}
|
||||
{{#if noteType.id === 200}}
|
||||
<span><spring:message code="widget.notes.label.loan.note"/></span>
|
||||
{{/if}}
|
||||
{{#if noteTypeId === 300}}
|
||||
{{#if noteType.id === 300}}
|
||||
<span><spring:message code="widget.notes.label.loan.transaction.note"/></span>
|
||||
{{/if}}
|
||||
<span><a href="#" class="editclientnote" id="editclientnotelink{{=id}}"><spring:message code="link.edit"/></a></span>
|
||||
@@ -607,7 +607,7 @@
|
||||
|
||||
<div class="row">
|
||||
<span class="longrowlabel"><spring:message code="label.client.account.loan.term"/></span>
|
||||
<span class="rowvalue">{{=loanTermInMonths}} <spring:message code="label.months"/> / ({{=loanTermInDays}} <spring:message code="label.days"/>)</span>
|
||||
<span class="rowvalue">{{=expectedLoanTermInMonths}} <spring:message code="label.months"/> / ({{=expectedLoanTermInDays}} <spring:message code="label.days"/>)</span>
|
||||
</div>
|
||||
|
||||
{{#if closedOnDate !== null}}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -44,18 +44,23 @@ public class Note extends AbstractAuditableCustom<AppUser, Long> {
|
||||
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;
|
||||
}
|
||||
|
||||
+27
@@ -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;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -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);
|
||||
}
|
||||
|
||||
+2
@@ -60,6 +60,8 @@ public class PeriodicInterestRateCalculator {
|
||||
case EQUAL_INSTALLMENTS:
|
||||
principalDue = totalDuePerInstallment.minus(interestForInstallment);
|
||||
break;
|
||||
case INVALID:
|
||||
break;
|
||||
}
|
||||
|
||||
return principalDue;
|
||||
|
||||
Reference in New Issue
Block a user