Search in sources :

Example 36 with UserContext

use of org.mifos.security.util.UserContext in project head by mifos.

the class ConsolidatedTransactionAction method load.

public ActionForward load(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("start Load method of loan Product Action");
    ConsolidatedTransactionActionForm actionForm = (ConsolidatedTransactionActionForm) form;
    java.util.Date trxnDate = DateUtils.getCurrentDateWithoutTimeStamp();
    List<OfficeGlobalDto> officeDetailsDtos = null;
    UserContext context = getUserContext(request);
    actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
    List<OfficesList> offices = new ArrayList<OfficesList>();
    short branches = 5;
    officeDetailsDtos = accountingServiceFacade.loadOfficesForLevel(branches);
    List<GLCodeDto> accountingDtos = accountingServiceFacade.coaBranchAccountHead();
    storingSession(request, "viewStageTransactionsDtoCRBRListValues", null);
    storingSession(request, "viewStageTransactionsDtoCPBPListValues", null);
    storingSession(request, "viewStageTransactionsDtoCRMisListValues", null);
    storingSession(request, "viewStageTransactionsDtoCPMisListValues", null);
    storingSession(request, "viewStageTransactionsDtoInterOfficeList", null);
    storingSession(request, "OfficesOnHierarchy", null);
    actionForm.setTransactiondate("");
    actionForm.setCptotal("0");
    actionForm.setCrtotal("0");
    actionForm.setBranch("");
    storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) GLCodeDto(org.mifos.dto.domain.GLCodeDto) OfficesList(org.mifos.dto.domain.OfficesList) Date(java.util.Date) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) ConsolidatedTransactionActionForm(org.mifos.accounting.struts.actionform.ConsolidatedTransactionActionForm)

Example 37 with UserContext

use of org.mifos.security.util.UserContext in project head by mifos.

the class TestClients method add.

public ClientBO add(String firstName, OfficeBO office, MeetingBO meeting, PersonnelBO loanOfficer, short groupFlag) {
    UserContext userContext = new UserContext();
    ClientDetailEntity clientDetailEntity = new ClientDetailEntity();
    ClientBO clientBO = new ClientBO(userContext, firstName, CustomerStatus.CLIENT_ACTIVE, TestDates.RECENT, office, meeting, loanOfficer, testPersonnels.any(), TestDates.OLD_ENOUGH, "123456", true, TestDates.RECENT, groupFlag, firstName, "Brown", "James", clientDetailEntity);
    session.saveOrUpdate(clientBO);
    return clientBO;
}
Also used : UserContext(org.mifos.security.util.UserContext) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailEntity(org.mifos.customers.client.business.ClientDetailEntity)

Example 38 with UserContext

use of org.mifos.security.util.UserContext in project head by mifos.

the class JournalVoucherAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    JournalVoucherActionForm actionForm = (JournalVoucherActionForm) form;
    List<GLCodeDto> accountingDtos = null;
    List<RolesActivityDto> rolesactivitydto = null;
    accountingDtos = accountingServiceFacade.loadDebitAccounts();
    java.util.Date voucherDate = DateUtils.getCurrentDateWithoutTimeStamp();
    actionForm.setVoucherDate(voucherDate);
    rolesactivitydto = accountingServiceFacade.jvloadRolesActivity();
    UserContext context = getUserContext(request);
    actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
    List listOfOfficeHierarchyObject = getOfficeLevels(actionForm);
    boolean journalVoucherSave = rolesactivitydto.isEmpty();
    storingSession(request, "listOfOffices", listOfOfficeHierarchyObject);
    storingSession(request, "jvsave", journalVoucherSave);
    storingSession(request, "DebitAccountGlCodes", accountingDtos);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : GLCodeDto(org.mifos.dto.domain.GLCodeDto) UserContext(org.mifos.security.util.UserContext) JournalVoucherActionForm(org.mifos.accounting.struts.actionform.JournalVoucherActionForm) ArrayList(java.util.ArrayList) OfficesList(org.mifos.dto.domain.OfficesList) List(java.util.List) RolesActivityDto(org.mifos.dto.domain.RolesActivityDto)

Example 39 with UserContext

