use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class CustSearchAction method mainSearch.
@TransactionDemarcate(joinToken = true)
public ActionForward mainSearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
CustSearchActionForm actionForm = (CustSearchActionForm) form;
Short officeId = getShortValue(actionForm.getOfficeId());
String searchString = actionForm.getSearchString();
UserContext userContext = (UserContext) SessionUtils.getAttribute(Constants.USERCONTEXT, request.getSession());
super.search(mapping, form, request, response);
if (searchString == null || searchString.equals("")) {
ActionErrors errors = new ActionErrors();
errors.add(CustomerSearchConstants.NAMEMANDATORYEXCEPTION, new ActionMessage(CustomerSearchConstants.NAMEMANDATORYEXCEPTION));
request.setAttribute(Globals.ERROR_KEY, errors);
return mapping.findForward(ActionForwards.mainSearch_success.toString());
}
if (officeId != null && officeId != 0) {
addSeachValues(searchString, officeId.toString(), new OfficePersistence().getOffice(officeId).getOfficeName(), request);
} else {
addSeachValues(searchString, officeId.toString(), new OfficePersistence().getOffice(userContext.getBranchId()).getOfficeName(), request);
}
searchString = SearchUtils.normalizeSearchString(searchString);
if (searchString.equals("")) {
throw new CustomerException(CustomerSearchConstants.NAMEMANDATORYEXCEPTION);
}
if (actionForm.getFilters() == null) {
actionForm.setFilters(new SearchFiltersDto());
}
QueryResult customerSearchResult = new CustomerPersistence().search(searchString, officeId, userContext.getId(), userContext.getBranchId(), actionForm.getFilters());
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, customerSearchResult, request);
return mapping.findForward(ActionForwards.mainSearch_success.toString());
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class StandardAccountService method validatePayment.
@Override
public List<InvalidPaymentReason> validatePayment(AccountPaymentParametersDto payment) throws PersistenceException, AccountException {
List<InvalidPaymentReason> errors = new ArrayList<InvalidPaymentReason>();
AccountBO accountBo = this.legacyAccountDao.getAccount(payment.getAccountId());
Date meetingDate = new CustomerPersistence().getLastMeetingDateForCustomer(accountBo.getCustomer().getCustomerId());
boolean repaymentIndependentOfMeetingEnabled = new ConfigurationPersistence().isRepaymentIndepOfMeetingEnabled();
if (!accountBo.isTrxnDateValid(payment.getPaymentDate().toDateMidnight().toDate(), meetingDate, repaymentIndependentOfMeetingEnabled)) {
errors.add(InvalidPaymentReason.INVALID_DATE);
}
if (accountBo instanceof LoanBO) {
if (((LoanBO) accountBo).paymentsNotAllowed()) {
errors.add(InvalidPaymentReason.INVALID_LOAN_STATE);
}
}
if (accountBo instanceof SavingsBO) {
if (!accountBo.getState().equals(AccountState.SAVINGS_ACTIVE)) {
errors.add(InvalidPaymentReason.INVALID_LOAN_STATE);
}
}
if (AccountTypes.getAccountType(accountBo.getAccountType().getAccountTypeId()) == AccountTypes.LOAN_ACCOUNT) {
if (!getLoanPaymentTypes().contains(payment.getPaymentType())) {
errors.add(InvalidPaymentReason.UNSUPPORTED_PAYMENT_TYPE);
}
} else if (AccountTypes.getAccountType(accountBo.getAccountType().getAccountTypeId()) == AccountTypes.SAVINGS_ACCOUNT) {
if (!getSavingsPaymentTypes().contains(payment.getPaymentType())) {
errors.add(InvalidPaymentReason.UNSUPPORTED_PAYMENT_TYPE);
}
} else if (AccountTypes.getAccountType(accountBo.getAccountType().getAccountTypeId()) == AccountTypes.CUSTOMER_ACCOUNT) {
if (!getFeePaymentTypes().contains(payment.getPaymentType())) {
errors.add(InvalidPaymentReason.UNSUPPORTED_PAYMENT_TYPE);
}
}
if (!accountBo.paymentAmountIsValid(new Money(accountBo.getCurrency(), payment.getPaymentAmount()), payment.getPaymentOptions())) {
errors.add(InvalidPaymentReason.INVALID_PAYMENT_AMOUNT);
}
return errors;
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class CollectionSheetServiceImpl method saveCollectionSheet.
/**
* The method saves a collection sheet.
*
* @throws SaveCollectionSheetException
* */
@Override
public CollectionSheetErrorsDto saveCollectionSheet(final SaveCollectionSheetDto saveCollectionSheet) throws SaveCollectionSheetException {
Long totalTime;
Long totalTimeStart = System.currentTimeMillis();
Long readTime;
Long saveTime = null;
Long saveTimeStart;
Integer topCustomerId = saveCollectionSheet.getSaveCollectionSheetCustomers().get(0).getCustomerId();
CollectionSheetCustomerDto collectionSheetTopCustomer = new CustomerPersistence().findCustomerWithNoAssocationsLoaded(topCustomerId);
if (collectionSheetTopCustomer == null) {
List<InvalidSaveCollectionSheetReason> invalidSaveCollectionSheetReasons = new ArrayList<InvalidSaveCollectionSheetReason>();
List<String> invalidSaveCollectionSheetReasonsExtended = new ArrayList<String>();
invalidSaveCollectionSheetReasons.add(InvalidSaveCollectionSheetReason.INVALID_TOP_CUSTOMER);
invalidSaveCollectionSheetReasonsExtended.add(InvalidSaveCollectionSheetReason.INVALID_TOP_CUSTOMER.toString() + ": Customer Id: " + topCustomerId);
throw new SaveCollectionSheetException(invalidSaveCollectionSheetReasons, invalidSaveCollectionSheetReasonsExtended);
}
Short branchId = collectionSheetTopCustomer.getBranchId();
String searchId = collectionSheetTopCustomer.getSearchId();
// session caching: prefetch collection sheet data
// done prior to structure validation because it loads
// the customers and accounts to be validated into the session
SaveCollectionSheetSessionCache saveCollectionSheetSessionCache = new SaveCollectionSheetSessionCache();
saveCollectionSheetSessionCache.loadSessionCacheWithCollectionSheetData(saveCollectionSheet, branchId, searchId);
try {
new SaveCollectionSheetStructureValidator().execute(saveCollectionSheet);
} catch (SaveCollectionSheetException e) {
System.out.println(e.printInvalidSaveCollectionSheetReasons());
throw e;
}
/*
* With preprocessing complete...
*
* only errors and warnings from the business model remain
*/
final List<String> failedSavingsDepositAccountNums = new ArrayList<String>();
final List<String> failedSavingsWithdrawalNums = new ArrayList<String>();
final List<String> failedLoanDisbursementAccountNumbers = new ArrayList<String>();
final List<String> failedLoanRepaymentAccountNumbers = new ArrayList<String>();
final List<String> failedCustomerAccountPaymentNums = new ArrayList<String>();
final List<ClientAttendanceBO> clientAttendances = saveCollectionSheetAssembler.clientAttendanceAssemblerfromDto(saveCollectionSheet.getSaveCollectionSheetCustomers(), saveCollectionSheet.getTransactionDate(), branchId, searchId);
final AccountPaymentEntity payment = saveCollectionSheetAssembler.accountPaymentAssemblerFromDto(saveCollectionSheet.getTransactionDate(), saveCollectionSheet.getPaymentType(), saveCollectionSheet.getReceiptId(), saveCollectionSheet.getReceiptDate(), saveCollectionSheet.getUserId());
final List<SavingsBO> savingsAccounts = saveCollectionSheetAssembler.savingsAccountAssemblerFromDto(saveCollectionSheet.getSaveCollectionSheetCustomers(), payment, failedSavingsDepositAccountNums, failedSavingsWithdrawalNums);
Short paymentTypeId = (payment.getPaymentType() == null || payment.getPaymentType().getId() == null) ? null : payment.getPaymentType().getId();
final List<LoanBO> loanAccounts = saveCollectionSheetAssembler.loanAccountAssemblerFromDto(saveCollectionSheet.getSaveCollectionSheetCustomers(), payment, failedLoanDisbursementAccountNumbers, failedLoanRepaymentAccountNumbers, paymentTypeId);
final List<AccountBO> customerAccounts = saveCollectionSheetAssembler.customerAccountAssemblerFromDto(saveCollectionSheet.getSaveCollectionSheetCustomers(), payment, failedCustomerAccountPaymentNums);
boolean databaseErrorOccurred = false;
Throwable databaseError = null;
readTime = System.currentTimeMillis() - totalTimeStart;
try {
saveTimeStart = System.currentTimeMillis();
persistCollectionSheet(clientAttendances, loanAccounts, customerAccounts, savingsAccounts);
saveTime = System.currentTimeMillis() - saveTimeStart;
} catch (HibernateException e) {
logger.error("database error saving collection sheet", e);
databaseErrorOccurred = true;
databaseError = e;
}
totalTime = System.currentTimeMillis() - totalTimeStart;
printTiming(saveCollectionSheet.printSummary(), totalTime, saveTime, readTime, saveCollectionSheetSessionCache);
return new CollectionSheetErrorsDto(failedSavingsDepositAccountNums, failedSavingsWithdrawalNums, failedLoanDisbursementAccountNumbers, failedLoanRepaymentAccountNumbers, failedCustomerAccountPaymentNums, databaseErrorOccurred, databaseError);
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class CustomerSearchServiceFacadeWebTier method search.
@Override
public CustomerHierarchyDto search(String searchString, Short officeId, int pageNumber, int pageSize, SearchFiltersDto filters) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
if (searchString == null) {
throw new MifosRuntimeException(CenterConstants.NO_SEARCH_STRING);
}
String normalisedSearchString = org.mifos.framework.util.helpers.SearchUtils.normalizeSearchString(searchString);
if (normalisedSearchString.equals("")) {
throw new MifosRuntimeException(CenterConstants.NO_SEARCH_STRING);
}
CustomerHierarchyDto customerHierarchyDto = new CustomerHierarchyDto();
QueryResult searchResult = null;
List<CustomerSearchDto> resultList = null;
try {
searchResult = new CustomerPersistence().search(normalisedSearchString, officeId, userContext.getId(), userContext.getBranchId(), filters);
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
try {
resultList = searchResult.get(pageNumber, pageSize);
customerHierarchyDto.setSize(searchResult.getSize());
customerHierarchyDto.setSearchResultSize(resultList.size());
} catch (HibernateSearchException e) {
throw new MifosRuntimeException(e);
}
/* FIXME: QueryResult.get returns CustomerSearchDto with messed up customers and accounts data.
*/
for (CustomerSearchDto customerSearchDto : resultList) {
if (customerSearchDto.getCustomerType() == 1) {
ClientSearchResultDto clientSearchResultDto = new ClientSearchResultDto();
clientSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
clientSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
/* QueryResult.get returns CustomerSearchDto (as Client) with clientName as centerName,
* clientGobalCustNum as centerGobalCustNum and vice versa
*/
clientSearchResultDto.setClientName(customerSearchDto.getCenterName());
clientSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
clientSearchResultDto.setGroupName(customerSearchDto.getGroupName());
clientSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
clientSearchResultDto.setCenterName(customerSearchDto.getClientName());
clientSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
clientSearchResultDto.setBranchName(customerSearchDto.getBranchName());
clientSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
clientSearchResultDto.setCustomerStatusId(customerSearchDto.getCustomerStatus());
clientSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
clientSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
for (Object loanGlobalAccount : customerSearchDto.getLoanGlobalAccountNum()) {
String accountStr = (String) loanGlobalAccount;
clientSearchResultDto.getLoanGlobalAccountNum().add(accountStr);
clientSearchResultDto.getLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
for (Object savingGlobalAccount : customerSearchDto.getSavingsGlobalAccountNum()) {
String accountStr = (String) savingGlobalAccount;
clientSearchResultDto.getSavingsGlobalAccountNum().add(accountStr);
clientSearchResultDto.getSavingsGlobalAccountStateIds().put(accountStr, savingsDao.findBySystemId(accountStr).getState().getValue());
}
for (Object groupLoanAccount : customerSearchDto.getGroupLoanGlobalAccountNum()) {
String accountStr = (String) groupLoanAccount;
clientSearchResultDto.getGroupLoanGlobalAccountNum().add(accountStr);
clientSearchResultDto.getGroupLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
clientSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.getClients().add(clientSearchResultDto);
} else if (customerSearchDto.getCustomerType() == 2) {
GroupSearchResultDto groupSearchResultDto = new GroupSearchResultDto();
groupSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
groupSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
/* QueryResult.get returns CustomerSearchDto (as Group) with groupName as centerName,
* groupGobalCustNum as centerGobalCustNum and vice versa
*/
groupSearchResultDto.setGroupName(customerSearchDto.getCenterName());
groupSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
groupSearchResultDto.setCenterName(customerSearchDto.getGroupName());
groupSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
groupSearchResultDto.setBranchName(customerSearchDto.getBranchName());
groupSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
groupSearchResultDto.setCustomerStatusId(customerSearchDto.getCustomerStatus());
groupSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
groupSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
for (Object loanGlobalAccount : customerSearchDto.getLoanGlobalAccountNum()) {
String accountStr = (String) loanGlobalAccount;
groupSearchResultDto.getLoanGlobalAccountNum().add(accountStr);
groupSearchResultDto.getLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
for (Object savingGlobalAccount : customerSearchDto.getSavingsGlobalAccountNum()) {
String accountStr = (String) savingGlobalAccount;
groupSearchResultDto.getSavingsGlobalAccountNum().add(accountStr);
groupSearchResultDto.getSavingsGlobalAccountStateIds().put(accountStr, savingsDao.findBySystemId(accountStr).getState().getValue());
}
for (Object groupLoanAccount : customerSearchDto.getGroupLoanGlobalAccountNum()) {
String accountStr = (String) groupLoanAccount;
groupSearchResultDto.getGroupLoanGlobalAccountNum().add(accountStr);
groupSearchResultDto.getGroupLoanGlobalAccountStateIds().put(accountStr, loanDao.findByGlobalAccountNum(accountStr).getAccountState().getId());
}
groupSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.getGroups().add(groupSearchResultDto);
} else if (customerSearchDto.getCustomerType() == 3) {
CenterSearchResultDto centerSearchResultDto = new CenterSearchResultDto();
centerSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
centerSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
centerSearchResultDto.setCenterName(customerSearchDto.getCenterName());
centerSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
centerSearchResultDto.setBranchName(customerSearchDto.getBranchName());
centerSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
centerSearchResultDto.setCustomerStatusId(customerSearchDto.getCustomerStatus());
centerSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
centerSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
for (Object savingGlobalAccount : customerSearchDto.getSavingsGlobalAccountNum()) {
String accountStr = (String) savingGlobalAccount;
centerSearchResultDto.getSavingsGlobalAccountNum().add(accountStr);
centerSearchResultDto.getSavingsGlobalAccountStateIds().put(accountStr, savingsDao.findBySystemId(accountStr).getState().getValue());
}
centerSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.getCenters().add(centerSearchResultDto);
} else if (customerSearchDto.getLoanGlobalAccountNumber() != null && (customerSearchDto.getCustomerType() == 5 || customerSearchDto.getCustomerType() == 4 || customerSearchDto.getCustomerType() == 9) || customerSearchDto.getCustomerType() == 10) {
LoanAccountSearchResultDto loanAccountSearchResultDto = new LoanAccountSearchResultDto();
loanAccountSearchResultDto.setLoanGlobalAccountNum(customerSearchDto.getLoanGlobalAccountNumber());
loanAccountSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
loanAccountSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
loanAccountSearchResultDto.setBranchName(customerSearchDto.getBranchName());
loanAccountSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
loanAccountSearchResultDto.setAccountStatusId(customerSearchDto.getCustomerStatus());
loanAccountSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
loanAccountSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
//new group loan group or client account
if (customerSearchDto.getCustomerType() == 9 || customerSearchDto.getCustomerType() == 10) {
loanAccountSearchResultDto.setGroupLoan(Boolean.TRUE);
loanAccountSearchResultDto.setAccountStatusId(AccountTypes.GROUP_LOAN_ACCOUNT.getValue());
}
if (customerSearchDto.getClientGlobalCustNum() != null) {
loanAccountSearchResultDto.setCenterName(customerSearchDto.getClientName());
loanAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
loanAccountSearchResultDto.setClientName(customerSearchDto.getCenterName());
loanAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
loanAccountSearchResultDto.setGroupName(customerSearchDto.getGroupName());
loanAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else if (customerSearchDto.getCustomerType() == 5 || customerSearchDto.getCustomerType() == 9) {
loanAccountSearchResultDto.setGroupName(customerSearchDto.getCenterName());
loanAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
loanAccountSearchResultDto.setCenterName(customerSearchDto.getGroupName());
loanAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else {
loanAccountSearchResultDto.setClientName(customerSearchDto.getCenterName());
loanAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
loanAccountSearchResultDto.setGroupName(customerSearchDto.getClientName());
loanAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
loanAccountSearchResultDto.setCenterName(customerSearchDto.getGroupName());
loanAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
}
loanAccountSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.setLoan(loanAccountSearchResultDto);
} else if (customerSearchDto.getLoanGlobalAccountNumber() != null || customerSearchDto.getCustomerType() == 6) {
SavingsAccountSearchResultDto savingsAccountSearchResultDto = new SavingsAccountSearchResultDto();
savingsAccountSearchResultDto.setSavingsGlobalAccountNum(customerSearchDto.getLoanGlobalAccountNumber());
savingsAccountSearchResultDto.setOfficeId(customerSearchDto.getOfficeId());
savingsAccountSearchResultDto.setOfficeName(customerSearchDto.getOfficeName());
savingsAccountSearchResultDto.setBranchName(customerSearchDto.getBranchName());
savingsAccountSearchResultDto.setBranchId(customerSearchDto.getBranchGlobalNum());
savingsAccountSearchResultDto.setAccountStatusId(customerSearchDto.getCustomerStatus());
savingsAccountSearchResultDto.setLoanOfficerName(customerSearchDto.getLoanOfficerName());
savingsAccountSearchResultDto.setLoanOfficerId(customerSearchDto.getLoanOffcerGlobalNum());
if (customerSearchDto.getClientGlobalCustNum() != null) {
savingsAccountSearchResultDto.setCenterName(customerSearchDto.getClientName());
savingsAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
savingsAccountSearchResultDto.setClientName(customerSearchDto.getCenterName());
savingsAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
savingsAccountSearchResultDto.setGroupName(customerSearchDto.getGroupName());
savingsAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else if (customerSearchDto.getGroupGlobalCustNum() != null) {
savingsAccountSearchResultDto.setClientName(customerSearchDto.getClientName());
savingsAccountSearchResultDto.setClientGlobalCustNum(customerSearchDto.getClientGlobalCustNum());
savingsAccountSearchResultDto.setGroupName(customerSearchDto.getCenterName());
savingsAccountSearchResultDto.setGroupGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
savingsAccountSearchResultDto.setCenterName(customerSearchDto.getGroupName());
savingsAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getGroupGlobalCustNum());
} else {
savingsAccountSearchResultDto.setCenterName(customerSearchDto.getCenterName());
savingsAccountSearchResultDto.setCenterGlobalCustNum(customerSearchDto.getCenterGlobalCustNum());
}
savingsAccountSearchResultDto.setStatus(customerSearchDto.getStatus());
customerHierarchyDto.setSavings(savingsAccountSearchResultDto);
}
}
return customerHierarchyDto;
}
use of org.mifos.customers.persistence.CustomerPersistence in project head by mifos.
the class CustomerServiceImpl method generateSavingSchedulesForGroupAndCenterSavingAccounts.
private void generateSavingSchedulesForGroupAndCenterSavingAccounts(ClientBO client) {
try {
List<Days> workingDays = new FiscalCalendarRules().getWorkingDaysAsJodaTimeDays();
List<Holiday> holidays = new ArrayList<Holiday>();
UserContext userContext = client.getUserContext();
CustomerBO group = client.getParentCustomer();
if (group != null) {
List<SavingsBO> groupSavingAccounts = new CustomerPersistence().retrieveSavingsAccountForCustomer(group.getCustomerId());
CustomerBO center = group.getParentCustomer();
if (center != null) {
List<SavingsBO> centerSavingAccounts = new CustomerPersistence().retrieveSavingsAccountForCustomer(center.getCustomerId());
groupSavingAccounts.addAll(centerSavingAccounts);
}
for (SavingsBO savings : groupSavingAccounts) {
savings.setUserContext(userContext);
if (client.getCustomerMeetingValue() != null) {
if (!(savings.getCustomer().getLevel() == CustomerLevel.GROUP && savings.getRecommendedAmntUnit().getId().equals(RecommendedAmountUnit.COMPLETE_GROUP.getValue()))) {
DateTime today = new DateTime().toDateMidnight().toDateTime();
savings.generateDepositAccountActions(client, client.getCustomerMeeting().getMeeting(), workingDays, holidays, today);
}
}
}
}
} catch (PersistenceException pe) {
throw new MifosRuntimeException(pe);
}
}
Aggregations