Search in sources :

Example 1 with CreditMemoWireTransfer

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;
}
Also used : CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) CreditMemoWireTransfer(edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer) MessageMap(org.kuali.kfs.krad.util.MessageMap)

Example 2 with CreditMemoWireTransfer

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;
}
Also used : CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) CreditMemoWireTransfer(edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer) ConfigurationService(org.kuali.rice.core.api.config.property.ConfigurationService)

Example 3 with CreditMemoWireTransfer

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;
}
Also used : CreditMemoWireTransfer(edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer)

Aggregations

CreditMemoWireTransfer (edu.cornell.kfs.module.purap.businessobject.CreditMemoWireTransfer)3 CuVendorCreditMemoDocument (edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument)2 MessageMap (org.kuali.kfs.krad.util.MessageMap)1 VendorCreditMemoDocument (org.kuali.kfs.module.purap.document.VendorCreditMemoDocument)1 ConfigurationService (org.kuali.rice.core.api.config.property.ConfigurationService)1