Search in sources :

Example 1 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class VendorBatchServiceImpl method getVendorContacts.

/*
	 * convert list of vendor batch contacts to vendor contacts
	 */
private List<VendorContact> getVendorContacts(List<VendorBatchContact> contacts) {
    ArrayList<VendorContact> vendorContacts = new ArrayList<VendorContact>();
    if (CollectionUtils.isNotEmpty(contacts)) {
        for (VendorBatchContact contact : contacts) {
            LOG.info("addVendor contact " + contact);
            VendorContact vContact = new VendorContact();
            setVendorContact(contact, vContact, new VendorContact());
            vendorContacts.add(vContact);
        }
    }
    return vendorContacts;
}
Also used : VendorBatchContact(edu.cornell.kfs.vnd.businessobject.VendorBatchContact) ArrayList(java.util.ArrayList) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact)

Example 2 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class VendorBatchServiceImpl method updateVendorContacts.

/*
     * update existing vendor contact or create a new one if it does not exist.
     */
private void updateVendorContacts(List<VendorBatchContact> contacts, VendorDetail oldVendorDetail, VendorDetail vDetail) {
    if (CollectionUtils.isNotEmpty(contacts)) {
        for (VendorBatchContact contact : contacts) {
            LOG.info("updateVendor contact " + contact + TILDA_DELIMITER + contact.getVendorContactGeneratedIdentifier() + TILDA_DELIMITER + contact.getVendorContactName());
            VendorContact vContact = new VendorContact();
            VendorContact vOldContact = new VendorContact();
            if (StringUtils.isNotBlank(contact.getVendorContactGeneratedIdentifier()) && StringUtils.isNumeric(contact.getVendorContactGeneratedIdentifier())) {
                vContact = getVendorContact(vDetail, Integer.valueOf(contact.getVendorContactGeneratedIdentifier()));
                vOldContact = getVendorContact(oldVendorDetail, Integer.valueOf(contact.getVendorContactGeneratedIdentifier()));
            }
            setVendorContact(contact, vContact, vOldContact);
            if (vContact.getVendorContactGeneratedIdentifier() == null) {
                vDetail.getVendorContacts().add(vContact);
                oldVendorDetail.getVendorContacts().add(new VendorContact());
            }
        }
    }
}
Also used : VendorBatchContact(edu.cornell.kfs.vnd.businessobject.VendorBatchContact) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact)

Example 3 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class PaymentWorksBatchUtilityServiceImpl method populateContactEmail.

private void populateContactEmail(PaymentWorksVendor pmwVendor, VendorDetail vendorDetail) {
    List<VendorContact> vendorInformationContacts = findAllActiveVendorInformationContacts(vendorDetail.getVendorContacts());
    if (ObjectUtils.isNotNull(vendorInformationContacts) && vendorInformationContacts.size() == 1) {
        VendorContact vendorContact = vendorInformationContacts.get(0);
        pmwVendor.setVendorInformationEmail(vendorContact.getVendorContactEmailAddress());
    } else {
        LOG.error("populateContactEmail: KFS Approved PVEN does not contain one and only one Active Vendor Information Contact for vendor " + vendorDetail.getVendorHeaderGeneratedIdentifier() + "-" + vendorDetail.getVendorDetailAssignedIdentifier());
    }
}
Also used : VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact)

Example 4 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildContact.

protected VendorContact buildContact(String contactType, String contactPhoneType, String contactName, String contactEmailAddress, String contactPhoneNumber, String contactPhoneExtension) {
    List<VendorContactPhoneNumber> vendorContactPhoneNumbers = new ArrayList<VendorContactPhoneNumber>();
    if (StringUtils.isNotBlank(contactPhoneNumber)) {
        LOG.debug("buildContact, there is a phone number, so add a VendorContactPhoneNumber");
        vendorContactPhoneNumbers.add(buildContactPhoneNumber(contactPhoneType, contactPhoneNumber, contactPhoneExtension));
    }
    VendorContact contact = new VendorContact();
    contact.setVendorContactPhoneNumbers(vendorContactPhoneNumbers);
    contact.setVendorContactTypeCode(contactType);
    contact.setVendorContactName(truncateValueToMaxLength(contactName, CUVendorConstants.MAX_VENDOR_CONTACT_NAME_LENGTH));
    contact.setVendorContactEmailAddress(contactEmailAddress);
    contact.setActive(true);
    return contact;
}
Also used : VendorContactPhoneNumber(org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber) ArrayList(java.util.ArrayList) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact)

