Search in sources :

Example 26 with VendorDetail

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

the class CuVendorPreRules method detectAndConfirmExpirationDates.

protected void detectAndConfirmExpirationDates(MaintenanceDocument document) {
    boolean proceed = true;
    ArrayList<String> expired = new ArrayList<String>();
    VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
    VendorDetailExtension vendorDetailext = (VendorDetailExtension) vendorDetail.getExtension();
    if (vendorDetailext.getGeneralLiabilityExpiration() != null && vendorDetailext.getGeneralLiabilityExpiration().before(new Date())) {
        expired.add(CUVendorConstants.EXPIRABLE_COVERAGES.GENERAL_LIABILITY_COVERAGE);
        GlobalVariables.getMessageMap().putError(KFSConstants.MAINTENANCE_NEW_MAINTAINABLE + CUVendorPropertyConstants.GENERAL_LIABILITY_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_GENERAL_LIABILITY_EXPR_DATE_IN_PAST);
    }
    if (vendorDetailext.getAutomobileLiabilityExpiration() != null && vendorDetailext.getAutomobileLiabilityExpiration().before(new Date())) {
        expired.add(CUVendorConstants.EXPIRABLE_COVERAGES.AUTOMOBILE_LIABILITY_COVERAGE);
        GlobalVariables.getMessageMap().putError(KFSConstants.MAINTENANCE_NEW_MAINTAINABLE + CUVendorPropertyConstants.AUTOMOBILE_LIABILITY_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_AUTO_EXPR_IN_PAST);
    }
    if (vendorDetailext.getWorkmansCompExpiration() != null && vendorDetailext.getWorkmansCompExpiration().before(new Date())) {
        expired.add(CUVendorConstants.EXPIRABLE_COVERAGES.WORKMAN_COMP_COVERAGE);
        GlobalVariables.getMessageMap().putError(KFSConstants.MAINTENANCE_NEW_MAINTAINABLE + CUVendorPropertyConstants.WORKMANS_COMP_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_WC_EXPR_IN_PAST);
    }
    if (vendorDetailext.getExcessLiabilityUmbExpiration() != null && vendorDetailext.getExcessLiabilityUmbExpiration().before(new Date())) {
        expired.add(CUVendorConstants.EXPIRABLE_COVERAGES.EXCESS_LIABILITY_UMBRELLA_COVERAGE);
        GlobalVariables.getMessageMap().putError(KFSConstants.MAINTENANCE_NEW_MAINTAINABLE + CUVendorPropertyConstants.EXCESS_LIABILITY_UMBRELLA_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_UMB_EXPR_IN_PAST);
    }
    if (vendorDetailext.getHealthOffSiteLicenseExpirationDate() != null && vendorDetailext.getHealthOffSiteLicenseExpirationDate().before(new Date())) {
        expired.add(CUVendorConstants.EXPIRABLE_COVERAGES.HEALTH_DEPARTMENT_LICENSE);
        GlobalVariables.getMessageMap().putError(KFSConstants.MAINTENANCE_NEW_MAINTAINABLE + CUVendorPropertyConstants.HEALTH_OFFSITE_LICENSE_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_HEALTH_LICENSE_EXPR_IN_PAST);
    }
    VendorHeader vendorHeader = vendorDetail.getVendorHeader();
    List<VendorSupplierDiversity> vendorSupplierDiversities = vendorHeader.getVendorSupplierDiversities();
    if (vendorSupplierDiversities.size() > 0) {
        int i = 0;
        for (VendorSupplierDiversity vendor : vendorSupplierDiversities) {
            if (((CuVendorSupplierDiversityExtension) vendor.getExtension()).getVendorSupplierDiversityExpirationDate().before(new Date())) {
                expired.add(CUVendorConstants.EXPIRABLE_COVERAGES.SUPPLIER_DIVERSITY_CERTIFICATION);
                GlobalVariables.getMessageMap().putError(KFSConstants.MAINTENANCE_NEW_MAINTAINABLE + VendorConstants.VENDOR_HEADER_ATTR + "." + VendorPropertyConstants.VENDOR_SUPPLIER_DIVERSITIES + "[" + i + "]." + CUVendorPropertyConstants.SUPPLIER_DIVERSITY_EXPRIATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_SUPPLIER_DIVERSITY_DATE_IN_PAST);
                break;
            }
            i++;
        }
    }
    if (!expired.isEmpty()) {
        String expiredNames = "";
        for (String name : expired) {
            expiredNames = expiredNames + "[br] - " + name;
        }
        proceed &= askOrAnalyzeYesNoQuestion(CUVendorConstants.EXPIRED_DATE_QUESTION_ID, VendorUtils.buildMessageText(CUVendorKeyConstants.CONFIRM_VENDOR_DATE_EXPIRED, expiredNames));
    }
    if (!proceed) {
        abortRulesCheck();
    } else {
        GlobalVariables.getMessageMap().clearErrorMessages();
    }
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorHeader(org.kuali.kfs.vnd.businessobject.VendorHeader) ArrayList(java.util.ArrayList) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) VendorSupplierDiversity(org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity) Date(java.util.Date)

