Search in sources :

Example 26 with WorkflowDocument

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

the class CuProcurementCardDocumentPresentationController method canEditDocumentOverview.

@Override
public boolean canEditDocumentOverview(Document document) {
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    Set<String> nodeNames = workflowDocument.getCurrentNodeNames();
    return workflowDocument.isEnroute() && CollectionUtils.isNotEmpty(nodeNames) && nodeNames.contains(KFSConstants.RouteLevelNames.ACCOUNT_REVIEW_FULL_EDIT) && workflowDocument.isApprovalRequested() && !workflowDocument.isAcknowledgeRequested();
}
Also used : WorkflowDocument(org.kuali.kfs.kew.api.WorkflowDocument)

Example 27 with WorkflowDocument

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

the class CuDisbursementVoucherEmployeeInformationValidation method validate.

public boolean validate(AttributedDocumentEvent event) {
    LOG.debug("validate start");
    boolean isValid = true;
    CuDisbursementVoucherDocument document = (CuDisbursementVoucherDocument) getAccountingDocumentForValidation();
    DisbursementVoucherPayeeDetail payeeDetail = document.getDvPayeeDetail();
    if (!payeeDetail.isEmployee() || payeeDetail.isVendor() || !(document.getDocumentHeader().getWorkflowDocument().isInitiated() || document.getDocumentHeader().getWorkflowDocument().isSaved())) {
        return true;
    }
    String employeeId = payeeDetail.getDisbVchrPayeeIdNumber();
    Person employee = personService.getPersonByEmployeeId(employeeId);
    MessageMap errors = GlobalVariables.getMessageMap();
    errors.addToErrorPath(KFSPropertyConstants.DOCUMENT);
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    boolean stateIsInitiated = workflowDocument.isInitiated() || workflowDocument.isSaved();
    if (ObjectUtils.isNull(employee)) {
        employee = personService.getPerson(employeeId);
    } else {
        if (!KFSConstants.EMPLOYEE_ACTIVE_STATUS.equals(employee.getEmployeeStatusCode()) && !CUKFSConstants.EMPLOYEE_RETIRED_STATUS.equals(employee.getEmployeeStatusCode())) {
            // If employee is found, then check that employee is active or retired if the doc has not already been routed.
            if (stateIsInitiated) {
                String label = dataDictionaryService.getAttributeLabel(DisbursementVoucherPayeeDetail.class, KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER);
                errors.putError(DV_PAYEE_ID_NUMBER_PROPERTY_PATH, KFSKeyConstants.ERROR_INACTIVE, label);
                isValid = false;
            }
        }
    }
    // check existence of employee
    if (employee == null) {
        // If employee is not found, report existence error
        String label = dataDictionaryService.getAttributeLabel(DisbursementVoucherPayeeDetail.class, KFSPropertyConstants.DISB_VCHR_PAYEE_ID_NUMBER);
        errors.putError(DV_PAYEE_ID_NUMBER_PROPERTY_PATH, KFSKeyConstants.ERROR_EXISTENCE, label);
        isValid = false;
    }
    errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
    return isValid;
}
Also used : CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) WorkflowDocument(org.kuali.kfs.kew.api.WorkflowDocument) DisbursementVoucherPayeeDetail(org.kuali.kfs.fp.businessobject.DisbursementVoucherPayeeDetail) Person(org.kuali.kfs.kim.api.identity.Person) MessageMap(org.kuali.kfs.krad.util.MessageMap)

Example 28 with WorkflowDocument

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

the class SecurityGroupMaintainable method doRouteStatusChange.

@Override
public void doRouteStatusChange(DocumentHeader documentHeader) {
    super.doRouteStatusChange(documentHeader);
    WorkflowDocument workflowDoc = documentHeader.getWorkflowDocument();
    if (workflowDoc.isProcessed()) {
        SecurityGroup securityGroup = (SecurityGroup) getDataObject();
        createSecurityProvisioningEntryIfItDoesNotExist(securityGroup);
    }
}
Also used : WorkflowDocument(org.kuali.kfs.kew.api.WorkflowDocument) SecurityGroup(edu.cornell.kfs.ksr.businessobject.SecurityGroup)

Example 29 with WorkflowDocument

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

the class CuPurchaseOrderAmendmentDocumentPresentationController method getEditModes.

