Search in sources :

Example 1 with WorkflowDocument

use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestDocument method doActionTaken.

public void doActionTaken(ActionTakenEvent event) {
    super.doActionTaken(event);
    WorkflowDocument workflowDocument = getDocumentHeader().getWorkflowDocument();
    String currentNode = null;
    Set<String> currentNodes = workflowDocument.getCurrentNodeNames();
    if (CollectionUtils.isNotEmpty(currentNodes)) {
        Object[] names = currentNodes.toArray();
        if (names.length > 0) {
            currentNode = (String) names[0];
        }
    }
    // everything in the below list requires correcting entries to be written to the GL
    if (PaymentRequestStatuses.getNodesRequiringCorrectingGeneralLedgerEntries().contains(currentNode)) {
        // KFSPTS-2598 : Treasury also can 'calculate'
        if (PurapConstants.PaymentRequestStatuses.NODE_ACCOUNT_REVIEW.equals(currentNode) || PurapConstants.PaymentRequestStatuses.NODE_VENDOR_TAX_REVIEW.equals(currentNode) || PurapConstants.PaymentRequestStatuses.NODE_PAYMENT_METHOD_REVIEW.equals(currentNode)) {
            SpringContext.getBean(PurapGeneralLedgerService.class).generateEntriesModifyPaymentRequest(this);
        }
    }
}
Also used : PurapGeneralLedgerService(org.kuali.kfs.module.purap.service.PurapGeneralLedgerService) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument)

Example 2 with WorkflowDocument

use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocumentPresentationController method getEditModes.

public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    RequisitionDocument reqDocument = (RequisitionDocument) document;
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    if (workflowDocument.isEnroute()) {
        Set<String> nodeNames = workflowDocument.getNodeNames();
        for (Iterator<String> iterator = nodeNames.iterator(); iterator.hasNext(); ) {
            String nodeNamesNode = iterator.next();
            if (RequisitionStatuses.NODE_ACCOUNT.equals(nodeNamesNode)) {
                // KFSPTS-1792 : Should check whetehr object code is capital asset code ?
                editModes.add(CURequisitionEditMode.ENABLE_CAPITAL_ASSET);
            }
        }
        if (SpringContext.getBean(CuPurapAccountingService.class).isFiscalOfficersForAllAcctLines(reqDocument)) {
            editModes.remove(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION);
            editModes.remove(RequisitionEditMode.DISABLE_REMOVE_ACCTS);
            editModes.add(RequisitionEditMode.ENABLE_COMMODITY_CODE);
        }
    }
    if (document instanceof RequisitionDocument && !editModes.contains(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION) && !hasEmptyAcctline((RequisitionDocument) document)) {
        editModes.add(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION);
    }
    return editModes;
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) CuPurapAccountingService(edu.cornell.kfs.module.purap.service.CuPurapAccountingService)

Example 3 with WorkflowDocument

use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.

the class IWantDocumentPresentationController method canEditDocumentOverview.

/*
     * CU Customization (KFSPTS-2270): Added the ability to edit the document overview/description
     * for enroute IWNT docs; we'll use KIM permissions to restrict this to select users.
     * 
     * We restrict the editing of the doc overview to IWNT docs in enroute status at the
     * OrganizationHierarchy node, and further restrict it to non-ad-hoc users.
     */
@Override
public boolean canEditDocumentOverview(Document document) {
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    Set<String> nodeNames = workflowDocument.getCurrentNodeNames();
    return workflowDocument.isEnroute() && CollectionUtils.isNotEmpty(nodeNames) && nodeNames.contains("OrganizationHierarchy") && !SpringContext.getBean(FinancialSystemWorkflowHelperService.class).isAdhocApprovalRequestedForPrincipal(workflowDocument, GlobalVariables.getUserSession().getPrincipalId());
}
Also used : WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) FinancialSystemWorkflowHelperService(org.kuali.kfs.sys.service.FinancialSystemWorkflowHelperService)

Example 4 with WorkflowDocument

use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.

the class IWantDocumentPresentationController method getEditModes.