Example 27 with VendorDetail

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

the class VendorDetailInquiryPresentationController method getConditionallyHiddenPropertyNames.

/**
 * Implement this method to hide fields based on specific data in the record being inquired into
 *
 * @return Set of property names that should be hidden
 */
@Override
public Set<String> getConditionallyHiddenPropertyNames(BusinessObject businessObject) {
    Set<String> retVal = new HashSet<String>();
    IdentityManagementService idService = SpringContext.getBean(IdentityManagementService.class);
    UserSession uSession = GlobalVariables.getUserSession();
    Map<String, String> permissionDetails = new HashMap<String, String>();
    permissionDetails.put(KewApiConstants.DOCUMENT_TYPE_NAME_DETAIL, "PVEN");
    boolean canViewAttachments = idService.isAuthorizedByTemplateName(uSession.getPrincipalId(), KRADConstants.KNS_NAMESPACE, KimConstants.PermissionTemplateNames.VIEW_NOTE_ATTACHMENT, permissionDetails, null);
    if (!canViewAttachments) {
        VendorDetail detail = (VendorDetail) businessObject;
        VendorService vendorService = SpringContext.getBean(VendorService.class);
        List<Note> boNotes = vendorService.getVendorNotes(detail);
        for (int i = 0; i < boNotes.size(); i++) retVal.add("boNotes[" + i + "].attachmentLink");
    }
    return retVal;
}
Also used : HashMap(java.util.HashMap) VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorService(org.kuali.kfs.vnd.document.service.VendorService) IdentityManagementService(org.kuali.rice.kim.api.services.IdentityManagementService) UserSession(org.kuali.kfs.krad.UserSession) Note(org.kuali.kfs.krad.bo.Note) HashSet(java.util.HashSet)

Example 28 with VendorDetail

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

the class CuPaymentFileServiceImpl method checkForInactiveVendors.

/**
 * Checks whether any of the batch load's payment groups reference inactive vendors,
 * and sends warning emails appropriately if so.
 *
 * @param paymentGroups The payment groups that were loaded.
 * @param customer The customer's profile.
 */
private void checkForInactiveVendors(List<PaymentGroup> paymentGroups, CustomerProfile customer) {
    final int MESSAGE_START_SIZE = 300;
    StringBuilder inactiveVendorsMessage = new StringBuilder(MESSAGE_START_SIZE);
    for (PaymentGroup paymentGroup : paymentGroups) {
        // Determine whether the payment group's vendor is inactive.
        VendorDetail vendor = vendorService.getVendorDetail(paymentGroup.getPayeeId());
        if (vendor != null && !vendor.isActiveIndicator()) {
            // If vendor is inactive, then append warning text to final email message.
            LOG.warn("Found payment group with inactive vendor payee. Payment Group ID: " + paymentGroup.getId() + ", Vendor ID: " + paymentGroup.getPayeeId());
            String warnMessageStart = getStartOfVendorInactiveMessage(vendor);
            if (inactiveVendorsMessage.length() == 0) {
                // Add header if necessary.
                inactiveVendorsMessage.append("The PDP feed submitted by your unit includes payments to inactive vendors.  ").append("Action is needed on your part to rectify the situation for future payments.  ").append("Review the inactive reason to determine action needed.  Details follow:\n\n");
            }
            // Append payment detail information to the message. (As per the payment file XSD, there should be at least one detail.)
            for (PaymentDetail paymentDetail : paymentGroup.getPaymentDetails()) {
                inactiveVendorsMessage.append(warnMessageStart).append("Customer Payment Doc Nbr: ").append(paymentDetail.getCustPaymentDocNbr()).append('\n').append("Payment Group ID: ").append(paymentDetail.getPaymentGroupId()).append('\n').append("Payment Date: ").append(paymentGroup.getPaymentDate()).append('\n').append("Amount: ").append(paymentDetail.getNetPaymentAmount()).append("\n\n");
            }
        }
    }
    // If one or more inactive vendors were found, then send notification emails to warn about their presence.
    if (inactiveVendorsMessage.length() > 0) {
        sendInactiveVendorsMessage(customer, inactiveVendorsMessage.toString());
    }
}
Also used : PaymentGroup(org.kuali.kfs.pdp.businessobject.PaymentGroup) VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) PaymentDetail(org.kuali.kfs.pdp.businessobject.PaymentDetail)

