Search in sources :

Example 1 with DisbursementVoucherWireTransferExtendedAttribute

use of edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDocument method prepareForSave.

@Override
public void prepareForSave() {
    if (this instanceof AmountTotaling) {
        if (getFinancialSystemDocumentHeader().getFinancialDocumentStatusCode().equals(KFSConstants.DocumentStatusCodes.ENROUTE) && !getFinancialSystemDocumentHeader().getWorkflowDocument().isCompletionRequested()) {
            if (getParameterService().parameterExists(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, UPDATE_TOTAL_AMOUNT_IN_POST_PROCESSING_PARAMETER_NAME) && getParameterService().getParameterValueAsBoolean(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, UPDATE_TOTAL_AMOUNT_IN_POST_PROCESSING_PARAMETER_NAME)) {
                getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(((AmountTotaling) this).getTotalDollarAmount());
            }
        } else {
            getFinancialSystemDocumentHeader().setFinancialDocumentTotalAmount(((AmountTotaling) this).getTotalDollarAmount());
        }
    }
    captureWorkflowHeaderInformation();
    if (wireTransfer != null) {
        wireTransfer.setDocumentNumber(this.documentNumber);
        ((DisbursementVoucherWireTransferExtendedAttribute) wireTransfer.getExtension()).setDocumentNumber(this.documentNumber);
    }
    if (dvNonResidentAlienTax != null) {
        dvNonResidentAlienTax.setDocumentNumber(this.documentNumber);
    }
    dvPayeeDetail.setDocumentNumber(this.documentNumber);
    ((CuDisbursementVoucherPayeeDetailExtension) dvPayeeDetail.getExtension()).setDocumentNumber(this.documentNumber);
    if (dvNonEmployeeTravel != null) {
        dvNonEmployeeTravel.setDocumentNumber(this.documentNumber);
        dvNonEmployeeTravel.setTotalTravelAmount(dvNonEmployeeTravel.getTotalTravelAmount());
    }
    if (dvPreConferenceDetail != null) {
        dvPreConferenceDetail.setDocumentNumber(this.documentNumber);
        dvPreConferenceDetail.setDisbVchrConferenceTotalAmt(dvPreConferenceDetail.getDisbVchrConferenceTotalAmt());
    }
    if (shouldClearSpecialHandling()) {
        clearSpecialHandling();
    }
    // CU Customization: Also perform check below when an ENROUTE doc is at the initial "AdHoc" node.
    if (getDocumentHeader().getWorkflowDocument().isInitiated() || getDocumentHeader().getWorkflowDocument().isSaved() || (getDocumentHeader().getWorkflowDocument().isEnroute() && getDocumentHeader().getWorkflowDocument().getCurrentNodeNames().contains("AdHoc"))) {
        // need to check whether the user has the permission to edit the bank code
        // if so, don't synchronize since we can't tell whether the value coming in
        // was entered by the user or not.
        DocumentAuthorizer docAuth = getDocumentHelperService().getDocumentAuthorizer(this);
        if (!docAuth.isAuthorizedByTemplate(this, KFSConstants.ParameterNamespaces.KFS, KFSConstants.PermissionTemplate.EDIT_BANK_CODE.name, GlobalVariables.getUserSession().getPrincipalId())) {
            synchronizeBankCodeWithPaymentMethod();
        } else {
            refreshReferenceObject("bank");
        }
        refreshPayeeTypeSuffixIfPaymentIsEditable();
    }
}
Also used : DisbursementVoucherWireTransferExtendedAttribute(edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute) CuDisbursementVoucherPayeeDetailExtension(edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension) TransactionalDocumentAuthorizer(org.kuali.kfs.kns.document.authorization.TransactionalDocumentAuthorizer) DocumentAuthorizer(org.kuali.kfs.kns.document.authorization.DocumentAuthorizer) AmountTotaling(org.kuali.kfs.sys.document.AmountTotaling)

Aggregations

CuDisbursementVoucherPayeeDetailExtension (edu.cornell.kfs.fp.businessobject.CuDisbursementVoucherPayeeDetailExtension)1 DisbursementVoucherWireTransferExtendedAttribute (edu.cornell.kfs.fp.businessobject.DisbursementVoucherWireTransferExtendedAttribute)1 DocumentAuthorizer (org.kuali.kfs.kns.document.authorization.DocumentAuthorizer)1 TransactionalDocumentAuthorizer (org.kuali.kfs.kns.document.authorization.TransactionalDocumentAuthorizer)1 AmountTotaling (org.kuali.kfs.sys.document.AmountTotaling)1