Merge pull request #944 from lingalamadhukar/MIFOSX-1267
MIFOSX-1318,MIFOSX-1314,MIFOSX-1300,MIFOSX-1242,MIFOSX-1199
This commit is contained in:
+2
-2
@@ -181,7 +181,7 @@ public class ProductToGLAccountMappingHelper {
|
||||
* Accounts in the system
|
||||
**/
|
||||
final Set<Long> existingCharges = new HashSet<Long>();
|
||||
if (chargeToIncomeAccountMappingArray != null) {
|
||||
if (chargeToIncomeAccountMappingArray != null && chargeToIncomeAccountMappingArray.size() > 0) {
|
||||
if (changes != null) {
|
||||
changes.put(arrayFragmentName, command.jsonFragment(arrayFragmentName));
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class ProductToGLAccountMappingHelper {
|
||||
* Fund Sources in the system
|
||||
**/
|
||||
final Set<Long> existingPaymentTypes = new HashSet<Long>();
|
||||
if (paymentChannelMappingArray != null) {
|
||||
if (paymentChannelMappingArray != null && paymentChannelMappingArray.size() > 0) {
|
||||
if (changes != null) {
|
||||
changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
command.jsonFragment(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue()));
|
||||
|
||||
+21
-3
@@ -22,6 +22,7 @@ import org.joda.time.format.DateTimeFormatter;
|
||||
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
||||
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.mifosplatform.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.mifosplatform.portfolio.account.PortfolioAccountType;
|
||||
import org.mifosplatform.portfolio.account.data.AccountTransferDTO;
|
||||
import org.mifosplatform.portfolio.account.data.AccountTransfersDataValidator;
|
||||
@@ -100,10 +101,12 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
Long transferDetailId = null;
|
||||
boolean isInterestTransfer = false;
|
||||
boolean isAccountTransfer = true;
|
||||
Long fromLoanAccountId = null;
|
||||
if (isSavingsToSavingsAccountTransfer(fromAccountType, toAccountType)) {
|
||||
|
||||
fromSavingsAccountId = command.longValueOfParameterNamed(fromAccountIdParamName);
|
||||
final SavingsAccount fromSavingsAccount = this.savingsAccountAssembler.assembleFrom(fromSavingsAccountId);
|
||||
validateAccountForTransfer(fromSavingsAccount);
|
||||
|
||||
final SavingsAccountTransaction withdrawal = this.savingsAccountDomainService.handleWithdrawal(fromSavingsAccount, fmt,
|
||||
transactionDate, transactionAmount, paymentDetail, fromSavingsAccount.isWithdrawalFeeApplicableForTransfer(),
|
||||
@@ -111,6 +114,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
|
||||
final Long toSavingsId = command.longValueOfParameterNamed(toAccountIdParamName);
|
||||
final SavingsAccount toSavingsAccount = this.savingsAccountAssembler.assembleFrom(toSavingsId);
|
||||
validateAccountForTransfer(toSavingsAccount);
|
||||
|
||||
final SavingsAccountTransaction deposit = this.savingsAccountDomainService.handleDeposit(toSavingsAccount, fmt,
|
||||
transactionDate, transactionAmount, paymentDetail, isAccountTransfer);
|
||||
@@ -124,6 +128,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
//
|
||||
fromSavingsAccountId = command.longValueOfParameterNamed(fromAccountIdParamName);
|
||||
final SavingsAccount fromSavingsAccount = this.savingsAccountAssembler.assembleFrom(fromSavingsAccountId);
|
||||
validateAccountForTransfer(fromSavingsAccount);
|
||||
|
||||
final SavingsAccountTransaction withdrawal = this.savingsAccountDomainService.handleWithdrawal(fromSavingsAccount, fmt,
|
||||
transactionDate, transactionAmount, paymentDetail, fromSavingsAccount.isWithdrawalFeeApplicableForTransfer(),
|
||||
@@ -146,8 +151,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
// FIXME - kw - ADD overpaid loan to savings account transfer
|
||||
// support.
|
||||
|
||||
//
|
||||
final Long fromLoanAccountId = command.longValueOfParameterNamed(fromAccountIdParamName);
|
||||
fromLoanAccountId = command.longValueOfParameterNamed(fromAccountIdParamName);
|
||||
final Loan fromLoanAccount = this.loanAccountAssembler.assembleFrom(fromLoanAccountId);
|
||||
|
||||
final LoanTransaction loanRefundTransaction = this.loanAccountDomainService.makeRefund(fromLoanAccountId,
|
||||
@@ -155,6 +159,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
|
||||
final Long toSavingsAccountId = command.longValueOfParameterNamed(toAccountIdParamName);
|
||||
final SavingsAccount toSavingsAccount = this.savingsAccountAssembler.assembleFrom(toSavingsAccountId);
|
||||
validateAccountForTransfer(toSavingsAccount);
|
||||
|
||||
final SavingsAccountTransaction deposit = this.savingsAccountDomainService.handleDeposit(toSavingsAccount, fmt,
|
||||
transactionDate, transactionAmount, paymentDetail, isAccountTransfer);
|
||||
@@ -171,9 +176,11 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
final CommandProcessingResultBuilder builder = new CommandProcessingResultBuilder().withEntityId(transferDetailId);
|
||||
|
||||
if (fromAccountType.isSavingsAccount()) {
|
||||
|
||||
builder.withSavingsId(fromSavingsAccountId);
|
||||
}
|
||||
if (fromAccountType.isLoanAccount()) {
|
||||
builder.withLoanId(fromLoanAccountId);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
@@ -292,6 +299,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
toSavingsAccount = accountTransferDetails.toSavingsAccount();
|
||||
this.savingsAccountAssembler.setHelpers(toSavingsAccount);
|
||||
}
|
||||
|
||||
final SavingsAccountTransaction withdrawal = this.savingsAccountDomainService.handleWithdrawal(fromSavingsAccount,
|
||||
accountTransferDTO.getFmt(), accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||
accountTransferDTO.getPaymentDetail(), fromSavingsAccount.isWithdrawalFeeApplicableForTransfer(), AccountTransferType
|
||||
@@ -368,4 +376,14 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
||||
private boolean isSavingsToSavingsAccountTransfer(final PortfolioAccountType fromAccountType, final PortfolioAccountType toAccountType) {
|
||||
return fromAccountType.isSavingsAccount() && toAccountType.isSavingsAccount();
|
||||
}
|
||||
|
||||
private void validateAccountForTransfer(final SavingsAccount account) {
|
||||
if (account.depositAccountType().isFixedDeposit() && account.isActive()) {
|
||||
|
||||
final String globalisationMessageCode = "error.msg.accounttransfers.are.not.allowed.on.active.fixeddepositaccount";
|
||||
final String defaultUserMessage = "Account Transfers are not allowed on Active Fixed Deposit Account";
|
||||
|
||||
throw new GeneralPlatformDomainRuleException(globalisationMessageCode, defaultUserMessage, account.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -475,6 +475,16 @@ public final class Client extends AbstractPersistable<Long> {
|
||||
this.activationDate = newValue.toDate();
|
||||
this.officeJoiningDate = this.activationDate;
|
||||
}
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(ClientApiConstants.dateOfBirthParamName, dateOfBirthLocalDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(ClientApiConstants.dateOfBirthParamName);
|
||||
actualChanges.put(ClientApiConstants.dateOfBirthParamName, valueAsInput);
|
||||
actualChanges.put(ClientApiConstants.dateFormatParamName, dateFormatAsInput);
|
||||
actualChanges.put(ClientApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(ClientApiConstants.dateOfBirthParamName);
|
||||
this.dateOfBirth = newValue.toDate();
|
||||
}
|
||||
|
||||
validate();
|
||||
|
||||
@@ -803,4 +813,12 @@ public final class Client extends AbstractPersistable<Long> {
|
||||
public Date dateOfBirth() {
|
||||
return this.dateOfBirth;
|
||||
}
|
||||
|
||||
public LocalDate dateOfBirthLocalDate(){
|
||||
LocalDate dateOfBirth = null;
|
||||
if (this.dateOfBirth != null) {
|
||||
dateOfBirth = LocalDate.fromDateFields(this.dateOfBirth);
|
||||
}
|
||||
return dateOfBirth;
|
||||
}
|
||||
}
|
||||
+7
-5
@@ -488,12 +488,14 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
int groupIndex = 0;
|
||||
boolean isEndOfRecords = false;
|
||||
// move cursor to first row.
|
||||
rs.next();
|
||||
final boolean isNotEmtyResultSet = rs.next();
|
||||
|
||||
while (!isEndOfRecords) {
|
||||
group = groupSavingsDataMapper.mapRowData(rs, groupIndex++);
|
||||
groups.add(group);
|
||||
isEndOfRecords = rs.isAfterLast();
|
||||
if (isNotEmtyResultSet) {
|
||||
while (!isEndOfRecords) {
|
||||
group = groupSavingsDataMapper.mapRowData(rs, groupIndex++);
|
||||
groups.add(group);
|
||||
isEndOfRecords = rs.isAfterLast();
|
||||
}
|
||||
}
|
||||
|
||||
return groups;
|
||||
|
||||
Reference in New Issue
Block a user