diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/CalculateLoanScheduleCommand.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/CalculateLoanScheduleCommand.java index 01e88f3e2..1d9d4e6d4 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/CalculateLoanScheduleCommand.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/CalculateLoanScheduleCommand.java @@ -2,192 +2,103 @@ package org.mifosng.platform.api.commands; import java.math.BigDecimal; -import javax.xml.bind.annotation.XmlRootElement; - import org.joda.time.LocalDate; -@XmlRootElement +/** + * Immutable command used when auto-calculating loan schedules based on loan terms. + */ public class CalculateLoanScheduleCommand { - private Long productId; - private BigDecimal principalValue; - private BigDecimal inArrearsToleranceValue; + private final Long productId; + private final BigDecimal principal; - private Integer repaymentEveryValue; - private Integer repaymentFrequencyType; - private Integer numberOfRepaymentsValue; + private final Integer repaymentEvery; + private final Integer repaymentFrequencyType; + private final Integer numberOfRepayments; - private BigDecimal interestRatePerPeriodValue; - private Integer interestRateFrequencyType; - private Integer amortizationType; - private Integer interestType; - private Integer interestCalculationPeriodType; + private final BigDecimal interestRatePerPeriod; + private final Integer interestRateFrequencyType; + private final Integer amortizationType; + private final Integer interestType; + private final Integer interestCalculationPeriodType; - private LocalDate expectedDisbursementLocalDate; - private LocalDate repaymentsStartingFromLocalDate; - private LocalDate interestChargedFromLocalDate; - - protected CalculateLoanScheduleCommand() { - // - } + private final LocalDate expectedDisbursementDate; + private final LocalDate repaymentsStartingFromDate; + private final LocalDate interestChargedFromDate; public CalculateLoanScheduleCommand( final Long productId, - final Number principal, - final Number interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod, + final BigDecimal principal, + final BigDecimal interestRatePerPeriod, Integer interestRateFrequencyMethod, final Integer interestMethod, final Integer interestCalculationPeriodMethod, final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final LocalDate expectedDisbursementDate, final LocalDate repaymentsStartingFromDate, final LocalDate interestCalculatedFromDate) { this.productId = productId; - if (principal != null) { - this.principalValue = BigDecimal.valueOf(principal.doubleValue()); - } - if (interestRatePerPeriod != null) { - this.interestRatePerPeriodValue = BigDecimal.valueOf(interestRatePerPeriod.doubleValue()); - } + this.principal = principal; + this.interestRatePerPeriod = interestRatePerPeriod; this.interestRateFrequencyType = interestRateFrequencyMethod; this.interestType = interestMethod; this.interestCalculationPeriodType = interestCalculationPeriodMethod; - this.repaymentEveryValue = repaymentEvery; + this.repaymentEvery = repaymentEvery; this.repaymentFrequencyType = repaymentFrequency; - this.numberOfRepaymentsValue = numberOfRepayments; + this.numberOfRepayments = numberOfRepayments; this.amortizationType = amortizationMethod; - this.expectedDisbursementLocalDate = expectedDisbursementDate; - this.repaymentsStartingFromLocalDate = repaymentsStartingFromDate; - this.interestChargedFromLocalDate= interestCalculatedFromDate; - } - -// public String getCurrencyCode() { -// return currencyCode; -// } -// -// public void setCurrencyCode(String currencyCode) { -// this.currencyCode = currencyCode; -// } -// -// public Integer getDigitsAfterDecimalValue() { -// return digitsAfterDecimalValue; -// } -// -// public void setDigitsAfterDecimalValue(Integer digitsAfterDecimalValue) { -// this.digitsAfterDecimalValue = digitsAfterDecimalValue; -// } - - public BigDecimal getPrincipalValue() { - return principalValue; - } - - public void setPrincipalValue(BigDecimal principalValue) { - this.principalValue = principalValue; - } - - public BigDecimal getInArrearsToleranceValue() { - return inArrearsToleranceValue; - } - - public void setInArrearsToleranceValue(BigDecimal inArrearsToleranceValue) { - this.inArrearsToleranceValue = inArrearsToleranceValue; - } - - public Integer getRepaymentEveryValue() { - return repaymentEveryValue; - } - - public void setRepaymentEveryValue(Integer repaymentEveryValue) { - this.repaymentEveryValue = repaymentEveryValue; - } - - public Integer getRepaymentFrequencyType() { - return repaymentFrequencyType; - } - - public void setRepaymentFrequencyType(Integer repaymentFrequencyType) { - this.repaymentFrequencyType = repaymentFrequencyType; - } - - public Integer getNumberOfRepaymentsValue() { - return numberOfRepaymentsValue; - } - - public void setNumberOfRepaymentsValue(Integer numberOfRepaymentsValue) { - this.numberOfRepaymentsValue = numberOfRepaymentsValue; - } - - public BigDecimal getInterestRatePerPeriodValue() { - return interestRatePerPeriodValue; - } - - public void setInterestRatePerPeriodValue(BigDecimal interestRatePerPeriodValue) { - this.interestRatePerPeriodValue = interestRatePerPeriodValue; - } - - public Integer getInterestRateFrequencyType() { - return interestRateFrequencyType; - } - - public void setInterestRateFrequencyType(Integer interestRateFrequencyType) { - this.interestRateFrequencyType = interestRateFrequencyType; - } - - public Integer getAmortizationType() { - return amortizationType; - } - - public void setAmortizationType(Integer amortizationType) { - this.amortizationType = amortizationType; - } - - public Integer getInterestType() { - return interestType; - } - - public void setInterestType(Integer interestType) { - this.interestType = interestType; - } - - public Integer getInterestCalculationPeriodType() { - return interestCalculationPeriodType; - } - - public void setInterestCalculationPeriodType( - Integer interestCalculationPeriodType) { - this.interestCalculationPeriodType = interestCalculationPeriodType; - } - - public LocalDate getExpectedDisbursementLocalDate() { - return expectedDisbursementLocalDate; - } - - public void setExpectedDisbursementLocalDate( - LocalDate expectedDisbursementLocalDate) { - this.expectedDisbursementLocalDate = expectedDisbursementLocalDate; - } - - public LocalDate getRepaymentsStartingFromLocalDate() { - return repaymentsStartingFromLocalDate; - } - - public void setRepaymentsStartingFromLocalDate( - LocalDate repaymentsStartingFromLocalDate) { - this.repaymentsStartingFromLocalDate = repaymentsStartingFromLocalDate; - } - - public LocalDate getInterestChargedFromLocalDate() { - return interestChargedFromLocalDate; - } - - public void setInterestChargedFromLocalDate( - LocalDate interestChargedFromLocalDate) { - this.interestChargedFromLocalDate = interestChargedFromLocalDate; + this.expectedDisbursementDate = expectedDisbursementDate; + this.repaymentsStartingFromDate = repaymentsStartingFromDate; + this.interestChargedFromDate= interestCalculatedFromDate; } public Long getProductId() { return productId; } - public void setProductId(Long productId) { - this.productId = productId; + public BigDecimal getPrincipal() { + return principal; + } + + public Integer getRepaymentEvery() { + return repaymentEvery; + } + + public Integer getRepaymentFrequencyType() { + return repaymentFrequencyType; + } + + public Integer getNumberOfRepayments() { + return numberOfRepayments; + } + + public BigDecimal getInterestRatePerPeriod() { + return interestRatePerPeriod; + } + + public Integer getInterestRateFrequencyType() { + return interestRateFrequencyType; + } + + public Integer getAmortizationType() { + return amortizationType; + } + + public Integer getInterestType() { + return interestType; + } + + public Integer getInterestCalculationPeriodType() { + return interestCalculationPeriodType; + } + + public LocalDate getExpectedDisbursementDate() { + return expectedDisbursementDate; + } + + public LocalDate getRepaymentsStartingFromDate() { + return repaymentsStartingFromDate; + } + + public LocalDate getInterestChargedFromDate() { + return interestChargedFromDate; } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/SubmitApproveDisburseLoanCommand.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/SubmitApproveDisburseLoanCommand.java index 5f7c5fc12..68106c0b7 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/SubmitApproveDisburseLoanCommand.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/SubmitApproveDisburseLoanCommand.java @@ -1,9 +1,5 @@ package org.mifosng.platform.api.commands; -import javax.xml.bind.annotation.XmlRootElement; - - -@XmlRootElement public class SubmitApproveDisburseLoanCommand { private SubmitLoanApplicationCommand submitLoanApplicationCommand; @@ -27,7 +23,8 @@ public class SubmitApproveDisburseLoanCommand { return approveLoanCommand; } - public void setApproveLoanCommand(LoanStateTransitionCommand approveLoanCommand) { + public void setApproveLoanCommand( + LoanStateTransitionCommand approveLoanCommand) { this.approveLoanCommand = approveLoanCommand; } @@ -35,7 +32,8 @@ public class SubmitApproveDisburseLoanCommand { return disburseLoanCommand; } - public void setDisburseLoanCommand(LoanStateTransitionCommand disburseLoanCommand) { + public void setDisburseLoanCommand( + LoanStateTransitionCommand disburseLoanCommand) { this.disburseLoanCommand = disburseLoanCommand; } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java index d8792efb8..96539c087 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java @@ -274,7 +274,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService { Map requestMap = gsonConverter.fromJson(json, typeOfMap); Set supportedParams = new HashSet( - Arrays.asList("name", "description", "fundId", "currencyCode", "digitsAfterDecimalValue", + Arrays.asList("name", "description", "fundId", "currencyCode", "digitsAfterDecimal", "principal", "inArrearsTolerance", "interestRatePerPeriod", "repaymentEvery", "numberOfRepayments", "repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType", "locale") ); @@ -341,7 +341,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService { Map requestMap = gsonConverter.fromJson(json, typeOfMap); Set supportedParams = new HashSet( - Arrays.asList("name", "externalId", "parentId", "openingDate") + Arrays.asList("name", "externalId", "parentId", "openingDate", "dateFormat") ); checkForUnsupportedParameters(requestMap, supportedParams); @@ -654,6 +654,11 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService { paramValue = (String) requestMap.get(paramName); modifiedParameters.add(paramName); } + + if (paramValue != null) { + paramValue = paramValue.trim(); + } + return paramValue; } diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/fund/domain/Fund.java b/mifosng-provider/src/main/java/org/mifosng/platform/fund/domain/Fund.java index 35dfb7499..9738f8c51 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/fund/domain/Fund.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/fund/domain/Fund.java @@ -25,15 +25,16 @@ public class Fund extends AbstractAuditableCustom { @Column(name = "external_id", length=100) private String externalId; - public static Fund createNew(final String fundName) { - return new Fund(fundName); + public static Fund createNew(final String fundName, final String externalId) { + return new Fund(fundName, externalId); } protected Fund() { } - private Fund(final String fundName) { - this.name = fundName; + private Fund(final String fundName, final String externalId) { + this.name = StringUtils.defaultIfEmpty(fundName, null); + this.externalId = StringUtils.defaultIfEmpty(externalId, null); } public void update(final FundCommand command) { diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/fund/service/FundWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/fund/service/FundWritePlatformServiceJpaRepositoryImpl.java index 732840b1a..1535ab4c6 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/fund/service/FundWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/fund/service/FundWritePlatformServiceJpaRepositoryImpl.java @@ -37,7 +37,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf FundCommandValidator validator = new FundCommandValidator(command); validator.validateForCreate(); - Fund fund = Fund.createNew(command.getName()); + Fund fund = Fund.createNew(command.getName(), command.getExternalId()); this.fundRepository.saveAndFlush(fund); @@ -65,7 +65,7 @@ public class FundWritePlatformServiceJpaRepositoryImpl implements FundWritePlatf } fund.update(command); - this.fundRepository.save(fund); + this.fundRepository.saveAndFlush(fund); return fund.getId(); } catch (DataIntegrityViolationException dve) { diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculateLoanScheduleCommandValidator.java b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculateLoanScheduleCommandValidator.java index d95349761..ec93ace9f 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculateLoanScheduleCommandValidator.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculateLoanScheduleCommandValidator.java @@ -22,41 +22,39 @@ public class CalculateLoanScheduleCommandValidator { DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); -// baseDataValidator.reset().parameter("currencyCode").value(command.getCurrencyCode()).notBlank(); -// baseDataValidator.reset().parameter("digitsAfterDecimal").value(command.getDigitsAfterDecimalValue()).notNull().inMinMaxRange(0, 6); - baseDataValidator.reset().parameter("principal").value(command.getPrincipalValue()).notNull().positiveAmount(); + baseDataValidator.reset().parameter("principal").value(command.getPrincipal()).notNull().positiveAmount(); baseDataValidator.reset().parameter("repaymentFrequencyType").value(command.getRepaymentFrequencyType()).notNull().inMinMaxRange(0, 3); - baseDataValidator.reset().parameter("repaymentEvery").value(command.getRepaymentEveryValue()).notNull().greaterThanZero(); - baseDataValidator.reset().parameter("numberOfRepayments").value(command.getNumberOfRepaymentsValue()).notNull().greaterThanZero(); - baseDataValidator.reset().parameter("interestRatePerPeriod").value(command.getInterestRatePerPeriodValue()).notNull(); + baseDataValidator.reset().parameter("repaymentEvery").value(command.getRepaymentEvery()).notNull().greaterThanZero(); + baseDataValidator.reset().parameter("numberOfRepayments").value(command.getNumberOfRepayments()).notNull().greaterThanZero(); + baseDataValidator.reset().parameter("interestRatePerPeriod").value(command.getInterestRatePerPeriod()).notNull(); baseDataValidator.reset().parameter("interestRateFrequencyType").value(command.getInterestRateFrequencyType()).notNull().inMinMaxRange(0, 3); baseDataValidator.reset().parameter("amortizationType").value(command.getAmortizationType()).notNull().inMinMaxRange(0, 1); baseDataValidator.reset().parameter("interestType").value(command.getInterestType()).notNull().inMinMaxRange(0, 1); baseDataValidator.reset().parameter("interestCalculationPeriodType").value(command.getInterestCalculationPeriodType()).notNull().inMinMaxRange(0, 1); - baseDataValidator.reset().parameter("expectedDisbursementDate").value(command.getExpectedDisbursementLocalDate()).notNull(); + baseDataValidator.reset().parameter("expectedDisbursementDate").value(command.getExpectedDisbursementDate()).notNull(); - if (command.getExpectedDisbursementLocalDate() != null) { - if (command.getRepaymentsStartingFromLocalDate() != null - && command.getExpectedDisbursementLocalDate().isAfter(command.getRepaymentsStartingFromLocalDate())) { + if (command.getExpectedDisbursementDate() != null) { + if (command.getRepaymentsStartingFromDate() != null + && command.getExpectedDisbursementDate().isAfter(command.getRepaymentsStartingFromDate())) { ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.expectedDisbursementDate.cannot.be.after.first.repayment.date", "The parameter expectedDisbursementDate has a date which falls after the given first repayment date.", "expectedDisbursementDate", - command.getExpectedDisbursementLocalDate(), command.getRepaymentsStartingFromLocalDate()); + command.getExpectedDisbursementDate(), command.getRepaymentsStartingFromDate()); dataValidationErrors.add(error); } } - if (command.getRepaymentsStartingFromLocalDate() != null && command.getInterestChargedFromLocalDate() == null) { + if (command.getRepaymentsStartingFromDate() != null && command.getInterestChargedFromDate() == null) { ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.interestCalculatedFromDate.must.be.entered.when.using.repayments.startfrom.field", - "The parameter interestCalculatedFromDate cannot be empty when first repayment date is provided.", "interestCalculatedFromDate", command.getRepaymentsStartingFromLocalDate()); + "The parameter interestCalculatedFromDate cannot be empty when first repayment date is provided.", "interestCalculatedFromDate", command.getRepaymentsStartingFromDate()); dataValidationErrors.add(error); - } else if (command.getRepaymentsStartingFromLocalDate() == null && command.getInterestChargedFromLocalDate() != null) { + } else if (command.getRepaymentsStartingFromDate() == null && command.getInterestChargedFromDate() != null) { // validate interestCalculatedFromDate is after or on repaymentsStartingFromDate - if (command.getExpectedDisbursementLocalDate().isAfter(command.getInterestChargedFromLocalDate())) { + if (command.getExpectedDisbursementDate().isAfter(command.getInterestChargedFromDate())) { ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.interestChargedFromDate.cannot.be.before.disbursement.date", - "The parameter interestCalculatedFromDate cannot be before the date given for expected disbursement.", "interestChargedFromDate", command.getInterestChargedFromLocalDate(), command.getExpectedDisbursementLocalDate()); + "The parameter interestCalculatedFromDate cannot be before the date given for expected disbursement.", "interestChargedFromDate", command.getInterestChargedFromDate(), command.getExpectedDisbursementDate()); dataValidationErrors.add(error); } } diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculationPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculationPlatformServiceImpl.java index 4db5260f2..717cc34dd 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculationPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/CalculationPlatformServiceImpl.java @@ -62,14 +62,14 @@ public class CalculationPlatformServiceImpl implements CalculateLoanScheduleCommandValidator validator = new CalculateLoanScheduleCommandValidator(command); validator.validate(); - final BigDecimal principalAmount = command.getPrincipalValue(); - final BigDecimal defaultNominalInterestRatePerPeriod = command.getInterestRatePerPeriodValue(); + final BigDecimal principalAmount = command.getPrincipal(); + final BigDecimal defaultNominalInterestRatePerPeriod = command.getInterestRatePerPeriod(); final PeriodFrequencyType interestPeriodFrequencyType = PeriodFrequencyType.fromInt(command.getInterestRateFrequencyType()); final InterestMethod interestMethod = InterestMethod.fromInt(command.getInterestType()); final InterestCalculationPeriodMethod interestCalculationPeriodMethod = InterestCalculationPeriodMethod.fromInt(command.getInterestCalculationPeriodType()); - final Integer repayEvery = command.getRepaymentEveryValue(); + final Integer repayEvery = command.getRepaymentEvery(); final PeriodFrequencyType repaymentFrequencyType = PeriodFrequencyType.fromInt(command.getRepaymentFrequencyType()); - final Integer defaultNumberOfInstallments = command.getNumberOfRepaymentsValue(); + final Integer defaultNumberOfInstallments = command.getNumberOfRepayments(); final AmortizationMethod amortizationMethod = AmortizationMethod.fromInt(command.getAmortizationType()); final BigDecimal defaultAnnualNominalInterestRate = this.aprCalculator.calculateFrom(interestPeriodFrequencyType, defaultNominalInterestRatePerPeriod); @@ -96,8 +96,8 @@ public class CalculationPlatformServiceImpl implements CurrencyData currencyData = new CurrencyData(applicationCurrency.getCode(), applicationCurrency.getName(), currency.getDigitsAfterDecimal(), applicationCurrency.getDisplaySymbol(), applicationCurrency.getNameCode()); - return loanScheduleGenerator.generate(loanScheduleInfo, command.getExpectedDisbursementLocalDate(), command.getRepaymentsStartingFromLocalDate(), - command.getInterestChargedFromLocalDate(), currencyData); + return loanScheduleGenerator.generate(loanScheduleInfo, command.getExpectedDisbursementDate(), command.getRepaymentsStartingFromDate(), + command.getInterestChargedFromDate(), currencyData); } @Override diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java index 26db2f60a..f2d804983 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -1,5 +1,6 @@ package org.mifosng.platform.loan.service; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -263,8 +264,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf LocalDate repaymentsStartingFromDate = loan.getExpectedFirstRepaymentOnDate(); LocalDate interestCalculatedFromDate = loan.getInterestChargedFromDate(); - Number principalAsDecimal = loan.getLoanRepaymentScheduleDetail().getPrincipal().getAmount(); - Number interestRatePerYear = loan.getLoanRepaymentScheduleDetail().getAnnualNominalInterestRate(); + BigDecimal principalAsDecimal = loan.getLoanRepaymentScheduleDetail().getPrincipal().getAmount(); + BigDecimal interestRatePerYear = loan.getLoanRepaymentScheduleDetail().getAnnualNominalInterestRate(); Integer numberOfInstallments = loan.getLoanRepaymentScheduleDetail().getNumberOfRepayments(); Integer repaidEvery = loan.getLoanRepaymentScheduleDetail().getRepayEvery(); @@ -272,7 +273,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf Integer selectedRepaymentSchedule = loan.getLoanRepaymentScheduleDetail().getAmortizationMethod().getValue(); // use annual percentage rate to re-calculate loan schedule for late disbursement - Number interestRatePerPeriod = interestRatePerYear; + BigDecimal interestRatePerPeriod = interestRatePerYear; Integer interestRateFrequencyMethod = PeriodFrequencyType.YEARS.getValue(); Integer interestMethod = loan.getLoanRepaymentScheduleDetail().getInterestMethod().getValue(); diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java index fc3905bae..f46fcf7ef 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java @@ -91,7 +91,7 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP office.update(parent); } - this.officeRepository.save(office); + this.officeRepository.saveAndFlush(office); return office.getId(); } catch (DataIntegrityViolationException dve) {