Search in sources :

Example 1 with DisbursementPayee

use of org.kuali.kfs.fp.businessobject.DisbursementPayee in project cu-kfs by CU-CommunityApps.

the class CuDisbursementPayeeLookupableHelperServiceImpl method getVendorsAsPayees.

protected List<DisbursementPayee> getVendorsAsPayees(Map<String, String> fieldValues) {
    List<DisbursementPayee> payeeList = new ArrayList<DisbursementPayee>();
    Map<String, String> fieldsForLookup = this.getVendorFieldValues(fieldValues);
    vendorLookupable.setBusinessObjectClass(VendorDetail.class);
    vendorLookupable.validateSearchParameters(fieldsForLookup);
    List<? extends BusinessObject> vendorList = vendorLookupable.getSearchResults(fieldsForLookup);
    for (BusinessObject vendor : vendorList) {
        VendorDetail vendorDetail = (VendorDetail) vendor;
        CuDisbursementPayee payee = getPayeeFromVendor(vendorDetail, fieldValues);
        payeeList.add(payee);
    }
    return payeeList;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) ArrayList(java.util.ArrayList) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee) BusinessObject(org.kuali.rice.krad.bo.BusinessObject)

Example 2 with DisbursementPayee

use of org.kuali.kfs.fp.businessobject.DisbursementPayee in project cu-kfs by CU-CommunityApps.

the class CuDisbursementPayeeLookupableHelperServiceImpl method getPayeeFromPerson.

protected CuDisbursementPayee getPayeeFromPerson(Person personDetail, Map<String, String> fieldValues, String payeeTypeCode) {
    DisbursementPayee payee = ((CuDisbursementVoucherPayeeService) disbursementVoucherPayeeService).getPayeeFromPerson(personDetail, payeeTypeCode);
    payee.setPaymentReasonCode(fieldValues.get(KFSPropertyConstants.PAYMENT_REASON_CODE));
    return (CuDisbursementPayee) payee;
}
Also used : CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) CuDisbursementVoucherPayeeService(edu.cornell.kfs.fp.document.service.CuDisbursementVoucherPayeeService) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee)

Example 3 with DisbursementPayee

use of org.kuali.kfs.fp.businessobject.DisbursementPayee in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherPayeeServiceImplTest method testService.

