Search in sources :

Example 21 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestDocumentPresentationController method canDisapprove.

// KFSUPGRADE-964
@Override
public boolean canDisapprove(Document document) {
    // disapprove is never allowed for PREQ except PRNC by Treasury
    CuPaymentRequestDocument paymentRequestDocument = (CuPaymentRequestDocument) document;
    String paymentMethodCode = paymentRequestDocument.getPaymentMethodCode();
    if ((PaymentMethod.PM_CODE_FOREIGN_DRAFT.equalsIgnoreCase(paymentMethodCode) || PaymentMethod.PM_CODE_WIRE.equalsIgnoreCase(paymentMethodCode)) && paymentRequestDocument.isDocumentStoppedInRouteNode(PurapConstants.PaymentRequestStatuses.NODE_PAYMENT_METHOD_REVIEW)) {
        return true;
    } else {
        return false;
    }
}
Also used : CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)

Example 22 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuAccountsPayableBankCodeValidation method validate.

@Override
public boolean validate(AttributedDocumentEvent event) {
    AccountsPayableDocumentBase apDocument = (AccountsPayableDocumentBase) getAccountingDocumentForValidation();
    // check if one of the extended UA documents, if so, take the payment method into account, otherwise, revert to baseline behavior
    boolean isValid = true;
    if (apDocument instanceof PaymentRequestDocument) {
        if (StringUtils.isNotBlank(apDocument.getBankCode())) {
            // PREQ bank code is not required
            isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, ((CuPaymentRequestDocument) apDocument).getPaymentMethodCode(), false, true);
            if (isValid) {
                if (!(event instanceof AttributedRouteDocumentEvent) && StringUtils.isNotBlank(apDocument.getBankCode()) && !CuBankCodeValidation.doesBankCodeNeedToBePopulated(((CuPaymentRequestDocument) apDocument).getPaymentMethodCode())) {
                    apDocument.setBank(null);
                    apDocument.setBankCode(null);
                }
            }
        }
    } else if (apDocument instanceof VendorCreditMemoDocument) {
        if (StringUtils.isNotBlank(apDocument.getBankCode())) {
            isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, ((CuVendorCreditMemoDocument) apDocument).getPaymentMethodCode(), false, true);
            if (isValid) {
                // clear out the bank code on the document if not needed (per the message set by the call above)
                if (StringUtils.isNotBlank(apDocument.getBankCode()) && !CuBankCodeValidation.doesBankCodeNeedToBePopulated(((CuVendorCreditMemoDocument) apDocument).getPaymentMethodCode())) {
                    apDocument.setBank(null);
                    apDocument.setBankCode(null);
                }
            }
        }
    } else {
        isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, false, true);
    }
    return isValid;
}
Also used : AccountsPayableDocumentBase(org.kuali.kfs.module.purap.document.AccountsPayableDocumentBase) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) AttributedRouteDocumentEvent(org.kuali.kfs.sys.document.validation.event.AttributedRouteDocumentEvent) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)

Example 23 with CuPaymentRequestDocument

use of edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestForm method getExtraButtons.

@Override
public List<ExtraButton> getExtraButtons() {
    super.getExtraButtons();
    PaymentRequestDocument paymentRequestDocument = this.getPaymentRequestDocument();
    if (StringUtils.equalsIgnoreCase(paymentRequestDocument.getFinancialSystemDocumentHeader().getApplicationDocumentStatus(), PaymentRequestStatuses.APPDOC_DEPARTMENT_APPROVED) && paymentRequestDocument.getFinancialSystemDocumentHeader().getWorkflowDocument().isFinal() && !SpringContext.getBean(CUPaymentMethodGeneralLedgerPendingEntryService.class).isPaymentMethodProcessedUsingPdp(((CuPaymentRequestDocument) paymentRequestDocument).getPaymentMethodCode())) {
        ExtraButton cancelButton = null;
        for (ExtraButton extraButton : extraButtons) {
            if (StringUtils.equals("methodToCall.cancel", extraButton.getExtraButtonProperty())) {
                cancelButton = extraButton;
            }
        }
        if (ObjectUtils.isNotNull(cancelButton)) {
            extraButtons.remove(cancelButton);
        }
    }
    return extraButtons;
}
Also used : CUPaymentMethodGeneralLedgerPendingEntryService(edu.cornell.kfs.fp.service.CUPaymentMethodGeneralLedgerPendingEntryService) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) ExtraButton(org.kuali.kfs.kns.web.ui.ExtraButton)

Aggregations

CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)23 DocumentService (org.kuali.kfs.krad.service.DocumentService)7 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)7 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)6 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)5 PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)4 HashMap (java.util.HashMap)3 PaymentRequestWireTransfer (edu.cornell.kfs.module.purap.businessobject.PaymentRequestWireTransfer)2 ArrayList (java.util.ArrayList)2 MessageMap (org.kuali.kfs.krad.util.MessageMap)2 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)2 Bank (org.kuali.kfs.sys.businessobject.Bank)2 GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)2 CUPaymentMethodGeneralLedgerPendingEntryService (edu.cornell.kfs.fp.service.CUPaymentMethodGeneralLedgerPendingEntryService)1 CuPaymentRequestItemExtension (edu.cornell.kfs.module.purap.businessobject.CuPaymentRequestItemExtension)1 CuVendorCreditMemoDocument (edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument)1 CUBankService (edu.cornell.kfs.sys.service.CUBankService)1 VendorDetailExtension (edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1