@Override
public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    IWantDocument iWantDocument = (IWantDocument) document;
    if (SpringContext.getBean(FinancialSystemWorkflowHelperService.class).isAdhocApprovalRequestedForPrincipal(workflowDocument, GlobalVariables.getUserSession().getPrincipalId())) {
        editModes.add("completeOrder");
    }
    if (workflowDocument.isInitiated() || workflowDocument.isSaved()) {
        editModes.add("wizard");
    }
    if (CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP.equalsIgnoreCase(iWantDocument.getStep())) {
        editModes.add(CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP);
        // remove all others
        editModes.remove(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP);
    }
    if (CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP.equalsIgnoreCase(iWantDocument.getStep())) {
        editModes.add(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP);
        // remove all others
        editModes.remove(CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP);
    }
    if (CUPurapConstants.IWantDocumentSteps.VENDOR_STEP.equalsIgnoreCase(iWantDocument.getStep())) {
        editModes.add(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP);
        // remove all others
        editModes.remove(CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP);
    }
    if (CUPurapConstants.IWantDocumentSteps.ROUTING_STEP.equalsIgnoreCase(iWantDocument.getStep())) {
        editModes.add(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP);
        // remove all others
        editModes.remove(CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP);
        editModes.remove(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP);
    }
    // KFSPTS-2527 only display create req and create DV buttons if neither REQ not DV has been created from I Want doc
    if ((StringUtils.isBlank(iWantDocument.getReqsDocId()) && StringUtils.isBlank(iWantDocument.getDvDocId())) && !workflowDocument.isInitiated() && !workflowDocument.isSaved()) {
        editModes.add(CUPurapConstants.IWNT_DOC_CREATE_REQ);
        editModes.add(CUPurapConstants.IWNT_DOC_CREATE_DV);
    }
    editModes.add(CUPurapConstants.IWNT_DOC_USE_LOOKUPS);
    return editModes;
}
Also used : WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) FinancialSystemWorkflowHelperService(org.kuali.kfs.sys.service.FinancialSystemWorkflowHelperService) IWantDocument(edu.cornell.kfs.module.purap.document.IWantDocument)

Example 5 with WorkflowDocument

use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocumentPresentationController method getEditModes.

