Search in sources :

Example 6 with VendorDetailExtension

use of edu.cornell.kfs.vnd.businessobject.VendorDetailExtension 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 7 with VendorDetailExtension

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

the class PaymentWorksVendorToKfsVendorDetailConversionServiceImpl method buildVendorDetailExtension.

private VendorDetailExtension buildVendorDetailExtension(PaymentWorksVendor pmwVendor) {
    VendorDetailExtension vendorDetailExtension = new VendorDetailExtension();
    vendorDetailExtension.setDefaultB2BPaymentMethodCode(DisbursementVoucherConstants.PAYMENT_METHOD_CHECK);
    return vendorDetailExtension;
}
Also used : VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)

Example 8 with VendorDetailExtension

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

the class CuDisbursementVoucherDocument method templateVendor.

public void templateVendor(VendorDetail vendor, VendorAddress vendorAddress) {
    if (vendor == null) {
        return;
    }
    this.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(KFSConstants.PaymentPayeeTypes.VENDOR);
    this.getDvPayeeDetail().setDisbVchrPayeeIdNumber(vendor.getVendorNumber());
    ((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setDisbVchrPayeeIdType(CuDisbursementVoucherConstants.DV_PAYEE_ID_TYP_VENDOR);
    ((CuDisbursementVoucherPayeeDetailExtension) this.getDvPayeeDetail().getExtension()).setPayeeTypeSuffix(createVendorPayeeTypeSuffix(vendor.getVendorHeader().getVendorType()));
    this.getDvPayeeDetail().setDisbVchrPayeePersonName(vendor.getVendorName());
    this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(vendor.getVendorHeader().getVendorForeignIndicator());
    if (ObjectUtils.isNotNull(vendorAddress) && ObjectUtils.isNotNull(vendorAddress.getVendorAddressGeneratedIdentifier())) {
        this.getDvPayeeDetail().setDisbVchrVendorAddressIdNumber(vendorAddress.getVendorAddressGeneratedIdentifier().toString());
        this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(vendorAddress.getVendorLine1Address());
        this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(vendorAddress.getVendorLine2Address());
        this.getDvPayeeDetail().setDisbVchrPayeeCityName(vendorAddress.getVendorCityName());
        this.getDvPayeeDetail().setDisbVchrPayeeStateCode(vendorAddress.getVendorStateCode());
        this.getDvPayeeDetail().setDisbVchrPayeeZipCode(vendorAddress.getVendorZipCode());
        this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(vendorAddress.getVendorCountryCode());
    } else {
        this.getDvPayeeDetail().setDisbVchrVendorAddressIdNumber(StringUtils.EMPTY);
        this.getDvPayeeDetail().setDisbVchrPayeeLine1Addr(StringUtils.EMPTY);
        this.getDvPayeeDetail().setDisbVchrPayeeLine2Addr(StringUtils.EMPTY);
        this.getDvPayeeDetail().setDisbVchrPayeeCityName(StringUtils.EMPTY);
        this.getDvPayeeDetail().setDisbVchrPayeeStateCode(StringUtils.EMPTY);
        this.getDvPayeeDetail().setDisbVchrPayeeZipCode(StringUtils.EMPTY);
        this.getDvPayeeDetail().setDisbVchrPayeeCountryCode(StringUtils.EMPTY);
    }
    this.getDvPayeeDetail().setDisbVchrAlienPaymentCode(vendor.getVendorHeader().getVendorForeignIndicator());
    this.getDvPayeeDetail().setDvPayeeSubjectPaymentCode(VendorConstants.VendorTypes.SUBJECT_PAYMENT.equals(vendor.getVendorHeader().getVendorTypeCode()));
    this.getDvPayeeDetail().setDisbVchrEmployeePaidOutsidePayrollCode(getVendorService().isVendorInstitutionEmployee(vendor.getVendorHeaderGeneratedIdentifier()));
    this.getDvPayeeDetail().setHasMultipleVendorAddresses(1 < vendor.getVendorAddresses().size());
    boolean w9AndW8Checked = false;
    if ((ObjectUtils.isNotNull(vendor.getVendorHeader().getVendorW9ReceivedIndicator()) && vendor.getVendorHeader().getVendorW9ReceivedIndicator() == true) || (ObjectUtils.isNotNull(vendor.getVendorHeader().getVendorW8BenReceivedIndicator()) && vendor.getVendorHeader().getVendorW8BenReceivedIndicator() == true)) {
        w9AndW8Checked = true;
    }
    this.disbVchrPayeeW9CompleteCode = w9AndW8Checked;
    Date vendorFederalWithholdingTaxBeginDate = vendor.getVendorHeader().getVendorFederalWithholdingTaxBeginningDate();
    Date vendorFederalWithholdingTaxEndDate = vendor.getVendorHeader().getVendorFederalWithholdingTaxEndDate();
    java.util.Date today = getDateTimeService().getCurrentDate();
    if ((vendorFederalWithholdingTaxBeginDate != null && vendorFederalWithholdingTaxBeginDate.before(today)) && (vendorFederalWithholdingTaxEndDate == null || vendorFederalWithholdingTaxEndDate.after(today))) {
        this.disbVchrPayeeTaxControlCode = CuDisbursementVoucherConstants.TAX_CONTROL_CODE_BEGIN_WITHHOLDING;
    }
    // if vendor is foreign, default alien payment code to true
    if (getVendorService().isVendorForeign(vendor.getVendorHeaderGeneratedIdentifier())) {
        getDvPayeeDetail().setDisbVchrAlienPaymentCode(true);
    }
    // KFSPTS-1891
    if (vendor != null) {
        if (ObjectUtils.isNotNull(vendor.getExtension()) && vendor.getExtension() instanceof VendorDetailExtension) {
            if (StringUtils.isNotBlank(((VendorDetailExtension) vendor.getExtension()).getDefaultB2BPaymentMethodCode())) {
                disbVchrPaymentMethodCode = ((VendorDetailExtension) vendor.getExtension()).getDefaultB2BPaymentMethodCode();
            }
        }
    }
}
Also used : CuDisbursementVoucherPayeeDetailExtension(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) Date(java.sql.Date)

Example 9 with VendorDetailExtension

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

the class CuVendorRule method checkAutoLiabilityAmountAndExpiration.

protected boolean checkAutoLiabilityAmountAndExpiration(MaintenanceDocument document) {
    boolean success = true;
    VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
    VendorDetailExtension vendorDetailExt = ((VendorDetailExtension) vendorDetail.getExtension());
    if (vendorDetailExt.getAutomobileLiabilityCoverageAmount() != null && vendorDetailExt.getAutomobileLiabilityExpiration() == null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.AUTOMOBILE_LIABILITY_EXPIRATION, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_AUTO_EXPR_NEEDED);
    }
    if (vendorDetailExt.getAutomobileLiabilityCoverageAmount() == null && vendorDetailExt.getAutomobileLiabilityExpiration() != null) {
        success = false;
        putFieldError(CUVendorPropertyConstants.AUTOMOBILE_LIABILITY_AMOUNT, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_AUTO_COVERAGE_NEEDED);
    }
    if (vendorDetailExt.getAutomobileLiabilityExpiration() != null && vendorDetailExt.getAutomobileLiabilityExpiration().before(new Date())) {
        // Only check expiration date on new vendors
        if (document.isNew()) {
            success = false;
            putFieldError(CUVendorPropertyConstants.AUTOMOBILE_LIABILITY_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 10 with VendorDetailExtension

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

the class CuVendorRule method checkInsuranceRequired.

protected boolean checkInsuranceRequired(MaintenanceDocument document) {
    boolean success = true;
    boolean dataEntered = false;
    VendorDetail vendorDetail = (VendorDetail) document.getNewMaintainableObject().getBusinessObject();
    VendorDetailExtension vendorDetailExt = ((VendorDetailExtension) vendorDetail.getExtension());
    if (vendorDetailExt.isInsuranceRequiredIndicator()) {
        dataEntered |= (vendorDetailExt.getAutomobileLiabilityCoverageAmount() == null ? false : true);
        dataEntered |= (vendorDetailExt.getAutomobileLiabilityExpiration() == null ? false : true);
        dataEntered |= (vendorDetailExt.getCornellAdditionalInsuredIndicator() == null ? false : true);
        dataEntered |= (vendorDetailExt.getExcessLiabilityUmbExpiration() == null ? false : true);
        dataEntered |= (vendorDetailExt.getExcessLiabilityUmbrellaAmount() == null ? false : true);
        dataEntered |= (vendorDetailExt.getGeneralLiabilityCoverageAmount() == null ? false : true);
        dataEntered |= (vendorDetailExt.getGeneralLiabilityExpiration() == null ? false : true);
        dataEntered |= (vendorDetailExt.getWorkmansCompCoverageAmount() == null ? false : true);
        dataEntered |= (vendorDetailExt.getWorkmansCompExpiration() == null ? false : true);
        dataEntered |= (vendorDetailExt.getHealthOffSiteCateringLicenseReq() == null ? false : true);
        dataEntered |= (vendorDetailExt.getHealthOffSiteLicenseExpirationDate() == null ? false : true);
        dataEntered |= (vendorDetailExt.getInsuranceNotes() == null ? false : true);
        if (!dataEntered) {
            putFieldError(CUVendorPropertyConstants.INSURANCE_REQUIRED, CUVendorKeyConstants.ERROR_DOCUMENT_VNDMAINT_INSURANCE_REQUIRED_USED_WO_DATA);
            return false;
        }
    }
    return success;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)

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