public void testService() {
    Person alumni = null;
    Person student = null;
    Person employee = null;
    boolean isAlumni = false;
    boolean isStudent = false;
    boolean isEmployee = false;
    List alumniResults = unitTestSqlDao.sqlSelect(alumniSql);
    Object aresult = alumniResults.get(0);
    String[] asplit = aresult.toString().split(",");
    String[] aFdocSplit = asplit[0].split("=");
    String aFdoc = aFdocSplit[1].replaceAll(",", "");
    aFdoc = aFdoc.trim();
    String[] aIdSplit = asplit[1].split("=");
    String aentid = aIdSplit[1].replaceAll("}", "");
    aentid = aentid.trim();
    alumniResults.clear();
    List studentResults = unitTestSqlDao.sqlSelect(studentSql);
    Object sresult = studentResults.get(0);
    String[] stSplit = sresult.toString().split(",");
    String[] sFdocSplit = stSplit[0].split("=");
    String sFdoc = sFdocSplit[1].replaceAll(",", "");
    sFdoc = sFdoc.trim();
    String[] sIdSplit = stSplit[1].split("=");
    String sentid = sIdSplit[1].replaceAll("}", "");
    sentid = sentid.trim();
    studentResults.clear();
    List employeeResults = unitTestSqlDao.sqlSelect(employeeSql);
    Object eresult = employeeResults.get(0);
    String[] esplit = eresult.toString().split(",");
    String[] eFdocSplit = esplit[0].split("=");
    String eFdoc = eFdocSplit[1].replaceAll(",", "");
    eFdoc = eFdoc.trim();
    String[] eIdSplit = esplit[1].split("=");
    String emEmpid = eIdSplit[1].replaceAll("}", "");
    emEmpid = emEmpid.trim();
    employeeResults.clear();
    List<Person> people;
    people = personService.findPeople(Collections.singletonMap(KIMPropertyConstants.Person.ENTITY_ID, aentid));
    alumni = people.get(0);
    people.clear();
    people = personService.findPeople(Collections.singletonMap(KIMPropertyConstants.Person.ENTITY_ID, sentid));
    student = people.get(0);
    people.clear();
    people = personService.findPeople(Collections.singletonMap(KIMPropertyConstants.Person.EMPLOYEE_ID, emEmpid));
    employee = people.get(0);
    DisbursementPayee alumniPayee = cuDisbursementVoucherPayeeService.getPayeeFromPerson(alumni);
    CuDisbursementPayee cuAlumniPayee = (CuDisbursementPayee) cuDisbursementVoucherPayeeService.getPayeeFromPerson(alumni, "A");
    DisbursementPayee studentPayee = cuDisbursementVoucherPayeeService.getPayeeFromPerson(student);
    CuDisbursementPayee cuStudentPayee = (CuDisbursementPayee) cuDisbursementVoucherPayeeService.getPayeeFromPerson(student, "S");
    DisbursementPayee employeePayee = cuDisbursementVoucherPayeeService.getPayeeFromPerson(employee);
    CuDisbursementPayee cuEmployeePayee = (CuDisbursementPayee) cuDisbursementVoucherPayeeService.getPayeeFromPerson(employee, employeePayee.getPayeeTypeCode());
    isAlumni = cuDisbursementVoucherPayeeService.isAlumni(cuAlumniPayee);
    isStudent = cuDisbursementVoucherPayeeService.isStudent(cuStudentPayee);
    isEmployee = cuDisbursementVoucherPayeeService.isEmployee(cuEmployeePayee);
    // test affliation check by payee
    assertTrue(isAlumni);
    assertTrue(isStudent);
    assertTrue(isEmployee);
    isAlumni = false;
    isStudent = false;
    isEmployee = false;
    // Test getpayeefrom person sets principal name
    assertTrue(student.getPrincipalName().equalsIgnoreCase(cuStudentPayee.getPrincipalName()));
    assertTrue(alumni.getPrincipalName().equalsIgnoreCase(cuAlumniPayee.getPrincipalName()));
    CuDisbursementVoucherDocument dvA = businessObjectService.findBySinglePrimaryKey(CuDisbursementVoucherDocument.class, aFdoc);
    System.out.println("FDOC number  " + aFdoc);
    System.out.println("DV Payee detail " + dvA.getDvPayeeDetail());
    isAlumni = cuDisbursementVoucherPayeeService.isAlumni(dvA.getDvPayeeDetail());
    CuDisbursementVoucherDocument dvS = businessObjectService.findBySinglePrimaryKey(CuDisbursementVoucherDocument.class, sFdoc);
    isStudent = cuDisbursementVoucherPayeeService.isStudent(dvS.getDvPayeeDetail());
    CuDisbursementVoucherDocument dvE = businessObjectService.findBySinglePrimaryKey(CuDisbursementVoucherDocument.class, eFdoc);
    isEmployee = cuDisbursementVoucherPayeeService.isEmployee(dvE.getDvPayeeDetail());
    // test affliation check by dvpayeedetail
    assertTrue(isAlumni);
    assertTrue(isStudent);
    assertTrue(isEmployee);
}
Also used : CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) List(java.util.List) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee) Person(org.kuali.rice.kim.api.identity.Person)

Example 4 with DisbursementPayee

use of org.kuali.kfs.fp.businessobject.DisbursementPayee in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherPayeeServiceImpl method getPayeeFromPerson.

public DisbursementPayee getPayeeFromPerson(Person person, String payeeTypeCode) {
    CuDisbursementPayee disbursementPayee = new CuDisbursementPayee();
    disbursementPayee.setActive(person.isActive());
    Collection<String> payableEmplStatusCodes = SpringContext.getBean(ParameterService.class).getParameterValuesAsString(CuDisbursementVoucherDocument.class, CuDisbursementVoucherConstants.ALLOWED_EMPLOYEE_STATUSES_FOR_PAYMENT);
    if (StringUtils.equalsIgnoreCase(payeeTypeCode, KFSConstants.PaymentPayeeTypes.EMPLOYEE) && StringUtils.isNotBlank(person.getEmployeeId()) && payableEmplStatusCodes.contains(person.getEmployeeStatusCode())) {
        disbursementPayee.setPayeeIdNumber(person.getEmployeeId());
    } else {
        disbursementPayee.setPayeeIdNumber(person.getPrincipalId());
    }
    disbursementPayee.setPrincipalId(person.getPrincipalId());
    disbursementPayee.setPrincipalName(person.getPrincipalName());
    disbursementPayee.setPayeeName(person.getNameUnmasked());
    disbursementPayee.setTaxNumber(KFSConstants.BLANK_SPACE);
    disbursementPayee.setPayeeTypeCode(KFSConstants.PaymentPayeeTypes.EMPLOYEE);
    disbursementPayee.setPayeeTypeCode(payeeTypeCode);
    String personAddress = MessageFormat.format(addressPattern, person.getAddressLine1Unmasked(), person.getAddressCityUnmasked(), person.getAddressStateProvinceCodeUnmasked(), person.getAddressCountryCode() == null ? "" : person.getAddressCountryCode());
    disbursementPayee.setAddress(personAddress);
    return (DisbursementPayee) disbursementPayee;
}
Also used : CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee)

