Search in sources :

Example 1 with VendorAddress

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

the class VendorBatchServiceImpl method updateVendorAddresses.

/*
     * update existing vendor address or create a new one if it does not exist.
     */
private void updateVendorAddresses(List<VendorBatchAddress> addresses, VendorDetail vendor, VendorDetail vDetail) {
    if (CollectionUtils.isNotEmpty(addresses)) {
        for (VendorBatchAddress address : addresses) {
            VendorAddress vendorAddr = new VendorAddress();
            LOG.info("updateVendor ADDRESS " + address + TILDA_DELIMITER + address.getVendorAddressTypeCode() + TILDA_DELIMITER + address.getVendorAddressGeneratedIdentifier());
            if (StringUtils.isNotBlank(address.getVendorAddressGeneratedIdentifier())) {
                vendorAddr = getVendorAddress(vDetail, Integer.valueOf(address.getVendorAddressGeneratedIdentifier()));
            }
            setVendorAddress(address, vendorAddr, vDetail);
            if (vendorAddr.getVendorAddressGeneratedIdentifier() == null) {
                vDetail.getVendorAddresses().add(vendorAddr);
                vendor.getVendorAddresses().add(new VendorAddress());
            }
        // TODO : how about those existing addr, but not passed from request, should they be 'inactivated' ?
        }
    }
}
Also used : VendorBatchAddress(edu.cornell.kfs.vnd.businessobject.VendorBatchAddress) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)

Example 2 with VendorAddress

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

the class VendorBatchServiceImpl method getVendorAddresses.

/*
	 * convert list of vendor address batch data to list of vendor address
	 */
private List<VendorAddress> getVendorAddresses(List<VendorBatchAddress> addresses, VendorDetail vDetail) {
    List<VendorAddress> vAddrs = new ArrayList<VendorAddress>();
    if (CollectionUtils.isNotEmpty(addresses)) {
        for (VendorBatchAddress address : addresses) {
            LOG.info("addVendor address " + address);
            VendorAddress vendorAddr = new VendorAddress();
            setVendorAddress(address, vendorAddr, vDetail);
            vAddrs.add(vendorAddr);
        }
    }
    return vAddrs;
}
Also used : ArrayList(java.util.ArrayList) VendorBatchAddress(edu.cornell.kfs.vnd.businessobject.VendorBatchAddress) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)

Example 3 with VendorAddress

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

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildTaxAddress.

private VendorAddress buildTaxAddress(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap) {
    VendorAddress taxAddress = buildBaseAddress(CUVendorConstants.CUAddressTypes.TAX, pmwVendor.getCorpAddressStreet1(), pmwVendor.getCorpAddressStreet2(), pmwVendor.getCorpAddressCity(), pmwVendor.getCorpAddressZipCode(), pmwVendor.getCorpAddressCountry(), paymentWorksIsoToFipsCountryMap);
    taxAddress = assignStateOrProvinceBasedOnCountryCode(taxAddress, pmwVendor.getCorpAddressState());
    return taxAddress;
}
Also used : VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)

Example 4 with VendorAddress

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

the class IWantDocumentFeedServiceImpl method updateDefaultVendorAddress.

private void updateDefaultVendorAddress(VendorDetail vendor) {
    VendorAddress defaultAddress = vendorService.getVendorDefaultAddress(vendor.getVendorAddresses(), vendor.getVendorHeader().getVendorType().getAddressType().getVendorAddressTypeCode(), "");
    if (ObjectUtils.isNotNull(defaultAddress)) {
        if (ObjectUtils.isNotNull(defaultAddress.getVendorState())) {
            vendor.setVendorStateForLookup(defaultAddress.getVendorState().getName());
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Warning - unable to retrieve state for " + defaultAddress.getVendorCountryCode() + " / " + defaultAddress.getVendorStateCode());
            }
            vendor.setVendorStateForLookup("");
        }
        vendor.setDefaultAddressLine1(defaultAddress.getVendorLine1Address());
        vendor.setDefaultAddressLine2(defaultAddress.getVendorLine2Address());
        vendor.setDefaultAddressCity(defaultAddress.getVendorCityName());
        vendor.setDefaultAddressPostalCode(defaultAddress.getVendorZipCode());
        vendor.setDefaultAddressStateCode(defaultAddress.getVendorStateCode());
        vendor.setDefaultAddressInternationalProvince(defaultAddress.getVendorAddressInternationalProvinceName());
        vendor.setDefaultAddressCountryCode(defaultAddress.getVendorCountryCode());
        vendor.setDefaultFaxNumber(defaultAddress.getVendorFaxNumber());
    } else {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Warning - default vendor address was null for " + vendor.getVendorNumber() + " / " + vendor.getVendorHeader().getVendorType().getAddressType().getVendorAddressTypeCode());
        }
        vendor.setVendorStateForLookup("");
    }
}
Also used : VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)

Example 5 with VendorAddress

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

the class DisbursementVoucherAction method setupPayeeAsVendor.

/**
 * setup the payee as a vendor with the given id number and address id
 */
protected void setupPayeeAsVendor(DisbursementVoucherForm dvForm, String payeeIdNumber, String payeeAddressIdentifier) {
    VendorDetail vendorDetail = new VendorDetail();
    vendorDetail.setVendorNumber(payeeIdNumber);
    vendorDetail = (VendorDetail) SpringContext.getBean(BusinessObjectService.class).retrieve(vendorDetail);
    VendorAddress vendorAddress = new VendorAddress();
    if (StringUtils.isNotBlank(payeeAddressIdentifier)) {
        try {
            vendorAddress.setVendorAddressGeneratedIdentifier(new Integer(payeeAddressIdentifier));
            vendorAddress = (VendorAddress) SpringContext.getBean(BusinessObjectService.class).retrieve(vendorAddress);
            dvForm.setTempPayeeIdNumber(payeeIdNumber);
            dvForm.setOldPayeeType(KFSConstants.PaymentPayeeTypes.VENDOR);
        } catch (Exception e) {
            LOG.error("Exception while attempting to retrieve vendor address for vendor address id " + payeeAddressIdentifier + ": " + e);
        }
    }
    ((DisbursementVoucherDocument) dvForm.getDocument()).templateVendor(vendorDetail, vendorAddress);
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress) WorkflowException(org.kuali.kfs.kew.api.exception.WorkflowException) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)35 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)13 HashMap (java.util.HashMap)6 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)6 Iterator (java.util.Iterator)5 List (java.util.List)5 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)5 VendorContract (org.kuali.kfs.vnd.businessobject.VendorContract)5 VendorService (org.kuali.kfs.vnd.document.service.VendorService)5 ArrayList (java.util.ArrayList)4 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)3 Map (java.util.Map)3 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)3 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)3 PersistenceService (org.kuali.kfs.krad.service.PersistenceService)3 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)3 VendorDefaultAddress (org.kuali.kfs.vnd.businessobject.VendorDefaultAddress)3 CuVendorAddressExtension (edu.cornell.kfs.vnd.businessobject.CuVendorAddressExtension)2 VendorBatchAddress (edu.cornell.kfs.vnd.businessobject.VendorBatchAddress)2 Date (java.util.Date)2