@Override
public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    PurchaseOrderDocument poDocument = (PurchaseOrderDocument) document;
    if (PurchaseOrderStatuses.APPDOC_CHANGE_IN_PROCESS.equals(poDocument.getApplicationDocumentStatus())) {
        WorkflowDocument workflowDocument = poDocument.getFinancialSystemDocumentHeader().getWorkflowDocument();
        // amendment doc needs to lock its field for initiator while enroute
        if (workflowDocument.isInitiated() || workflowDocument.isSaved() || workflowDocument.isCompletionRequested()) {
            editModes.add(PurchaseOrderEditMode.AMENDMENT_ENTRY);
        }
    }
    // KFSUPGRADE-339
    if (CUPurapConstants.PurchaseOrderStatuses.APPDOC_AWAITING_FISCAL_REVIEW.equals(((PurchaseOrderDocument) document).getApplicationDocumentStatus())) {
        editModes.add(PurchaseOrderEditMode.AMENDMENT_ENTRY);
    }
    if (getPurapService().isDocumentStoppedInRouteNode((PurchasingAccountsPayableDocument) document, "New Unordered Items")) {
        editModes.add(PurchaseOrderEditMode.UNORDERED_ITEM_ACCOUNT_ENTRY);
    }
    PurchasingAccountsPayableDocument purchasingAccountsPayableDocument = (PurchasingAccountsPayableDocument) document;
    List<PurApItem> aboveTheLinePOItems = PurApItemUtils.getAboveTheLineOnly(purchasingAccountsPayableDocument.getItems());
    boolean containsUnpaidPaymentRequestsOrCreditMemos = poDocument.getContainsUnpaidPaymentRequestsOrCreditMemos();
    for (PurApItem poItem : aboveTheLinePOItems) {
        if (!allowAccountingLinesAreEditable((PurchaseOrderItem) poItem, containsUnpaidPaymentRequestsOrCreditMemos)) {
            editModes.add(PurchaseOrderEditMode.DISABLE_REMOVE_ACCTS);
            break;
        }
    }
    // KFSPTS-985
    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 : PurchaseOrderItem(org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem) WorkflowDocument(org.kuali.kfs.kew.api.WorkflowDocument) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) PurchasingAccountsPayableDocument(org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument)

Example 30 with WorkflowDocument

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

the class CuPaymentRequestDocumentPresentationController method getEditModes.

@Override
public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    PaymentRequestDocument paymentRequestDocument = (PaymentRequestDocument) document;
    if (workflowDocument.isInitiated() || workflowDocument.isSaved()) {
        // KFSPTS-1891
        editModes.add(KfsAuthorizationConstants.TransactionalEditMode.FRN_ENTRY);
        editModes.add(KfsAuthorizationConstants.TransactionalEditMode.WIRE_ENTRY);
    }
    // KFSPTS-1891
    if (canApprove(paymentRequestDocument) && canEditAmount(paymentRequestDocument)) {
        editModes.add(CUPaymentRequestEditMode.EDIT_AMOUNT);
    }
    if (paymentRequestDocument.isDocumentStoppedInRouteNode(PaymentRequestStatuses.NODE_PAYMENT_METHOD_REVIEW)) {
        editModes.add(CUPaymentRequestEditMode.WAIVE_WIRE_FEE_EDITABLE);
        // KFSPTS-1891
        editModes.add(KfsAuthorizationConstants.TransactionalEditMode.FRN_ENTRY);
        editModes.add(KfsAuthorizationConstants.TransactionalEditMode.WIRE_ENTRY);
        // KFSPTS-2968 allows DM to edit additional charge amount
        editModes.add(CUPaymentRequestEditMode.ADDITONAL_CHARGE_AMOUNT_EDITABLE);
    }
    if (editModes.contains(PaymentRequestEditMode.TAX_INFO_VIEWABLE)) {
        editModes.remove(PaymentRequestEditMode.TAX_INFO_VIEWABLE);
    }
    // KFSPTS-2712 : allow payment method review to view tax info
    if ((PaymentRequestStatuses.APPDOC_DEPARTMENT_APPROVED.equals(paymentRequestDocument.getApplicationDocumentStatus()) || PaymentRequestStatuses.APPDOC_PAYMENT_METHOD_REVIEW.equals(paymentRequestDocument.getApplicationDocumentStatus())) && // if and only if the preq has gone through tax review would TaxClassificationCode be non-empty
    !StringUtils.isEmpty(paymentRequestDocument.getTaxClassificationCode())) {
        editModes.add(PaymentRequestEditMode.TAX_INFO_VIEWABLE);
    }
    return editModes;
}
Also used : WorkflowDocument(org.kuali.kfs.kew.api.WorkflowDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument)

Aggregations

WorkflowDocument (org.kuali.kfs.kew.api.WorkflowDocument)36 Person (org.kuali.kfs.kim.api.identity.Person)5 ArrayList (java.util.ArrayList)4 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)3 Iterator (java.util.Iterator)3 List (java.util.List)3 ActionForward (org.apache.struts.action.ActionForward)3 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)3 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)2 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)2 HashMap (java.util.HashMap)2 ActionRequest (org.kuali.kfs.kew.actionrequest.ActionRequest)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)2 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)2 PurchasingAccountsPayableDocument (org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument)2 FinancialSystemWorkflowHelperService (org.kuali.kfs.sys.service.FinancialSystemWorkflowHelperService)2 CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)1 RecurringDisbursementVoucherDocument (edu.cornell.kfs.fp.document.RecurringDisbursementVoucherDocument)1 CULegacyTravelService (edu.cornell.kfs.fp.document.service.CULegacyTravelService)1