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();
}
}
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;
}
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();
}
}
}
}
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;
}
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;
}
Aggregations