Search in sources :

Example 1 with VendorDetailExtension

use of edu.cornell.kfs.vnd.businessobject.VendorDetailExtension in project cu-kfs by CU-CommunityApps.

the class CuCreditMemoServiceImpl method populateDocumentAfterInit.

/**
 * @see org.kuali.kfs.module.purap.document.service.CreditMemoCreateService#populateDocumentAfterInit(org.kuali.kfs.module.purap.document.CreditMemoDocument)
 */
@Override
public void populateDocumentAfterInit(VendorCreditMemoDocument cmDocument) {
    // make a call to search for expired/closed accounts
    HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList = accountsPayableService.getExpiredOrClosedAccountList(cmDocument);
    if (cmDocument.isSourceDocumentPaymentRequest()) {
        populateDocumentFromPreq(cmDocument, expiredOrClosedAccountList);
    } else if (cmDocument.isSourceDocumentPurchaseOrder()) {
        populateDocumentFromPO(cmDocument, expiredOrClosedAccountList);
    } else {
        populateDocumentFromVendor(cmDocument);
    }
    // KFSPTS-1891
    VendorDetail vendorDetail = vendorService.getVendorDetail(cmDocument.getVendorHeaderGeneratedIdentifier(), cmDocument.getVendorDetailAssignedIdentifier());
    if (ObjectUtils.isNotNull(vendorDetail) && ObjectUtils.isNotNull(vendorDetail.getExtension())) {
        if (vendorDetail.getExtension() instanceof VendorDetailExtension && StringUtils.isNotBlank(((VendorDetailExtension) vendorDetail.getExtension()).getDefaultB2BPaymentMethodCode())) {
            ((CuVendorCreditMemoDocument) cmDocument).setPaymentMethodCode(((VendorDetailExtension) vendorDetail.getExtension()).getDefaultB2BPaymentMethodCode());
        }
    }
    populateDocumentDescription(cmDocument);
    // write a note for expired/closed accounts if any exist and add a message stating there were expired/closed accounts at the
    // top of the document
    accountsPayableService.generateExpiredOrClosedAccountNote(cmDocument, expiredOrClosedAccountList);
    // set indicator so a message is displayed for accounts that were replaced due to expired/closed status
    if (ObjectUtils.isNotNull(expiredOrClosedAccountList) && !expiredOrClosedAccountList.isEmpty()) {
        cmDocument.setContinuationAccountIndicator(true);
    }
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) ExpiredOrClosedAccountEntry(org.kuali.kfs.module.purap.util.ExpiredOrClosedAccountEntry)

Example 2 with VendorDetailExtension

use of edu.cornell.kfs.vnd.businessobject.VendorDetailExtension in project cu-kfs by CU-CommunityApps.

the class CuVendorRule method checkWorkmansCompAmountAndExpiration.

protected boolean checkWorkmansCompAmountAndExpiration(MaintenanceDocument document) {
    boolean success = true;
    VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
    VendorDetailExtension vendorDetailExt = ((VendorDetailExtension) vendorDetail.getExtension());
    if (vendorDetailExt.getWorkmansCompCoverageAmount() != null && vendorDetailExt.getWorkmansCompExpiration() == null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.WORKMANS_COMP_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_WC_EXPR_NEEDED);
    }
    if (vendorDetailExt.getWorkmansCompCoverageAmount() == null && vendorDetailExt.getWorkmansCompExpiration() != null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.WORKMANS_COMP_AMOUNT, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_WC_COVERAGE_NEEDED);
    }
    if (vendorDetailExt.getWorkmansCompExpiration() != null && vendorDetailExt.getWorkmansCompExpiration().before(new Date())) {
        // Only check expiration date on new vendors
        if (document.isNew()) {
            success = false;
            putFieldError(CUVendorPropertyConstants.WORKMANS_COMP_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_DATE_IN_PAST);
        }
    }
    return success;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) Date(java.util.Date)

Example 3 with VendorDetailExtension

use of edu.cornell.kfs.vnd.businessobject.VendorDetailExtension in project cu-kfs by CU-CommunityApps.

the class CuVendorRule method validateCreditCardMerchantAddition.

protected boolean validateCreditCardMerchantAddition(VendorDetail vendorDetail, CuVendorCreditCardMerchant vendorCreditCardMerchant) {
    boolean success = true;
    List<CuVendorCreditCardMerchant> vendorCreditCardMerchants = ((VendorDetailExtension) vendorDetail.getExtension()).getVendorCreditCardMerchants();
    for (CuVendorCreditCardMerchant existingMerchant : vendorCreditCardMerchants) {
        if (existingMerchant.getCreditMerchantName().equals(vendorCreditCardMerchant.getCreditMerchantName())) {
            putFieldError("add.vendorCreditCardMerchants.creditMerchantName", CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_CREDIT_MERCHANT_NAME_DUPLICATE);
            // can't have duplicate merchant names, part of the primary key for the table in the db
            success = false;
        }
    }
    return success;
}
Also used : CuVendorCreditCardMerchant(edu.cornell.kfs.vnd.businessobject.CuVendorCreditCardMerchant) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)

