Search in sources :

Example 6 with AccountActionEntity

use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.

the class BirtAdminDocumentUploadAction method updateSelectedStatus.

@TransactionDemarcate(joinToken = true)
private void updateSelectedStatus(HttpServletRequest request, BirtAdminDocumentUploadActionForm uploadForm) throws PageExpiredException, ServiceException {
    List selectList = null;
    if (uploadForm.getStatusList() != null) {
        Short accountTypeId = Short.valueOf(uploadForm.getAccountTypeId());
        if (accountTypeId.shortValue() <= 2) {
            selectList = new ArrayList<AccountStateEntity>();
            List<AccountStateEntity> masterList = new AccountBusinessService().retrieveAllActiveAccountStateList(AccountTypes.getAccountType(accountTypeId));
            for (AccountStateEntity product : masterList) {
                for (String productStatusId : uploadForm.getStatusList()) {
                    if (productStatusId != null && product.getId().intValue() == Integer.valueOf(productStatusId).intValue()) {
                        selectList.add(product);
                    }
                }
            }
        } else {
            Short currentLocaleId = (Short) SessionUtils.getAttribute("CURRENT_LOCALE_ID", request);
            selectList = new ArrayList<AccountActionEntity>();
            List<AccountActionEntity> masterList = getAvailableLoanTransactions(currentLocaleId);
            for (String accountActionId : uploadForm.getStatusList()) {
                AccountActionTypes accountActionType = AccountActionTypes.fromInt(Integer.valueOf(accountActionId));
                AccountActionEntity accountAction = new AccountBusinessService().getAccountAction(accountActionType.getValue(), currentLocaleId);
                if (masterList.contains(accountAction)) {
                    selectList.add(accountAction);
                }
            }
        }
    }
    SessionUtils.setCollectionAttribute("SelectedStatus", selectList, request);
}
Also used : AccountActionTypes(org.mifos.accounts.util.helpers.AccountActionTypes) AccountBusinessService(org.mifos.accounts.business.service.AccountBusinessService) ArrayList(java.util.ArrayList) List(java.util.List) AccountStateEntity(org.mifos.accounts.business.AccountStateEntity) AccountActionEntity(org.mifos.accounts.business.AccountActionEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with AccountActionEntity

use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.

the class LegacyAccountDaoIntegrationTest method testGetAccountAction.

@Test
public void testGetAccountAction() throws Exception {
    AccountActionEntity accountAction = legacyMasterDao.getPersistentObject(AccountActionEntity.class, AccountActionTypes.SAVINGS_INTEREST_POSTING.getValue());
    Assert.assertNotNull(accountAction);
}
Also used : AccountActionEntity(org.mifos.accounts.business.AccountActionEntity) Test(org.junit.Test)

Example 8 with AccountActionEntity

use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.

the class SavingsApplyAdjustmentAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    clearActionForm(form);
    doCleanUp(request);
    UserContext uc = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    SavingsBO savings = (SavingsBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
    SessionUtils.removeAttribute(Constants.BUSINESS_KEY, request);
    Long savingsId = Long.valueOf(savings.getAccountId());
    savings = this.savingsDao.findById(savingsId);
    savings.setUserContext(uc);
    String paymentIdParam = request.getParameter("paymentId");
    Integer paymentId;
    if (paymentIdParam == null) {
        AccountPaymentEntity payment = savings.getLastPmnt();
        paymentId = (payment == null) ? null : payment.getPaymentId();
    } else {
        paymentId = Integer.valueOf(paymentIdParam);
    }
    SavingsAdjustmentReferenceDto savingsAdjustmentDto = this.savingsServiceFacade.retrieveAdjustmentReferenceData(savingsId, paymentId);
    if (savingsAdjustmentDto.isDepositOrWithdrawal()) {
        AccountPaymentEntity payment = (paymentId == null) ? savings.findMostRecentPaymentByPaymentDate() : savings.findPaymentById(paymentId);
        AccountActionEntity accountAction = legacyMasterDao.getPersistentObject(AccountActionEntity.class, new SavingsHelper().getPaymentActionType(payment));
        Hibernate.initialize(savings.findMostRecentPaymentByPaymentDate().getAccountTrxns());
        SessionUtils.setAttribute(SavingsConstants.ACCOUNT_ACTION, accountAction, request);
        SessionUtils.setAttribute(SavingsConstants.CLIENT_NAME, savingsAdjustmentDto.getClientName(), request);
        SessionUtils.setAttribute(SavingsConstants.IS_LAST_PAYMENT_VALID, Constants.YES, request);
        SessionUtils.setAttribute(SavingsConstants.ADJUSTMENT_AMOUNT, payment.getAmount().getAmount(), request);
        SavingsApplyAdjustmentActionForm actionForm = (SavingsApplyAdjustmentActionForm) form;
        actionForm.setPaymentId(paymentId);
        actionForm.setTrxnDate(new LocalDate(payment.getPaymentDate()));
    } else {
        SessionUtils.setAttribute(SavingsConstants.IS_LAST_PAYMENT_VALID, Constants.NO, request);
    }
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
    return mapping.findForward("load_success");
}
Also used : SavingsAdjustmentReferenceDto(org.mifos.dto.screen.SavingsAdjustmentReferenceDto) UserContext(org.mifos.security.util.UserContext) SavingsHelper(org.mifos.accounts.savings.util.helpers.SavingsHelper) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) SavingsApplyAdjustmentActionForm(org.mifos.accounts.savings.struts.actionforms.SavingsApplyAdjustmentActionForm) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) LocalDate(org.joda.time.LocalDate) AccountActionEntity(org.mifos.accounts.business.AccountActionEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 9 with AccountActionEntity

use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.

the class SavingsTrxnDetailEntity method savingsAdjustment.

public static SavingsTrxnDetailEntity savingsAdjustment(AccountPaymentEntity accountPayment, CustomerBO customer, Money balAfterAdjust, Money negate, PersonnelBO loggedInUser, Date dueDate, Date actionDate, Date transactionCreatedDate, String adjustmentComment, SavingsTrxnDetailEntity relatedTrxn) {
    AccountActionEntity applicationTransactionType = new AccountActionEntity(AccountActionTypes.SAVINGS_ADJUSTMENT);
    AccountActionEntity monetaryTransactionType = new AccountActionEntity(AccountActionTypes.SAVINGS_ADJUSTMENT);
    Short installmentIdNotNeeded = null;
    SavingsTrxnDetailEntity adjustment = new SavingsTrxnDetailEntity(accountPayment, customer, applicationTransactionType, monetaryTransactionType, negate, balAfterAdjust, loggedInUser, dueDate, actionDate, installmentIdNotNeeded, adjustmentComment, transactionCreatedDate, relatedTrxn);
    return adjustment;
}
Also used : AccountActionEntity(org.mifos.accounts.business.AccountActionEntity)

Example 10 with AccountActionEntity

use of org.mifos.accounts.business.AccountActionEntity in project head by mifos.

the class SavingsTrxnDetailEntity method savingsDeposit.

public static SavingsTrxnDetailEntity savingsDeposit(AccountPaymentEntity newAccountPayment, CustomerBO customer, Money savingsBalance, Money depositAmount, PersonnelBO createdBy, Date dueDate, Date actionDate, Date transactionCreatedDate, Short installmentId) {
    AccountActionEntity accountAction = new AccountActionEntity(AccountActionTypes.SAVINGS_DEPOSIT);
    SavingsTrxnDetailEntity relatedTrxnNotApplicable = null;
    return new SavingsTrxnDetailEntity(newAccountPayment, customer, accountAction, accountAction, depositAmount, savingsBalance, createdBy, dueDate, actionDate, installmentId, "", transactionCreatedDate, relatedTrxnNotApplicable);
}
Also used : AccountActionEntity(org.mifos.accounts.business.AccountActionEntity)

Aggregations

AccountActionEntity (org.mifos.accounts.business.AccountActionEntity)18 ArrayList (java.util.ArrayList)5 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)5 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)5 Test (org.junit.Test)4 CustomerBO (org.mifos.customers.business.CustomerBO)4 List (java.util.List)3 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)3 AccountTrxnEntity (org.mifos.accounts.business.AccountTrxnEntity)3 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)3 AccountActionTypes (org.mifos.accounts.util.helpers.AccountActionTypes)3 UserContext (org.mifos.security.util.UserContext)3 FormFile (org.apache.struts.upload.FormFile)2 LocalDate (org.joda.time.LocalDate)2 AccountPaymentEntityBuilder (org.mifos.accounts.business.AccountPaymentEntityBuilder)2 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)2 LegacyLoanDao (org.mifos.accounts.loan.persistance.LegacyLoanDao)2 PaymentTypeEntity (org.mifos.application.master.business.PaymentTypeEntity)2 CustomerPersistence (org.mifos.customers.persistence.CustomerPersistence)2 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)2