@Override
public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    PurchaseOrderDocument poDocument = (PurchaseOrderDocument) document;
    WorkflowDocument workflowDocument = poDocument.getFinancialSystemDocumentHeader().getWorkflowDocument();
    String statusCode = poDocument.getApplicationDocumentStatus();
    editModes.add(PurchaseOrderEditMode.ASSIGN_SENSITIVE_DATA);
    // if the ENABLE_COMMODITY_CODE_IND system parameter is Y then add this edit mode so that the commodity code fields would display on the document.
    boolean enableCommodityCode = SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(KfsParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.ENABLE_COMMODITY_CODE_IND);
    if (enableCommodityCode) {
        editModes.add(PurchaseOrderEditMode.ENABLE_COMMODITY_CODE);
    }
    if (canFirstTransmitPrintPo(poDocument)) {
        editModes.add(PurchaseOrderEditMode.PRINT_PURCHASE_ORDER);
    }
    if (canPreviewPrintPo(poDocument)) {
        editModes.add(PurchaseOrderEditMode.PREVIEW_PRINT_PURCHASE_ORDER);
    }
    if (canResendCxml(poDocument)) {
        editModes.add(PurchaseOrderEditMode.RESEND_PURCHASE_ORDER);
    }
    // if vendor has been selected from DB, certain vendor fields are not allowed to be edited
    if (ObjectUtils.isNotNull(poDocument.getVendorHeaderGeneratedIdentifier())) {
        editModes.add(PurchaseOrderEditMode.LOCK_VENDOR_ENTRY);
    }
    // if B2B purchase order, certain fields are not allowed to be edited
    if (RequisitionSources.B2B.equals(poDocument.getRequisitionSourceCode())) {
        editModes.add(PurchaseOrderEditMode.LOCK_B2B_ENTRY);
    }
    // if not B2B requisition, users can edit the posting year if within a given amount of time set in a parameter
    if (!RequisitionSources.B2B.equals(poDocument.getRequisitionSourceCode()) && SpringContext.getBean(PurapService.class).allowEncumberNextFiscalYear() && (PurchaseOrderStatuses.APPDOC_IN_PROCESS.equals(statusCode) || PurchaseOrderStatuses.APPDOC_WAITING_FOR_VENDOR.equals(statusCode) || PurchaseOrderStatuses.APPDOC_WAITING_FOR_DEPARTMENT.equals(statusCode) || PurchaseOrderStatuses.APPDOC_QUOTE.equals(statusCode) || PurchaseOrderStatuses.APPDOC_AWAIT_PURCHASING_REVIEW.equals(statusCode))) {
        editModes.add(PurchaseOrderEditMode.ALLOW_POSTING_YEAR_ENTRY);
    }
    // check if purap tax is enabled
    boolean salesTaxInd = SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(KfsParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.ENABLE_SALES_TAX_IND);
    if (salesTaxInd) {
        editModes.add(PurapAuthorizationConstants.PURAP_TAX_ENABLED);
        if (poDocument.isUseTaxIndicator()) {
            // if use tax, don't allow editing of tax fields
            editModes.add(PurchaseOrderEditMode.LOCK_TAX_AMOUNT_ENTRY);
        } else {
            // display the "clear all taxes" button if doc is not using use tax
            editModes.add(PurchaseOrderEditMode.CLEAR_ALL_TAXES);
        }
    }
    // set display mode for Receiving Address section according to parameter value
    boolean displayReceivingAddress = SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(KfsParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.ENABLE_RECEIVING_ADDRESS_IND);
    if (displayReceivingAddress) {
        editModes.add(PurchaseOrderEditMode.DISPLAY_RECEIVING_ADDRESS);
    }
    // if (workflowDocument.isInitiated() || workflowDocument.isSaved()) {
    if (PurchaseOrderStatuses.APPDOC_IN_PROCESS.equals(statusCode) || PurchaseOrderStatuses.APPDOC_WAITING_FOR_VENDOR.equals(statusCode) || PurchaseOrderStatuses.APPDOC_WAITING_FOR_DEPARTMENT.equals(statusCode) || PurchaseOrderStatuses.APPDOC_QUOTE.equals(statusCode)) {
        editModes.add(PurchaseOrderEditMode.PRE_ROUTE_CHANGEABLE);
    }
    // INTERNAL PURCHASING ROUTE LEVEL - Approvers can edit full detail on Purchase Order except they cannot change the CHART/ORG.
    if (poDocument.isDocumentStoppedInRouteNode(PurapConstants.PurchaseOrderStatuses.NODE_CONTRACT_MANAGEMENT)) {
        editModes.add(PurchaseOrderEditMode.LOCK_INTERNAL_PURCHASING_ENTRY);
    }
    // Set display mode for Split PO.
    if (poDocument.isPendingSplit()) {
        editModes.add(PurchaseOrderEditMode.SPLITTING_ITEM_SELECTION);
    }
    // KFSPTS-985, KFSUPGRADE-75
    if (document instanceof PurchaseOrderDocument && !editModes.contains(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION) && !hasEmptyAcctline((PurchaseOrderDocument) document)) {
        editModes.add(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION);
    }
    return editModes;
}
Also used : PurapService(org.kuali.kfs.module.purap.document.service.PurapService) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) KfsParameterConstants(org.kuali.kfs.sys.service.impl.KfsParameterConstants)

Aggregations

WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)36 ArrayList (java.util.ArrayList)4 FinancialSystemDocumentHeader (org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader)4 Person (org.kuali.rice.kim.api.identity.Person)4 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)3 ActionForward (org.apache.struts.action.ActionForward)3 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)3 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)3 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)2 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)2 Iterator (java.util.Iterator)2 List (java.util.List)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 PurApAccountingLine (org.kuali.kfs.module.purap.businessobject.PurApAccountingLine)2 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)2 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)2 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)2 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)2 PurapService (org.kuali.kfs.module.purap.document.service.PurapService)2 FinancialSystemWorkflowHelperService (org.kuali.kfs.sys.service.FinancialSystemWorkflowHelperService)2