Example 4 with VendorDetailExtension

use of edu.cornell.kfs.vnd.businessobject.VendorDetailExtension in project cu-kfs by CU-CommunityApps.

the class CuVendorRule method checkHealthLicenseAndExpiration.

protected boolean checkHealthLicenseAndExpiration(MaintenanceDocument document) {
    boolean success = true;
    VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
    Boolean offSiteCateringLicenseRequired = ((VendorDetailExtension) vendorDetail.getExtension()).getHealthOffSiteCateringLicenseReq();
    if (offSiteCateringLicenseRequired == null) {
        offSiteCateringLicenseRequired = false;
    }
    if (offSiteCateringLicenseRequired && ((VendorDetailExtension) vendorDetail.getExtension()).getHealthOffSiteLicenseExpirationDate() == null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.HEALTH_OFFSITE_LICENSE_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_HEALTH_LICENSE_EXPR_NEEDED);
    }
    if (!offSiteCateringLicenseRequired && ((VendorDetailExtension) vendorDetail.getExtension()).getHealthOffSiteLicenseExpirationDate() != null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.HEALTH_OFFSITE_LICENSE_REQUIRED, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_HEALTH_LICENSE_NEEDED);
    }
    if (((VendorDetailExtension) vendorDetail.getExtension()).getHealthOffSiteLicenseExpirationDate() != null && ((VendorDetailExtension) vendorDetail.getExtension()).getHealthOffSiteLicenseExpirationDate().before(new Date())) {
        // Only check expiration date on new vendors
        if (document.isNew()) {
            success = false;
            putFieldError(CUVendorPropertyConstants.HEALTH_OFFSITE_LICENSE_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_DATE_IN_PAST);
        }
    }
    return success;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) Date(java.util.Date)

Example 5 with VendorDetailExtension

use of edu.cornell.kfs.vnd.businessobject.VendorDetailExtension in project cu-kfs by CU-CommunityApps.

the class CuVendorRule method checkUmbrellaPolicyAmountAndExpiration.

protected boolean checkUmbrellaPolicyAmountAndExpiration(MaintenanceDocument document) {
    boolean success = true;
    VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
    VendorDetailExtension vendorDetailExt = ((VendorDetailExtension) vendorDetail.getExtension());
    if (vendorDetailExt.getExcessLiabilityUmbrellaAmount() != null && vendorDetailExt.getExcessLiabilityUmbExpiration() == null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.EXCESS_LIABILITY_UMBRELLA_AMOUNT, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_UMB_EXPR_NEEDED);
    }
    if (vendorDetailExt.getExcessLiabilityUmbrellaAmount() == null && vendorDetailExt.getExcessLiabilityUmbExpiration() != null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.EXCESS_LIABILITY_UMBRELLA_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_UMB_COVERAGE_NEEDED);
    }
    if (vendorDetailExt.getExcessLiabilityUmbExpiration() != null && vendorDetailExt.getExcessLiabilityUmbExpiration().before(new Date())) {
        // Only check expiration date on new vendors
        if (document.isNew()) {
            success = false;
            putFieldError(CUVendorPropertyConstants.EXCESS_LIABILITY_UMBRELLA_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_DATE_IN_PAST);
        }
    }
    return success;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) Date(java.util.Date)

Aggregations

VendorDetailExtension (edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)13 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)9 Date (java.util.Date)6 CuVendorCreditCardMerchant (edu.cornell.kfs.vnd.businessobject.CuVendorCreditCardMerchant)2 ArrayList (java.util.ArrayList)2 ExpiredOrClosedAccountEntry (org.kuali.kfs.module.purap.util.ExpiredOrClosedAccountEntry)2 CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)1 CuPaymentRequestItemExtension (edu.cornell.kfs.module.purap.businessobject.CuPaymentRequestItemExtension)1 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)1 CuVendorCreditMemoDocument (edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Serializable (java.io.Serializable)1 RemoteException (java.rmi.RemoteException)1 Date (java.sql.Date)1 HashMap (java.util.HashMap)1 ValidationException (org.kuali.kfs.krad.exception.ValidationException)1 DocumentService (org.kuali.kfs.krad.service.DocumentService)1 KualiRuleService (org.kuali.kfs.krad.service.KualiRuleService)1 WorkflowDocumentService (org.kuali.kfs.krad.workflow.service.WorkflowDocumentService)1