use of edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer in project cu-kfs by CU-CommunityApps.
the class CreditMemoWireTransferValidation method validate.
/**
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("validate start");
}
boolean isValid = true;
VendorCreditMemoDocument document = (VendorCreditMemoDocument) accountingDocumentForValidation;
CreditMemoWireTransfer wireTransfer = ((CuVendorCreditMemoDocument) document).getCmWireTransfer();
if (!PaymentMethod.PM_CODE_WIRE.equals(((CuVendorCreditMemoDocument) document).getPaymentMethodCode())) {
return isValid;
}
MessageMap errors = GlobalVariables.getMessageMap();
errors.addToErrorPath(KFSPropertyConstants.DOCUMENT);
errors.addToErrorPath(CUPurapPropertyConstants.CM_WIRE_TRANSFER);
isValid &= isValid(wireTransfer.getCmBankName(), CUPurapConstants.LABEL_BANK_NAME, CUPurapPropertyConstants.CM_BANK_NAME);
isValid &= isValid(wireTransfer.getCmBankCityName(), CUPurapConstants.LABEL_BANK_CITY, CUPurapPropertyConstants.CM_BANK_CITY_NAME);
isValid &= isValid(wireTransfer.getCmBankCountryCode(), CUPurapConstants.LABEL_BANK_COUNTRY, CUPurapPropertyConstants.CM_BANK_COUNTRY_CODE);
isValid &= isValid(wireTransfer.getCmCurrencyTypeName(), CUPurapConstants.LABEL_CURRENCY, CUPurapPropertyConstants.CM_CURRENCY_TYPE_NAME);
isValid &= isValid(wireTransfer.getCmPayeeAccountNumber(), CUPurapConstants.LABEL_BANK_ACCT_NUMBER, CUPurapPropertyConstants.CM_PAYEE_ACCT_NUMBER);
isValid &= isValid(wireTransfer.getCmPayeeAccountName(), CUPurapConstants.LABEL_BANK_ACCT_NAME, CUPurapPropertyConstants.CM_PAYEE_ACCT_NAME);
if (KFSConstants.COUNTRY_CODE_UNITED_STATES.equals(wireTransfer.getCmBankCountryCode()) && StringUtils.isBlank(wireTransfer.getCmBankRoutingNumber())) {
errors.putError(CUPurapPropertyConstants.CM_BANK_ROUTING_NUMBER, KFSKeyConstants.ERROR_PAYMENT_SOURCE_BANK_ROUTING_NUMBER);
isValid = false;
}
if (KFSConstants.COUNTRY_CODE_UNITED_STATES.equals(wireTransfer.getCmBankCountryCode()) && StringUtils.isBlank(wireTransfer.getCmBankStateCode())) {
errors.putError(CUPurapPropertyConstants.CM_BANK_STATE_CODE, KFSKeyConstants.ERROR_REQUIRED, "Bank State");
isValid = false;
}
errors.removeFromErrorPath(CUPurapPropertyConstants.CM_WIRE_TRANSFER);
errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
return isValid;
}
use of edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer in project cu-kfs by CU-CommunityApps.
the class CuCreditMemoDocumentPreRules method checkWireTransferTabState.
// KFSUPGRADE-779
protected boolean checkWireTransferTabState(VendorCreditMemoDocument cmDocument) {
boolean tabStatesOK = true;
CreditMemoWireTransfer cmWireTransfer = ((CuVendorCreditMemoDocument) cmDocument).getCmWireTransfer();
// if payment method is CHECK and wire tab contains data, ask user to clear tab
if (!StringUtils.equals(PaymentMethod.PM_CODE_WIRE, ((CuVendorCreditMemoDocument) cmDocument).getPaymentMethodCode()) && hasWireTransferValues(cmWireTransfer)) {
String questionText = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(CUKFSKeyConstants.QUESTION_CLEAR_UNNEEDED_CM_WIRW_TAB);
Object[] args = { CUPurapConstants.PAYMENT_METHOD, ((CuVendorCreditMemoDocument) cmDocument).getPaymentMethodCode(), CUPurapConstants.WIRE_TRANSFER, PaymentMethod.PM_CODE_WIRE };
questionText = MessageFormat.format(questionText, args);
boolean clearTab = super.askOrAnalyzeYesNoQuestion(KFSConstants.DisbursementVoucherDocumentConstants.CLEAR_WIRE_TRANSFER_TAB_QUESTION_ID, questionText);
if (clearTab) {
// NOTE: Can't replace with new instance because Foreign Draft uses same object
clearWireTransferValues(cmWireTransfer);
} else {
// return to document if the user doesn't want to clear the Wire Transfer tab
super.event.setActionForwardName(KFSConstants.MAPPING_BASIC);
tabStatesOK = false;
}
}
return tabStatesOK;
}
use of edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer in project cu-kfs by CU-CommunityApps.
the class CuVendorCreditMemoDocument method getCmWireTransfer.
public CreditMemoWireTransfer getCmWireTransfer() {
if (ObjectUtils.isNull(cmWireTransfer)) {
cmWireTransfer = new CreditMemoWireTransfer();
cmWireTransfer.setDocumentNumber(this.getDocumentNumber());
}
return cmWireTransfer;
}
Aggregations