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