use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class PaymentWorksBatchUtilityServiceImpl method populateRemitAddress.
private void populateRemitAddress(PaymentWorksVendor pmwVendor, VendorDetail vendorDetail) {
List<VendorAddress> remitAddresses = findAllActiveRemitAddresses(vendorDetail.getVendorAddresses());
if (ObjectUtils.isNotNull(remitAddresses) && remitAddresses.size() == 1) {
VendorAddress remitAddress = remitAddresses.get(0);
pmwVendor.setRemittanceAddressStreet1(remitAddress.getVendorLine1Address());
pmwVendor.setRemittanceAddressStreet2(remitAddress.getVendorLine2Address());
pmwVendor.setRemittanceAddressCity(remitAddress.getVendorCityName());
pmwVendor.setRemittanceAddressState(remitAddress.getVendorStateCode());
pmwVendor.setRemittanceAddressCountry(convertFipsCountryCodeToIsoCountryCode(remitAddress.getVendorCountryCode()));
pmwVendor.setRemittanceAddressZipCode(remitAddress.getVendorZipCode());
} else {
LOG.error("populateRemitAddress: KFS Approved PVEN does not contain one and only one Active Remit Address for vendor " + vendorDetail.getVendorHeaderGeneratedIdentifier() + "-" + vendorDetail.getVendorDetailAssignedIdentifier());
}
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildBaseAddress.
private VendorAddress buildBaseAddress(String addressType, String line1, String line2, String city, String zip, String isoCountryCode, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap) {
VendorAddress baseAddress = new VendorAddress();
baseAddress.setVendorAddressTypeCode(addressType);
baseAddress.setVendorCountryCode(convertIsoCountryCodeToFipsCountryCode(isoCountryCode, paymentWorksIsoToFipsCountryMap));
baseAddress.setVendorLine1Address(line1);
baseAddress.setVendorLine2Address(line2);
baseAddress.setVendorCityName(city);
baseAddress.setVendorZipCode(zip);
baseAddress.setActive(true);
return baseAddress;
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildRemitAddress.
private VendorAddress buildRemitAddress(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap) {
VendorAddress remitAddress = buildBaseAddress(VendorConstants.AddressTypes.REMIT, pmwVendor.getRemittanceAddressStreet1(), pmwVendor.getRemittanceAddressStreet2(), pmwVendor.getRemittanceAddressCity(), pmwVendor.getRemittanceAddressZipCode(), pmwVendor.getRemittanceAddressCountry(), paymentWorksIsoToFipsCountryMap);
remitAddress.setVendorDefaultAddressIndicator(true);
remitAddress = assignStateOrProvinceBasedOnCountryCode(remitAddress, pmwVendor.getRemittanceAddressState());
return (remitAddress);
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherDocumentBatchServiceImpl method populateDisbursementVoucherFields.
/**
* Populates fields on the disbursement voucher document and performs validation
*
* @param disbursementVoucherDocument disbursement voucher document to populate
* @param batchDisbursementVoucherDocument batch dv document to pull values from
* @param batchDefault contains default values to use if value in feed is empty
* @param MessageMap MessageMap for adding encountered errors
*/
protected void populateDisbursementVoucherFields(DisbursementVoucherDocument disbursementVoucherDocument, BatchDisbursementVoucherDocument batchDisbursementVoucherDocument, DisbursementVoucherBatchDefault batchDefault, MessageMap MessageMap) {
disbursementVoucherDocument.getDocumentHeader().setDocumentDescription(kualiConfigurationService.getPropertyValueAsString(FPKeyConstants.MESSAGE_DV_BATCH_DOCUMENT_DESCRIPTION));
// populate fields of document from batch instance
disbursementVoucherDocument.getDocumentHeader().setExplanation(batchDisbursementVoucherDocument.getDocumentHeader().getExplanation());
disbursementVoucherDocument.getDocumentHeader().setOrganizationDocumentNumber(batchDisbursementVoucherDocument.getDocumentHeader().getOrganizationDocumentNumber());
disbursementVoucherDocument.setDisbVchrContactPersonName(batchDisbursementVoucherDocument.getDisbVchrContactPersonName());
disbursementVoucherDocument.setDisbVchrContactPhoneNumber(batchDisbursementVoucherDocument.getDisbVchrContactPhoneNumber());
disbursementVoucherDocument.setDisbVchrContactEmailId(batchDisbursementVoucherDocument.getDisbVchrContactEmailId());
disbursementVoucherDocument.setDisbursementVoucherDueDate(batchDisbursementVoucherDocument.getDisbursementVoucherDueDate());
disbursementVoucherDocument.setDisbVchrAttachmentCode(batchDisbursementVoucherDocument.isDisbVchrAttachmentCode());
disbursementVoucherDocument.setDisbVchrSpecialHandlingCode(batchDisbursementVoucherDocument.isDisbVchrSpecialHandlingCode());
disbursementVoucherDocument.setDisbVchrCheckTotalAmount(batchDisbursementVoucherDocument.getDisbVchrCheckTotalAmount());
disbursementVoucherDocument.setDisbursementVoucherDocumentationLocationCode(batchDisbursementVoucherDocument.getDisbursementVoucherDocumentationLocationCode());
disbursementVoucherDocument.setDisbVchrPaymentMethodCode(batchDisbursementVoucherDocument.getDisbVchrPaymentMethodCode());
disbursementVoucherDocument.setCampusCode(batchDisbursementVoucherDocument.getCampusCode());
disbursementVoucherDocument.setDisbVchrCheckStubText(batchDisbursementVoucherDocument.getDisbVchrCheckStubText());
disbursementVoucherDocument.setDisbVchrBankCode(batchDisbursementVoucherDocument.getDisbVchrBankCode());
disbursementVoucherDocument.getDvPayeeDetail().setDocumentNumber(disbursementVoucherDocument.getDocumentNumber());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPaymentReasonCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPaymentReasonCode());
String payeeTypeCode = batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbursementVoucherPayeeTypeCode();
String payeeIdNumber = batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeIdNumber();
if (KFSConstants.PaymentPayeeTypes.VENDOR.equals(payeeTypeCode)) {
if (StringUtils.contains(payeeIdNumber, "-")) {
VendorDetail vendorDetail = vendorService.getVendorDetail(payeeIdNumber);
if (vendorDetail != null) {
VendorAddress vendorAddress = vendorService.getVendorDefaultAddress(vendorDetail.getVendorHeaderGeneratedIdentifier(), vendorDetail.getVendorDetailAssignedIdentifier(), VendorConstants.AddressTypes.PURCHASE_ORDER, disbursementVoucherDocument.getCampusCode());
if (vendorAddress == null) {
vendorAddress = vendorService.getVendorDefaultAddress(vendorDetail.getVendorHeaderGeneratedIdentifier(), vendorDetail.getVendorDetailAssignedIdentifier(), VendorConstants.AddressTypes.REMIT, disbursementVoucherDocument.getCampusCode());
}
if (vendorAddress != null) {
disbursementVoucherDocument.templateVendor(vendorDetail, vendorAddress);
}
} else {
batchFeedHelperService.addExistenceError(KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER, payeeIdNumber, MessageMap);
}
} else {
batchFeedHelperService.addExistenceError(KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER, payeeIdNumber, MessageMap);
}
} else if (KFSConstants.PaymentPayeeTypes.EMPLOYEE.equals(payeeTypeCode)) {
Person person = personService.getPersonByEmployeeId(payeeIdNumber);
if (person != null) {
disbursementVoucherDocument.templateEmployee(person);
} else {
batchFeedHelperService.addExistenceError(KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER, payeeIdNumber, MessageMap);
}
}
// override payee details with values from feed if given (not blank)
if (StringUtils.isNotBlank(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeLine1Addr())) {
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeLine1Addr());
}
if (StringUtils.isNotBlank(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeLine2Addr())) {
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeLine2Addr());
}
if (StringUtils.isNotBlank(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeCityName())) {
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPayeeCityName(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeCityName());
}
if (StringUtils.isNotBlank(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeStateCode())) {
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPayeeStateCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeStateCode());
}
if (StringUtils.isNotBlank(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeZipCode())) {
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPayeeZipCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeZipCode());
}
if (StringUtils.isNotBlank(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeCountryCode())) {
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrPayeeCountryCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrPayeeCountryCode());
}
// set special handling fields
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingPersonName(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingPersonName());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingLine1Addr(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingLine1Addr());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingLine2Addr(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingLine2Addr());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingCityName(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingCityName());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingZipCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingZipCode());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingStateCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingStateCode());
disbursementVoucherDocument.getDvPayeeDetail().setDisbVchrSpecialHandlingCountryCode(batchDisbursementVoucherDocument.getDvPayeeDetail().getDisbVchrSpecialHandlingCountryCode());
disbursementVoucherDocument.setDvNonresidentTax(batchDisbursementVoucherDocument.getDvNonresidentTax());
disbursementVoucherDocument.getDvNonresidentTax().setDocumentNumber(disbursementVoucherDocument.getDocumentNumber());
// set defaults
if (batchDefault != null) {
if (StringUtils.isBlank(disbursementVoucherDocument.getDisbVchrContactPersonName())) {
disbursementVoucherDocument.setDisbVchrContactPersonName(batchDefault.getDisbVchrContactPersonName());
}
if (StringUtils.isBlank(disbursementVoucherDocument.getDisbVchrContactPhoneNumber())) {
disbursementVoucherDocument.setDisbVchrContactPhoneNumber(batchDefault.getDisbVchrContactPhoneNumber());
}
if (StringUtils.isBlank(disbursementVoucherDocument.getDisbVchrContactEmailId())) {
disbursementVoucherDocument.setDisbVchrContactEmailId(batchDefault.getDisbVchrContactEmailId());
}
if (StringUtils.isBlank(disbursementVoucherDocument.getCampusCode())) {
disbursementVoucherDocument.setCampusCode(batchDefault.getCampusCode());
}
if (StringUtils.isBlank(disbursementVoucherDocument.getDisbVchrPaymentMethodCode())) {
disbursementVoucherDocument.setDisbVchrPaymentMethodCode(batchDefault.getDisbVchrPaymentMethodCode());
}
if (StringUtils.isBlank(disbursementVoucherDocument.getDisbursementVoucherDocumentationLocationCode())) {
disbursementVoucherDocument.setDisbursementVoucherDocumentationLocationCode(batchDefault.getDisbursementVoucherDocumentationLocationCode());
}
if (StringUtils.isBlank(disbursementVoucherDocument.getDisbVchrBankCode())) {
disbursementVoucherDocument.setDisbVchrBankCode(batchDefault.getDisbVchrBankCode());
}
}
// set accounting
for (Iterator iterator = batchDisbursementVoucherDocument.getSourceAccountingLines().iterator(); iterator.hasNext(); ) {
SourceAccountingLine batchAccountingLine = (SourceAccountingLine) iterator.next();
SourceAccountingLine accountingLine = new SourceAccountingLine();
accountingLine.setChartOfAccountsCode(batchAccountingLine.getChartOfAccountsCode());
accountingLine.setAccountNumber(batchAccountingLine.getAccountNumber());
if (StringUtils.isNotBlank(batchAccountingLine.getSubAccountNumber())) {
accountingLine.setSubAccountNumber(batchAccountingLine.getSubAccountNumber());
}
accountingLine.setFinancialObjectCode(batchAccountingLine.getFinancialObjectCode());
if (StringUtils.isNotBlank(batchAccountingLine.getFinancialSubObjectCode())) {
accountingLine.setFinancialSubObjectCode(batchAccountingLine.getFinancialSubObjectCode());
}
if (StringUtils.isNotBlank(batchAccountingLine.getProjectCode())) {
accountingLine.setProjectCode(batchAccountingLine.getProjectCode());
}
accountingLine.setOrganizationReferenceId(batchAccountingLine.getOrganizationReferenceId());
accountingLine.setFinancialDocumentLineDescription(batchAccountingLine.getFinancialDocumentLineDescription());
accountingLine.setAmount(batchAccountingLine.getAmount());
// set accounting defaults
if (batchDefault != null) {
if (StringUtils.isBlank(accountingLine.getChartOfAccountsCode())) {
accountingLine.setChartOfAccountsCode(batchDefault.getChartOfAccountsCode());
}
if (StringUtils.isBlank(accountingLine.getAccountNumber())) {
accountingLine.setAccountNumber(batchDefault.getAccountNumber());
}
if (StringUtils.isBlank(accountingLine.getFinancialObjectCode())) {
accountingLine.setFinancialObjectCode(batchDefault.getFinancialObjectCode());
}
if (StringUtils.isBlank(accountingLine.getFinancialDocumentLineDescription())) {
accountingLine.setFinancialDocumentLineDescription(batchDefault.getFinancialDocumentLineDescription());
}
}
accountingLine.setPostingYear(disbursementVoucherDocument.getPostingYear());
accountingLine.setDocumentNumber(disbursementVoucherDocument.getDocumentNumber());
disbursementVoucherDocument.addSourceAccountingLine(accountingLine);
}
// set notes
for (Iterator iterator = batchDisbursementVoucherDocument.getNotes().iterator(); iterator.hasNext(); ) {
Note note = (Note) iterator.next();
note.setRemoteObjectIdentifier(disbursementVoucherDocument.getObjectId());
note.setAuthorUniversalIdentifier(batchFeedHelperService.getSystemUser().getPrincipalId());
note.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
note.setNotePostedTimestampToCurrent();
disbursementVoucherDocument.addNote(note);
}
}
use of org.kuali.kfs.vnd.businessobject.VendorAddress in project cu-kfs by CU-CommunityApps.
the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildPurchaseOrderAddressFromFipsData.
private VendorAddress buildPurchaseOrderAddressFromFipsData(PaymentWorksVendor pmwVendor, Map<String, List<PaymentWorksIsoFipsCountryItem>> paymentWorksIsoToFipsCountryMap) {
String fipsCountryCode = buildPOFipsCountryCode(pmwVendor, paymentWorksIsoToFipsCountryMap);
VendorAddress poAddress = buildBaseAddress(VendorConstants.AddressTypes.PURCHASE_ORDER, pmwVendor.getPoAddress1(), pmwVendor.getPoAddress2(), pmwVendor.getPoCity(), pmwVendor.getPoPostalCode(), fipsCountryCode);
poAddress = assignPoStateOrProvinceBasedOnCountryCode(poAddress, pmwVendor);
poAddress = assignMethodOfPoTransmission(poAddress, pmwVendor);
poAddress.setVendorAttentionName(pmwVendor.getPoAttention());
poAddress.setVendorDefaultAddressIndicator(true);
return (poAddress);
}
Aggregations