remove warnings, fix issue with creating loan with no charges even if loan product has default charges against it.

This commit is contained in:
Keith Woodlock
2012-11-09 16:23:10 +00:00
parent 0d33fcf118
commit a0f6fd0a32
4 changed files with 18 additions and 12 deletions
@@ -354,7 +354,7 @@ public class ClientsApiResource {
fileDetails.getFileName(),
ApplicationConstants.MAX_FILE_UPLOAD_SIZE_IN_MB);
System.out.println( bodyPart.getMediaType().toString());
logger.debug(bodyPart.getMediaType().toString());
EntityIdentifier entityIdentifier = this.clientWritePlatformService
.saveOrUpdateClientImage(clientId, fileDetails.getFileName(),
@@ -536,7 +536,7 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
boolean dateHasChanged = false;
if (originalLocalDate != null) {
dateHasChanged = originalLocalDate.equals(providedLocalDate);
dateHasChanged = !originalLocalDate.equals(providedLocalDate);
} else {
dateHasChanged = (providedLocalDate != null);
}
@@ -602,8 +602,11 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
submittedOn, getExpectedDisbursedOnLocalDate());
}
for (LoanCharge loanCharge : this.charges) {
validateChargeHasValidSpecifiedDateIfApplicable(loanCharge, getDisbursementDate(), getLastRepaymentPeriodDueDate());
// charges are optional
if (this.charges != null) {
for (LoanCharge loanCharge : this.charges) {
validateChargeHasValidSpecifiedDateIfApplicable(loanCharge, getDisbursementDate(), getLastRepaymentPeriodDueDate());
}
}
}
@@ -68,11 +68,14 @@ public class LoanChargeAssembler {
if (charges != null) {
loanCharges = assembleFrom(charges, loanPrincipal);
} else {
for (Charge productCharge : chargesInheritedFromProduct) {
loanCharges.add(LoanCharge.createNew(productCharge));
}
}
// TODO - kw - dont inherit charges from product by default, user may remove charges (that were default) during creation - expect
// charges to be passed along in request at time of creation
// else {
// for (Charge productCharge : chargesInheritedFromProduct) {
// loanCharges.add(LoanCharge.createNew(productCharge));
// }
// }
return loanCharges;
}
@@ -2,8 +2,6 @@ package org.mifosng.platform.user.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import org.mifosng.platform.api.data.PermissionData;
@@ -13,10 +11,12 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "m_permission")
public class Permission extends AbstractPersistable<Long> {
@Column(name = "grouping", nullable = false, length=45)
@SuppressWarnings("unused")
@Column(name = "grouping", nullable = false, length=45)
private final String grouping;
@Column(name = "order_in_grouping", nullable = false)
@SuppressWarnings("unused")
@Column(name = "order_in_grouping", nullable = false)
private final Integer orderInGrouping;
@Column(name = "code", nullable = false, length=100)