Example 5 with DisbursementPayee

use of org.kuali.kfs.fp.businessobject.DisbursementPayee in project cu-kfs by CU-CommunityApps.

the class CuDisbursementPayeeLookupableHelperServiceImpl method getPersonAsPayees.

@Override
protected List<DisbursementPayee> getPersonAsPayees(Map<String, String> fieldValues) {
    List<DisbursementPayee> payeeList = new ArrayList<DisbursementPayee>();
    Map<String, String> fieldsForLookup = this.getPersonFieldValues(fieldValues);
    List<Person> persons = SpringContext.getBean(PersonService.class).findPeople(fieldsForLookup);
    boolean warningExists = false;
    for (Person personDetail : persons) {
        for (EntityAffiliationContract entityAffiliation : ((PersonImpl) personDetail).getAffiliations()) {
            if (entityAffiliation.isDefaultValue()) {
                if (StringUtils.equalsIgnoreCase(entityAffiliation.getAffiliationType().getCode(), CuDisbursementVoucherConstants.PayeeAffiliations.STUDENT)) {
                    CuDisbursementPayee payee = getPayeeFromPerson(personDetail, fieldValues, CuDisbursementVoucherConstants.DV_PAYEE_TYPE_STUDENT);
                    payeeList.add(payee);
                } else if (StringUtils.equalsIgnoreCase(entityAffiliation.getAffiliationType().getCode(), CuDisbursementVoucherConstants.PayeeAffiliations.ALUMNI)) {
                    CuDisbursementPayee payee = getPayeeFromPerson(personDetail, fieldValues, CuDisbursementVoucherConstants.DV_PAYEE_TYPE_ALUMNI);
                    payeeList.add(payee);
                } else if (StringUtils.equalsIgnoreCase(entityAffiliation.getAffiliationType().getCode(), CuDisbursementVoucherConstants.PayeeAffiliations.FACULTY) || StringUtils.equalsIgnoreCase(entityAffiliation.getAffiliationType().getCode(), CuDisbursementVoucherConstants.PayeeAffiliations.STAFF)) {
                    if (StringUtils.isNotBlank(personDetail.getEmployeeStatusCode()) && (personDetail.getEmployeeStatusCode().equals(ACTIVE)) || personDetail.getEmployeeStatusCode().equals(RETIRED)) {
                        CuDisbursementPayee payee = getPayeeFromPerson(personDetail, fieldValues, DisbursementVoucherConstants.DV_PAYEE_TYPE_EMPLOYEE);
                        payeeList.add(payee);
                    } else {
                        if (GlobalVariables.getMessageMap().containsMessageKey(CUKFSKeyConstants.WARNING_DV_PAYEE_MUST_BE_ACTIVE)) {
                            warningExists = true;
                            break;
                        }
                    }
                    if (!warningExists) {
                        GlobalVariables.getMessageMap().putWarningWithoutFullErrorPath(KFSPropertyConstants.PRINCIPAL_ID, CUKFSKeyConstants.WARNING_DV_PAYEE_MUST_BE_ACTIVE);
                    }
                }
                break;
            }
        }
    }
    return payeeList;
}
Also used : EntityAffiliationContract(org.kuali.rice.kim.api.identity.affiliation.EntityAffiliationContract) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) PersonImpl(org.kuali.rice.kim.impl.identity.PersonImpl) PersonService(org.kuali.rice.kim.api.identity.PersonService) ArrayList(java.util.ArrayList) CuDisbursementPayee(edu.cornell.kfs.fp.businessobject.CuDisbursementPayee) DisbursementPayee(org.kuali.kfs.fp.businessobject.DisbursementPayee) Person(org.kuali.rice.kim.api.identity.Person)

Aggregations

DisbursementPayee (org.kuali.kfs.fp.businessobject.DisbursementPayee)6 CuDisbursementPayee (edu.cornell.kfs.fp.businessobject.CuDisbursementPayee)5 ArrayList (java.util.ArrayList)3 Person (org.kuali.rice.kim.api.identity.Person)2 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)1 CuDisbursementVoucherPayeeService (edu.cornell.kfs.fp.document.service.CuDisbursementVoucherPayeeService)1 List (java.util.List)1 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)1 CollectionIncomplete (org.kuali.kfs.krad.lookup.CollectionIncomplete)1 BeanPropertyComparator (org.kuali.kfs.krad.util.BeanPropertyComparator)1 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)1 PersonService (org.kuali.rice.kim.api.identity.PersonService)1 EntityAffiliationContract (org.kuali.rice.kim.api.identity.affiliation.EntityAffiliationContract)1 PersonImpl (org.kuali.rice.kim.impl.identity.PersonImpl)1 BusinessObject (org.kuali.rice.krad.bo.BusinessObject)1