use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class CuVendorRule method processCuAddressValidation.
// CU enhancement related po transmission KFSUPGRADE-348
// can't override processAddressValidation because it has no modifier, so only class/package can access it.
boolean processCuAddressValidation(MaintenanceDocument document) {
boolean valid = true;
VendorDetail newVendor = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
List<VendorAddress> addresses = newVendor.getVendorAddresses();
String vendorTypeCode = newVendor.getVendorHeader().getVendorTypeCode();
String vendorAddressTypeRequiredCode = newVendor.getVendorHeader().getVendorType().getVendorAddressTypeRequiredCode();
verifyPOTransmissionTypeAllowedForVendorType(vendorTypeCode, addresses);
for (int i = 0; i < addresses.size(); i++) {
VendorAddress address = addresses.get(i);
String errorPath = MAINTAINABLE_ERROR_PREFIX + VendorPropertyConstants.VENDOR_ADDRESS + "[" + i + "]";
GlobalVariables.getMessageMap().clearErrorPath();
GlobalVariables.getMessageMap().addToErrorPath(errorPath);
String propertyName = VendorPropertyConstants.VENDOR_ADDRESS + "[" + i + "].";
valid &= checkAddressMethodOfPOTransmissionAndData(vendorTypeCode, vendorAddressTypeRequiredCode, address, propertyName);
GlobalVariables.getMessageMap().clearErrorPath();
}
return valid;
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class CuVendorRule method verifyPOTransmissionTypeAllowedForVendorType.
/**
* Method verifies that only vendors of type purchase order have method of PO transmission set for their address type.
*/
private void verifyPOTransmissionTypeAllowedForVendorType(String vendorTypeCode, List<VendorAddress> addresses) {
// Check that there is at least one PO Address Type specified when the Vendor Type is PO
if ((!StringUtils.isBlank(vendorTypeCode)) && StringUtils.equals(vendorTypeCode, KFSConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER)) {
boolean poAddressExistsForPOVendor = false;
int i = 0;
while ((i < addresses.size()) && !poAddressExistsForPOVendor) {
VendorAddress address = addresses.get(i);
if ((!StringUtils.isBlank(address.getVendorAddressTypeCode())) && (StringUtils.equals(address.getVendorAddressTypeCode(), KFSConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER))) {
poAddressExistsForPOVendor = true;
}
i++;
}
if (!poAddressExistsForPOVendor) {
// display error message
putFieldError(VendorPropertyConstants.VENDOR_TYPE_CODE, CUVendorKeyConstants.ERROR_PO_TRANSMISSION_REQUIRES_PO_ADDRESS);
}
}
// Check that there are no PO Transmission Method values set when the Vendor Type is not PO
if ((!StringUtils.isBlank(vendorTypeCode)) && (!StringUtils.equals(vendorTypeCode, KFSConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER))) {
boolean poTransmissionMethodExistsForVendor = false;
int i = 0;
while ((i < addresses.size()) && !poTransmissionMethodExistsForVendor) {
VendorAddress address = addresses.get(i);
if ((!StringUtils.isBlank(((CuVendorAddressExtension) address.getExtension()).getPurchaseOrderTransmissionMethodCode())) && (!StringUtils.equals(((CuVendorAddressExtension) address.getExtension()).getPurchaseOrderTransmissionMethodCode(), KFSConstants.FinancialDocumentTypeCodes.PURCHASE_ORDER))) {
poTransmissionMethodExistsForVendor = true;
}
i++;
}
if (poTransmissionMethodExistsForVendor) {
// display error message
putFieldError(VendorPropertyConstants.VENDOR_TYPE_CODE, CUVendorKeyConstants.ERROR_PO_TRANMSISSION_NOT_ALLOWED_FOR_VENDOR_TYPE);
}
}
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class CuVendorMaintainableImpl method populateGeneratedAddressId.
private void populateGeneratedAddressId(VendorDetail vendorDetail) {
if (CollectionUtils.isNotEmpty(vendorDetail.getVendorAddresses())) {
for (VendorAddress vendorAddress : vendorDetail.getVendorAddresses()) {
if (vendorAddress.getVendorAddressGeneratedIdentifier() == null) {
Integer generatedHeaderId = SpringContext.getBean(SequenceAccessorService.class).getNextAvailableSequenceNumber(ADDRESS_HEADER_ID_SEQ).intValue();
vendorAddress.setVendorAddressGeneratedIdentifier(generatedHeaderId);
((CuVendorAddressExtension) vendorAddress.getExtension()).setVendorAddressGeneratedIdentifier(generatedHeaderId);
}
}
}
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildTaxAddressFromIsoCountryData.
private VendorAddress buildTaxAddressFromIsoCountryData(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap) {
VendorAddress taxAddress = buildBaseAddress(CUVendorConstants.CUAddressTypes.TAX, pmwVendor.getCorpAddressStreet1(), pmwVendor.getCorpAddressStreet2(), pmwVendor.getCorpAddressCity(), pmwVendor.getCorpAddressZipCode(), paymentWorksTaxRuleDependencyService.convertIsoCountryCodeToFipsCountryCode(pmwVendor.getCorpAddressCountry(), paymentWorksIsoToFipsCountryMap));
taxAddress = assignStateCodeOrProvinceBasedOnFipsCountryCode(taxAddress, pmwVendor.getCorpAddressState());
return taxAddress;
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildRemitAddressFromIsoCountryData.
private VendorAddress buildRemitAddressFromIsoCountryData(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap) {
VendorAddress remitAddress = buildBaseAddress(VendorConstants.AddressTypes.REMIT, pmwVendor.getRemittanceAddressStreet1(), pmwVendor.getRemittanceAddressStreet2(), pmwVendor.getRemittanceAddressCity(), pmwVendor.getRemittanceAddressZipCode(), paymentWorksTaxRuleDependencyService.convertIsoCountryCodeToFipsCountryCode(pmwVendor.getRemittanceAddressCountry(), paymentWorksIsoToFipsCountryMap));
remitAddress.setVendorDefaultAddressIndicator(true);
remitAddress = assignStateCodeOrProvinceBasedOnFipsCountryCode(remitAddress, pmwVendor.getRemittanceAddressState());
return (remitAddress);
}
Aggregations