use of org.mifos.dto.domain.CenterCreation in project head by mifos.
the class ClientServiceFacadeWebTier method retrieveMfiInfoForEdit.
@Override
public ClientMfiInfoDto retrieveMfiInfoForEdit(String clientSystemId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
String groupDisplayName = "";
String centerDisplayName = "";
if (client.getParentCustomer() != null) {
groupDisplayName = client.getParentCustomer().getDisplayName();
if (client.getParentCustomer().getParentCustomer() != null) {
centerDisplayName = client.getParentCustomer().getParentCustomer().getDisplayName();
}
}
List<PersonnelDto> loanOfficersList = new ArrayList<PersonnelDto>();
if (!client.isClientUnderGroup()) {
CenterCreation centerCreation = new CenterCreation(client.getOffice().getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
loanOfficersList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
}
CustomerDetailDto customerDetail = client.toCustomerDetailDto();
ClientDetailDto clientDetail = client.toClientDetailDto(ClientRules.isFamilyDetailsRequired());
return new ClientMfiInfoDto(groupDisplayName, centerDisplayName, loanOfficersList, customerDetail, clientDetail);
}
use of org.mifos.dto.domain.CenterCreation in project head by mifos.
the class ClientServiceFacadeWebTier method retreiveClientDetailsForRemovalFromGroup.
@Override
public ClientRemovalFromGroupDto retreiveClientDetailsForRemovalFromGroup(String globalCustNum) {
try {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
ClientBO client = this.customerDao.findClientBySystemId(globalCustNum);
client.updateDetails(userContext);
client.checkIfClientIsATitleHolder();
List<OfficeDetailsDto> activeBranches = this.officeDao.findActiveBranches(userContext.getBranchId());
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
boolean isActive = client.isActive();
Short loanOfficerId = client.getPersonnel().getPersonnelId();
CenterCreation clientDetails = new CenterCreation(client.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
List<PersonnelDto> loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(clientDetails);
return new ClientRemovalFromGroupDto(client.getGlobalCustNum(), isActive, isCenterHierarchyExists, loanOfficerId, loanOfficers, activeBranches);
} catch (CustomerException e) {
throw new BusinessRuleException(e.getKey(), e);
}
}
use of org.mifos.dto.domain.CenterCreation in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveAllActiveBranchesAndLoanOfficerDetails.
@Override
public ChangeAccountStatusDto retrieveAllActiveBranchesAndLoanOfficerDetails() {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
List<PersonnelDto> loanOfficers = new ArrayList<PersonnelDto>();
List<OfficeDetailsDto> activeBranches = this.officeDao.findActiveBranches(userContext.getBranchId());
if (onlyOneActiveBranchExists(activeBranches)) {
OfficeDetailsDto singleOffice = activeBranches.get(0);
CenterCreation officeDetails = new CenterCreation(singleOffice.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
}
boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
if (loanPendingApprovalStateEnabled) {
accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
}
boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
return new ChangeAccountStatusDto(activeBranches, loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
use of org.mifos.dto.domain.CenterCreation in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveLoanOfficerDetailsForBranch.
@Override
public ChangeAccountStatusDto retrieveLoanOfficerDetailsForBranch(Short officeId) {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
CenterCreation officeDetails = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
List<PersonnelDto> loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
if (loanPendingApprovalStateEnabled) {
accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
}
boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
return new ChangeAccountStatusDto(new ArrayList<OfficeDetailsDto>(), loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
use of org.mifos.dto.domain.CenterCreation in project head by mifos.
the class GroupServiceFacadeWebTier method retrieveGroupDetailsForUpdate.
@Override
public CenterDto retrieveGroupDetailsForUpdate(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
List<PersonnelDto> activeLoanOfficersForBranch = new ArrayList<PersonnelDto>();
GroupBO group = this.customerDao.findGroupBySystemId(globalCustNum);
Short officeId = group.getOffice().getOfficeId();
String searchId = group.getSearchId();
Short loanOfficerId = extractLoanOfficerId(group);
boolean isCenterHierarchyExists = ClientRules.getCenterHierarchyExists();
if (!isCenterHierarchyExists) {
CenterCreation centerCreation = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
activeLoanOfficersForBranch = personnelDao.findActiveLoanOfficersForOffice(centerCreation);
}
List<CustomerDto> customerList = customerDao.findClientsThatAreNotCancelledOrClosed(searchId, officeId);
List<CustomerPositionDto> customerPositionDtos = generateCustomerPositionViews(group, userContext.getLocaleId());
DateTime mfiJoiningDate = new DateTime();
String mfiJoiningDateAsString = "";
if (group.getMfiJoiningDate() != null) {
mfiJoiningDate = new DateTime(group.getMfiJoiningDate());
mfiJoiningDateAsString = DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), group.getMfiJoiningDate().toString());
}
AddressDto address = null;
if (group.getAddress() != null) {
address = Address.toDto(group.getAddress());
}
return new CenterDto(loanOfficerId, group.getCustomerId(), group.getGlobalCustNum(), mfiJoiningDate, mfiJoiningDateAsString, group.getExternalId(), address, customerPositionDtos, customerList, activeLoanOfficersForBranch, isCenterHierarchyExists);
}
Aggregations