use of org.mifos.security.util.UserContext in project head by mifos.

the class MultipleGeneralLedgerAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    List<RolesActivityDto> rolesactivitydto = null;
    MultipleGeneralLedgerActionForm actionForm = (MultipleGeneralLedgerActionForm) form;
    actionForm.setMemberId("");
    java.util.Date trxnDate = DateUtils.getCurrentDateWithoutTimeStamp();
    actionForm.setTrxnDate(trxnDate);
    rolesactivitydto = accountingServiceFacade.glloadRolesActivity();
    boolean generalledgersave = rolesactivitydto.isEmpty();
    UserContext context = getUserContext(request);
    actionForm.setOfficeLevelId(String.valueOf(context.getOfficeLevelId()));
    List listOfOfficeHierarchyObject = getOfficeLevels(actionForm);
    storingSession(request, "listOfOffices", listOfOfficeHierarchyObject);
    storingSession(request, "officeLevelId", actionForm.getOfficeLevelId());
    storingSession(request, "glsave", generalledgersave);
    storingSession(request, "OfficesOnHierarchy", null);
    storingSession(request, "MainAccountGlCodes", null);
    storingSession(request, "AccountHeadGlCodes", null);
    storingSession(request, "DynamicOfficesOnHierarchy", null);
    storingSession(request, "SNoList", null);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) OfficesList(org.mifos.dto.domain.OfficesList) List(java.util.List) RolesActivityDto(org.mifos.dto.domain.RolesActivityDto) MultipleGeneralLedgerActionForm(org.mifos.accounting.struts.actionform.MultipleGeneralLedgerActionForm)

Example 40 with UserContext

use of org.mifos.security.util.UserContext in project head by mifos.

the class PictureFormFile method editFamilyInfo.

