fix issues around loan.

This commit is contained in:
Keith Woodlock
2012-08-18 11:21:18 +01:00
parent e21e0e9a2f
commit ccfd8a09e0
3 changed files with 7 additions and 3 deletions
@@ -385,7 +385,6 @@ CREATE TABLE `m_loan` (
UNIQUE KEY `m_id` (`external_id`),
KEY `FKB6F935D87179A0CB` (`client_id`),
KEY `FKB6F935D8C8D4B434` (`product_id`),
KEY `FK7C885878B1147D1` (`loan_status_id`),
KEY `FK7C885877240145` (`fund_id`),
KEY `FK_loan_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FK_loan_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`),
@@ -202,8 +202,13 @@ public class Loan extends AbstractAuditableCustom<AppUser, Long> {
final LocalDate repaymentsStartingFromDate,
final LocalDate interestChargedFromDate,
final LoanLifecycleStateMachine lifecycleStateMachine) {
LoanStatus from = null;
if (this.loanStatus != null) {
from = LoanStatus.fromInt(this.loanStatus);
}
LoanStatus statusEnum = lifecycleStateMachine.transition(LoanEvent.LOAN_CREATED, LoanStatus.fromInt(this.loanStatus));
LoanStatus statusEnum = lifecycleStateMachine.transition(LoanEvent.LOAN_CREATED, from);
this.loanStatus = statusEnum.getValue();
this.termFrequency = loanTermFrequency;
@@ -593,7 +593,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
return " tr.id as id, tr.transaction_type_enum as transactionType, tr.transaction_date as `date`, tr.amount as total, "
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode "
+ " from m_loan l "
+ " join m_transaction tr on tr.loan_id = l.id"
+ " join m_loan_transaction tr on tr.loan_id = l.id"
+ " join m_currency rc on rc.`code` = l.currency_code ";
}