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' ?
}
}
}
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;
}
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;
}
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("");
}
}
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);
}
Aggregations