@TransactionDemarcate(joinToken = true)
public ActionForward editFamilyInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ClientCustActionForm actionForm = (ClientCustActionForm) form;
    actionForm.clearMostButNotAllFieldsOnActionForm();
    ClientBO clientFromSession = getClientFromSession(request);
    ClientFamilyInfoDto clientFamilyInfo = this.clientServiceFacade.retrieveFamilyInfoForEdit(clientFromSession.getGlobalCustNum());
    SessionUtils.setCollectionAttribute(ClientConstants.LIVING_STATUS_ENTITY, clientFamilyInfo.getClientDropdowns().getLivingStatus(), request);
    SessionUtils.setCollectionAttribute(ClientConstants.GENDER_ENTITY, clientFamilyInfo.getClientDropdowns().getGenders(), request);
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, new ArrayList<CustomFieldDto>(), request);
    UserContext userContext = getUserContext(request);
    List<SpouseFatherLookupEntity> spouseFather = legacyMasterDao.findMasterDataEntitiesWithLocale(SpouseFatherLookupEntity.class);
    SessionUtils.setCollectionAttribute(ClientConstants.SPOUSE_FATHER_ENTITY, spouseFather, request);
    SessionUtils.setAttribute(ClientConstants.ARE_FAMILY_DETAILS_MANDATORY, isFamilyDetailsMandatory(), request);
    // customer specific
    actionForm.setCustomerId(clientFamilyInfo.getCustomerDetail().getCustomerId().toString());
    actionForm.setLoanOfficerId(clientFamilyInfo.getCustomerDetail().getLoanOfficerIdAsString());
    actionForm.setGlobalCustNum(clientFamilyInfo.getCustomerDetail().getGlobalCustNum());
    actionForm.setExternalId(clientFamilyInfo.getCustomerDetail().getExternalId());
    // client specific
    actionForm.setGovernmentId(clientFamilyInfo.getClientDetail().getGovernmentId());
    actionForm.setDateOfBirth(clientFamilyInfo.getClientDetail().getDateOfBirth());
    actionForm.initializeFamilyMember();
    actionForm.setClientDetailView(clientFamilyInfo.getClientDetail().getCustomerDetail());
    actionForm.setClientName(clientFamilyInfo.getClientDetail().getClientName());
    actionForm.setSpouseName(clientFamilyInfo.getClientDetail().getSpouseName());
    actionForm.setCustomFields(new ArrayList<CustomFieldDto>());
    // client family specific
    int familyMemberCount = 0;
    for (ClientNameDetailDto familyMember : clientFamilyInfo.getFamilyMembers()) {
        actionForm.addFamilyMember();
        actionForm.setFamilyPrimaryKey(familyMemberCount, familyMember.getCustomerNameId());
        actionForm.setFamilyFirstName(familyMemberCount, familyMember.getFirstName());
        actionForm.setFamilyMiddleName(familyMemberCount, familyMember.getMiddleName());
        actionForm.setFamilyLastName(familyMemberCount, familyMember.getLastName());
        actionForm.setFamilySecondLastName(familyMemberCount, familyMember.getSecondLastName());
        actionForm.setFamilyRelationship(familyMemberCount, familyMember.getNameType());
        Map<Integer, List<ClientFamilyDetailDto>> clientFamilyDetailsMap = clientFamilyInfo.getClientFamilyDetails();
        Integer key = Integer.valueOf(familyMemberCount);
        List<ClientFamilyDetailDto> clientFamilyDetails = clientFamilyDetailsMap.get(key);
        if (clientFamilyDetails != null) {
            for (ClientFamilyDetailDto clientFamilyDetailDto : clientFamilyDetails) {
                Calendar cal = Calendar.getInstance();
                if (clientFamilyDetailDto.getDateOfBirth() != null) {
                    String date1 = DateUtils.makeDateAsSentFromBrowser(clientFamilyDetailDto.getDateOfBirth());
                    java.util.Date date = DateUtils.getDate(date1);
                    cal.setTime(date);
                    actionForm.setFamilyDateOfBirthDD(familyMemberCount, String.valueOf(cal.get(Calendar.DAY_OF_MONTH)));
                    actionForm.setFamilyDateOfBirthMM(familyMemberCount, String.valueOf(cal.get(Calendar.MONTH) + 1));
                    actionForm.setFamilyDateOfBirthYY(familyMemberCount, String.valueOf(cal.get(Calendar.YEAR)));
                }
                actionForm.setFamilyGender(familyMemberCount, clientFamilyDetailDto.getGender());
                actionForm.setFamilyLivingStatus(familyMemberCount, clientFamilyDetailDto.getLivingStatus());
            }
        }
        familyMemberCount++;
    }
    ClientBO client = this.customerDao.findClientBySystemId(clientFromSession.getGlobalCustNum());
    actionForm.setAddress(Address.toAddress(client.getAddress()));
    SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, client, request);
    return mapping.findForward(ActionForwards.editFamilyInfo_success.toString());
}
Also used : ClientCustActionForm(org.mifos.customers.client.struts.actionforms.ClientCustActionForm) UserContext(org.mifos.security.util.UserContext) ClientBO(org.mifos.customers.client.business.ClientBO) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) Calendar(java.util.Calendar) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) SpouseFatherLookupEntity(org.mifos.application.master.business.SpouseFatherLookupEntity) List(java.util.List) ArrayList(java.util.ArrayList) ClientFamilyInfoDto(org.mifos.dto.screen.ClientFamilyInfoDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

UserContext (org.mifos.security.util.UserContext)369 MifosUser (org.mifos.security.MifosUser)134 MifosRuntimeException (org.mifos.core.MifosRuntimeException)102 ArrayList (java.util.ArrayList)97 Test (org.junit.Test)81 BusinessRuleException (org.mifos.service.BusinessRuleException)75 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)72 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)65 AccountException (org.mifos.accounts.exceptions.AccountException)55 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)49 Money (org.mifos.framework.util.helpers.Money)46 LoanBO (org.mifos.accounts.loan.business.LoanBO)45 LocalDate (org.joda.time.LocalDate)44 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)43 ServiceException (org.mifos.framework.exceptions.ServiceException)43 PersistenceException (org.mifos.framework.exceptions.PersistenceException)38 CustomerBO (org.mifos.customers.business.CustomerBO)37 MeetingBO (org.mifos.application.meeting.business.MeetingBO)34 Date (java.util.Date)31 CustomerException (org.mifos.customers.exceptions.CustomerException)31