Merge pull request #344 from vishwasbabu/mifosx-413
optionally fetch all penalty options as part of loan product creation
This commit is contained in:
+1
@@ -194,6 +194,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
|||||||
loanProductToGLAccountMappingHelper.handleChangesToLoanProductToGLAccountMappings(loanProductId, changes, element,
|
loanProductToGLAccountMappingHelper.handleChangesToLoanProductToGLAccountMappings(loanProductId, changes, element,
|
||||||
accountingRuleType);
|
accountingRuleType);
|
||||||
loanProductToGLAccountMappingHelper.updatePaymentChannelToFundSourceMappings(command, element, loanProductId, changes);
|
loanProductToGLAccountMappingHelper.updatePaymentChannelToFundSourceMappings(command, element, loanProductId, changes);
|
||||||
|
loanProductToGLAccountMappingHelper.updateChargesToIncomeAccountMappings(command, element, loanProductId, changes);
|
||||||
}
|
}
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -19,5 +19,7 @@ public interface ChargeReadPlatformService {
|
|||||||
|
|
||||||
Collection<ChargeData> retrieveLoanApplicableCharges(boolean feeChargesOnly);
|
Collection<ChargeData> retrieveLoanApplicableCharges(boolean feeChargesOnly);
|
||||||
|
|
||||||
|
Collection<ChargeData> retrieveLoanApplicablePenalties();
|
||||||
|
|
||||||
Collection<ChargeData> retrieveLoanProductCharges(Long loanProductId);
|
Collection<ChargeData> retrieveLoanProductCharges(Long loanProductId);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
@@ -112,6 +112,17 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
|||||||
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.LOAN.getValue() });
|
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.LOAN.getValue() });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ChargeData> retrieveLoanApplicablePenalties() {
|
||||||
|
this.context.authenticatedUser();
|
||||||
|
|
||||||
|
final ChargeMapper rm = new ChargeMapper();
|
||||||
|
|
||||||
|
String sql = "select " + rm.chargeSchema()
|
||||||
|
+ " where c.is_deleted=0 and c.is_active=1 and c.is_penalty=1 and c.charge_applies_to_enum=? order by c.name ";
|
||||||
|
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.LOAN.getValue() });
|
||||||
|
}
|
||||||
|
|
||||||
private static final class ChargeMapper implements RowMapper<ChargeData> {
|
private static final class ChargeMapper implements RowMapper<ChargeData> {
|
||||||
|
|
||||||
public String chargeSchema() {
|
public String chargeSchema() {
|
||||||
@@ -157,4 +168,5 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
|||||||
active);
|
active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+9
-3
@@ -204,6 +204,11 @@ public class LoanProductsApiResource {
|
|||||||
chargeOptions = null;
|
chargeOptions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collection<ChargeData> penaltyOptions = this.chargeReadPlatformService.retrieveLoanApplicablePenalties();
|
||||||
|
if (penaltyOptions.isEmpty()) {
|
||||||
|
penaltyOptions = null;
|
||||||
|
}
|
||||||
|
|
||||||
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||||
final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
||||||
final List<EnumOptionData> interestTypeOptions = dropdownReadPlatformService.retrieveLoanInterestTypeOptions();
|
final List<EnumOptionData> interestTypeOptions = dropdownReadPlatformService.retrieveLoanInterestTypeOptions();
|
||||||
@@ -227,8 +232,9 @@ public class LoanProductsApiResource {
|
|||||||
|
|
||||||
List<EnumOptionData> accountingRuleTypeOptions = accountingDropdownReadPlatformService.retrieveAccountingRuleTypeOptions();
|
List<EnumOptionData> accountingRuleTypeOptions = accountingDropdownReadPlatformService.retrieveAccountingRuleTypeOptions();
|
||||||
|
|
||||||
return new LoanProductData(productData, chargeOptions, paymentTypeOptions, currencyOptions, amortizationTypeOptions,
|
return new LoanProductData(productData, chargeOptions, penaltyOptions, paymentTypeOptions, currencyOptions,
|
||||||
interestTypeOptions, interestCalculationPeriodTypeOptions, repaymentFrequencyTypeOptions, interestRateFrequencyTypeOptions,
|
amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, repaymentFrequencyTypeOptions,
|
||||||
fundOptions, transactionProcessingStrategyOptions, accountOptions, accountingRuleTypeOptions);
|
interestRateFrequencyTypeOptions, fundOptions, transactionProcessingStrategyOptions, accountOptions,
|
||||||
|
accountingRuleTypeOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+9
-6
@@ -89,6 +89,8 @@ public class LoanProductData {
|
|||||||
private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions;
|
private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions;
|
||||||
private final Collection<ChargeData> chargeOptions;
|
private final Collection<ChargeData> chargeOptions;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
private final Collection<ChargeData> penaltyOptions;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final List<EnumOptionData> accountingRuleOptions;
|
private final List<EnumOptionData> accountingRuleOptions;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final Map<String, List<GLAccountData>> accountingMappingOptions;
|
private final Map<String, List<GLAccountData>> accountingMappingOptions;
|
||||||
@@ -269,6 +271,7 @@ public class LoanProductData {
|
|||||||
this.accountingRule = accountingType;
|
this.accountingRule = accountingType;
|
||||||
|
|
||||||
this.chargeOptions = null;
|
this.chargeOptions = null;
|
||||||
|
this.penaltyOptions = null;
|
||||||
this.paymentTypeOptions = null;
|
this.paymentTypeOptions = null;
|
||||||
this.currencyOptions = null;
|
this.currencyOptions = null;
|
||||||
this.fundOptions = null;
|
this.fundOptions = null;
|
||||||
@@ -288,11 +291,11 @@ public class LoanProductData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
|
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
|
||||||
final Collection<CodeValueData> paymentTypeOptions, final Collection<CurrencyData> currencyOptions,
|
final Collection<ChargeData> penaltyOptions, final Collection<CodeValueData> paymentTypeOptions,
|
||||||
final List<EnumOptionData> amortizationTypeOptions, final List<EnumOptionData> interestTypeOptions,
|
final Collection<CurrencyData> currencyOptions, final List<EnumOptionData> amortizationTypeOptions,
|
||||||
final List<EnumOptionData> interestCalculationPeriodTypeOptions, final List<EnumOptionData> repaymentFrequencyTypeOptions,
|
final List<EnumOptionData> interestTypeOptions, final List<EnumOptionData> interestCalculationPeriodTypeOptions,
|
||||||
final List<EnumOptionData> interestRateFrequencyTypeOptions, final Collection<FundData> fundOptions,
|
final List<EnumOptionData> repaymentFrequencyTypeOptions, final List<EnumOptionData> interestRateFrequencyTypeOptions,
|
||||||
final Collection<TransactionProcessingStrategyData> transactionStrategyOptions,
|
final Collection<FundData> fundOptions, final Collection<TransactionProcessingStrategyData> transactionStrategyOptions,
|
||||||
final Map<String, List<GLAccountData>> accountingMappingOptions, final List<EnumOptionData> accountingRuleOptions) {
|
final Map<String, List<GLAccountData>> accountingMappingOptions, final List<EnumOptionData> accountingRuleOptions) {
|
||||||
this.id = productData.id;
|
this.id = productData.id;
|
||||||
this.name = productData.name;
|
this.name = productData.name;
|
||||||
@@ -326,6 +329,7 @@ public class LoanProductData {
|
|||||||
this.penaltyToIncomeAccountMappings = productData.penaltyToIncomeAccountMappings;
|
this.penaltyToIncomeAccountMappings = productData.penaltyToIncomeAccountMappings;
|
||||||
|
|
||||||
this.chargeOptions = chargeOptions;
|
this.chargeOptions = chargeOptions;
|
||||||
|
this.penaltyOptions = penaltyOptions;
|
||||||
this.paymentTypeOptions = paymentTypeOptions;
|
this.paymentTypeOptions = paymentTypeOptions;
|
||||||
this.currencyOptions = currencyOptions;
|
this.currencyOptions = currencyOptions;
|
||||||
this.currency = productData.currency;
|
this.currency = productData.currency;
|
||||||
@@ -355,7 +359,6 @@ public class LoanProductData {
|
|||||||
this.accountingMappingOptions = accountingMappingOptions;
|
this.accountingMappingOptions = accountingMappingOptions;
|
||||||
this.accountingRuleOptions = accountingRuleOptions;
|
this.accountingRuleOptions = accountingRuleOptions;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {
|
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {
|
||||||
|
|||||||
Reference in New Issue
Block a user