Example 5 with VendorContact

use of org.kuali.kfs.vnd.businessobject.VendorContact in project cu-kfs by CU-CommunityApps.

the class VendorRule method refreshSubObjects.

/**
 * Refreshes the references of vendor detail and its sub objects
 *
 * @param vendor VendorDetail document
 */
protected void refreshSubObjects(VendorDetail vendor) {
    if (vendor == null) {
        return;
    }
    // division vendor
    if (!vendor.isVendorParentIndicator()) {
        vendor.refreshNonUpdateableReferences();
        vendor.getVendorHeader().refreshNonUpdateableReferences();
    } else {
        // Retrieve the references objects of the vendor header of this vendor.
        List<String> headerFieldNames = getObjectReferencesListFromBOClass(VendorHeader.class);
        vendor.getVendorHeader().refreshNonUpdateableReferences();
        getPersistenceService().retrieveReferenceObjects(vendor.getVendorHeader(), headerFieldNames);
        // We still need to retrieve all the other references of this vendor in addition to
        // vendor header. Since this is a parent vendor, whose vendor header saving is handled manually,
        // we have already retrieved references for vendor header's attributes above, so we should
        // exclude retrieving reference objects of vendor header.
        List<String> detailFieldNames = getObjectReferencesListFromBOClass(vendor.getClass());
        detailFieldNames.remove(VendorConstants.VENDOR_HEADER_ATTR);
        getPersistenceService().retrieveReferenceObjects(vendor, detailFieldNames);
    }
    // refresh addresses
    if (vendor.getVendorAddresses() != null) {
        for (VendorAddress address : vendor.getVendorAddresses()) {
            address.refreshNonUpdateableReferences();
            if (address.getVendorDefaultAddresses() != null) {
                for (VendorDefaultAddress defaultAddress : address.getVendorDefaultAddresses()) {
                    defaultAddress.refreshNonUpdateableReferences();
                }
            }
        }
    }
    // refresh contacts
    if (vendor.getVendorContacts() != null) {
        for (VendorContact contact : vendor.getVendorContacts()) {
            contact.refreshNonUpdateableReferences();
            // ==== CU Customization ====
            if (contact.getVendorContactPhoneNumbers() != null) {
                for (VendorContactPhoneNumber contactPhoneNumber : contact.getVendorContactPhoneNumbers()) {
                    contactPhoneNumber.refreshNonUpdateableReferences();
                }
            }
        // ==== End of CU Customization Section ====
        }
    }
    // refresh contracts
    if (vendor.getVendorContracts() != null) {
        for (VendorContract contract : vendor.getVendorContracts()) {
            contract.refreshNonUpdateableReferences();
        }
    }
}
Also used : VendorContactPhoneNumber(org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber) VendorContract(org.kuali.kfs.vnd.businessobject.VendorContract) VendorContact(org.kuali.kfs.vnd.businessobject.VendorContact) VendorDefaultAddress(org.kuali.kfs.vnd.businessobject.VendorDefaultAddress) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)

Aggregations

VendorContact (org.kuali.kfs.vnd.businessobject.VendorContact)10 VendorContactPhoneNumber (org.kuali.kfs.vnd.businessobject.VendorContactPhoneNumber)5 Test (org.junit.jupiter.api.Test)4 VendorBatchContact (edu.cornell.kfs.vnd.businessobject.VendorBatchContact)2 ArrayList (java.util.ArrayList)2 VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)1 VendorContract (org.kuali.kfs.vnd.businessobject.VendorContract)1 VendorDefaultAddress (org.kuali.kfs.vnd.businessobject.VendorDefaultAddress)1 AutoPopulatingList (org.springframework.util.AutoPopulatingList)1