Search in sources :

Example 6 with JournalVoucherActionForm

use of org.mifos.accounting.struts.actionform.JournalVoucherActionForm in project head by mifos.

the class JournalVoucherAction method loadOffices.

public ActionForward loadOffices(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    JournalVoucherActionForm actionForm = (JournalVoucherActionForm) form;
    UserContext userContext = getUserContext(request);
    //List<OfficeGlobalDto> officeDetailsDtos = null;
    List<OfficeGlobalDto> dynamicOfficeDetailsDtos = null;
    List<OfficesList> offices = new ArrayList<OfficesList>();
    // list of offices for a single parent office
    List<DynamicOfficeDto> listOfOffices = null;
    listOfOffices = accountingServiceFacade.getOfficeDetails(String.valueOf(userContext.getBranchId()), String.valueOf(userContext.getOfficeLevelId()));
    OfficesList officesList = null;
    for (DynamicOfficeDto officeDto : listOfOffices) {
        if (actionForm.getOfficeHierarchy().equals("")) {
            offices = null;
        // to recognise center and group
        } else if (actionForm.getOfficeHierarchy().equals("6") || actionForm.getOfficeHierarchy().equals("7")) {
            if (actionForm.getOfficeHierarchy().equals(String.valueOf(officeDto.getOfficeLevelId()))) {
                officesList = new OfficesList(officeDto.getCustomerId(), officeDto.getDisplayName(), officeDto.getCustomerLevelId(), officeDto.getGlobalCustomerNumber());
                offices.add(officesList);
            }
        } else {
            if (actionForm.getOfficeHierarchy().equals(String.valueOf(officeDto.getOfficeLevelId()))) {
                officesList = new OfficesList(officeDto.getOfficeId(), officeDto.getDisplayName(), officeDto.getOfficeLevelId(), officeDto.getGlobalOfficeNumber());
                offices.add(officesList);
            }
        }
    }
    //		storingSession(request, "OfficesOnHierarchy", officeDetailsDtos);
    storingSession(request, "DynamicOfficesOnHierarchy", offices);
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : OfficeGlobalDto(org.mifos.dto.domain.OfficeGlobalDto) OfficesList(org.mifos.dto.domain.OfficesList) UserContext(org.mifos.security.util.UserContext) JournalVoucherActionForm(org.mifos.accounting.struts.actionform.JournalVoucherActionForm) ArrayList(java.util.ArrayList) DynamicOfficeDto(org.mifos.dto.domain.DynamicOfficeDto)

Aggregations

JournalVoucherActionForm (org.mifos.accounting.struts.actionform.JournalVoucherActionForm)6 ArrayList (java.util.ArrayList)2 GLCodeDto (org.mifos.dto.domain.GLCodeDto)2 OfficesList (org.mifos.dto.domain.OfficesList)2 UserContext (org.mifos.security.util.UserContext)2 List (java.util.List)1 DynamicOfficeDto (org.mifos.dto.domain.DynamicOfficeDto)1 OfficeGlobalDto (org.mifos.dto.domain.OfficeGlobalDto)1 RolesActivityDto (org.mifos.dto.domain.RolesActivityDto)1