Example 29 with VendorDetail

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

the class DebitDeterminerServiceImplTest method test.

public void test() {
    CuDisbursementVoucherDocument dv = null;
    try {
        dv = (CuDisbursementVoucherDocument) SpringContext.getBean(DocumentService.class).getNewDocument(DisbursementVoucherDocument.class);
    } catch (WorkflowException e) {
        throw new RuntimeException("Error creating new disbursement voucher document: " + e.getMessage(), e);
    }
    if (dv != null) {
        dv.getDocumentHeader().setDocumentDescription("Test Document Description");
        dv.getDocumentHeader().setExplanation("Stuff");
        dv.initiateDocument();
        VendorDetail vendor = SpringContext.getBean(VendorService.class).getVendorDetail("13366-0");
        VendorAddress vendoraddress = SpringContext.getBean(VendorService.class).getVendorDefaultAddress(vendor.getVendorHeaderGeneratedIdentifier(), vendor.getVendorDetailAssignedIdentifier(), "RM", "");
        System.out.println(vendoraddress.getVendorCityName() + "\n");
        dv.templateVendor(vendor, vendoraddress);
        dv.setPayeeAssigned(true);
        dv.getDvPayeeDetail().setDisbVchrPaymentReasonCode("S");
        dv.setDisbVchrCheckTotalAmount(new KualiDecimal(86.00));
        dv.setDisbVchrPaymentMethodCode("P");
        dv.setDisbVchrCheckStubText("check text");
        SourceAccountingLine accountingLine = new SourceAccountingLine();
        accountingLine.setChartOfAccountsCode("IT");
        accountingLine.setAccountNumber("G081040");
        accountingLine.setFinancialObjectCode("2045");
        accountingLine.setAmount((new KualiDecimal(-14.00)));
        accountingLine.setPostingYear(dv.getPostingYear());
        accountingLine.setDocumentNumber(dv.getDocumentNumber());
        dv.addSourceAccountingLine(accountingLine);
        SourceAccountingLine accountingLine2 = new SourceAccountingLine();
        accountingLine2.setChartOfAccountsCode("IT");
        accountingLine2.setAccountNumber("1453611");
        accountingLine2.setFinancialObjectCode("8462");
        accountingLine2.setAmount((new KualiDecimal(100.00)));
        accountingLine2.setPostingYear(dv.getPostingYear());
        accountingLine2.setDocumentNumber(dv.getDocumentNumber());
        dv.addSourceAccountingLine(accountingLine2);
        try {
            documentService.saveDocument(dv);
        } catch (WorkflowException e) {
            throw new RuntimeException("Error saving new disbursement voucher document: " + e.getMessage(), e);
        }
    }
    List<GeneralLedgerPendingEntrySourceDetail> glpeS = dv.getGeneralLedgerPendingEntrySourceDetails();
    GeneralLedgerPendingEntrySourceDetail postable = glpeS.get(0);
    System.out.println("GL Detail" + postable.toString() + "\n");
    assertFalse(debitDeterminerService.isDebitConsideringNothingPositiveOnly(dv, postable));
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorService(org.kuali.kfs.vnd.document.service.VendorService) CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) GeneralLedgerPendingEntrySourceDetail(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress) DocumentService(org.kuali.kfs.krad.service.DocumentService)

Example 30 with VendorDetail

use of org.kuali.kfs.vnd.businessobject.VendorDetail 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.setDvNonResidentAlienTax(batchDisbursementVoucherDocument.getDvNonResidentAlienTax());
    disbursementVoucherDocument.getDvNonResidentAlienTax().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);
    }
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) Note(org.kuali.kfs.krad.bo.Note) Iterator(java.util.Iterator) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress) Person(org.kuali.rice.kim.api.identity.Person)

Aggregations

VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)54 ArrayList (java.util.ArrayList)14 VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)12 Date (java.util.Date)10 List (java.util.List)10 VendorDetailExtension (edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)9 HashMap (java.util.HashMap)9 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)7 VendorHeader (org.kuali.kfs.vnd.businessobject.VendorHeader)7 VendorService (org.kuali.kfs.vnd.document.service.VendorService)7 Iterator (java.util.Iterator)6 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)5 MessageMap (org.kuali.kfs.krad.util.MessageMap)5 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)5 Person (org.kuali.rice.kim.api.identity.Person)5 IOException (java.io.IOException)4 VendorCommodityCode (org.kuali.kfs.vnd.businessobject.VendorCommodityCode)4 VendorContract (org.kuali.kfs.vnd.businessobject.VendorContract)4 VendorSupplierDiversity (org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)4 FileNotFoundException (java.io.FileNotFoundException)3