Search in sources :

Example 6 with WorkflowDocument

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

the class PurchasingAccountsPayableDocumentPresentationController method canEdit.

/**
 * None of the PURAP documents allowing editing by adhoc requests
 *
 * @see org.kuali.kfs.krad.document.authorization.DocumentPresentationControllerBase#canEdit(org.kuali.kfs.krad.document.Document)
 */
@Override
public boolean canEdit(Document document) {
    Person currentUser = GlobalVariables.getUserSession().getPerson();
    WorkflowDocument kwf = document.getDocumentHeader().getWorkflowDocument();
    // Adding this check so that the initiator will always be able to edit the document (before initial submission)
    if (kwf.getInitiatorPrincipalId().equals(currentUser.getPrincipalId()) && (kwf.isInitiated() || kwf.isSaved())) {
        return true;
    }
    if (!document.getDocumentHeader().getWorkflowDocument().isCompletionRequested() && SpringContext.getBean(FinancialSystemWorkflowHelperService.class).isAdhocApprovalRequestedForPrincipal(document.getDocumentHeader().getWorkflowDocument(), GlobalVariables.getUserSession().getPrincipalId())) {
        return false;
    }
    return super.canEdit(document);
}
Also used : WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) Person(org.kuali.rice.kim.api.identity.Person)

Example 7 with WorkflowDocument

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

the class CheckReconciliationMaintainableImpl method doRouteStatusChange.

/**
 * @see org.kuali.kfs.kns.maintenance.KualiMaintainableImpl#doRouteStatusChange(org.kuali.kfs.kns.bo.DocumentHeader)
 */
public void doRouteStatusChange(DocumentHeader documentHeader) {
    WorkflowDocument workflowDocument = documentHeader.getWorkflowDocument();
    if (workflowDocument.isProcessed() && !KFSConstants.MAINTENANCE_NEW_ACTION.equalsIgnoreCase(getMaintenanceAction())) {
        DocumentService documentService = SpringContext.getBean(DocumentService.class);
        MaintenanceDocument document;
        try {
            document = (MaintenanceDocument) documentService.getByDocumentHeaderId(documentHeader.getDocumentNumber());
            CheckReconciliation oldCr = (CheckReconciliation) document.getOldMaintainableObject().getBusinessObject();
            CheckReconciliation newCr = (CheckReconciliation) document.getNewMaintainableObject().getBusinessObject();
            if (ObjectUtils.isNotNull(oldCr) && !oldCr.getStatus().equalsIgnoreCase(newCr.getStatus())) {
                Date currentDate = SpringContext.getBean(DateTimeService.class).getCurrentSqlDate();
                newCr.setStatusChangeDate(currentDate);
                // KFSUPGRADE-377
                if (CRConstants.CANCELLED.equalsIgnoreCase(newCr.getStatus())) {
                    newCr.setCancelDocHdrId(documentHeader.getDocumentNumber());
                }
            }
        } catch (WorkflowException e) {
            throw new RuntimeCacheException(e);
        }
    }
}
Also used : RuntimeCacheException(org.apache.ojb.broker.cache.RuntimeCacheException) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation) DateTimeService(org.kuali.rice.core.api.datetime.DateTimeService) DocumentService(org.kuali.kfs.krad.service.DocumentService) Date(java.sql.Date)

Example 8 with WorkflowDocument

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

the class CuAdvanceDepositAccountingLineAuthorizer method isDocumentStoppedInRouteNode.

/**
 * Determines if document is in org review node for approval.
 *
 * @param nodeName
 * @param accountingDocument
 * @return true if in org review node for approval, false otherwise
 */
public boolean isDocumentStoppedInRouteNode(String nodeName, AccountingDocument accountingDocument) {
    WorkflowDocument workflowDoc = accountingDocument.getDocumentHeader().getWorkflowDocument();
    Set<String> currentRouteLevels = accountingDocument.getDocumentHeader().getWorkflowDocument().getCurrentNodeNames();
    if (currentRouteLevels.contains(nodeName) && workflowDoc.isApprovalRequested()) {
        return true;
    }
    return false;
}
Also used : WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument)

Example 9 with WorkflowDocument

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

the class CuAdvanceDepositDocumentPresentationController method getEditModes.

@Override
public Set<String> getEditModes(Document document) {
    Set<String> editModes = super.getEditModes(document);
    if (document instanceof AmountTotaling) {
        editModes.add(KFSConstants.AMOUNT_TOTALING_EDITING_MODE);
    }
    editModes.add(KFSConstants.BANK_ENTRY_VIEWABLE_EDITING_MODE);
    AccountingDocument accountingDocument = (AccountingDocument) document;
    WorkflowDocument workflowDocument = accountingDocument.getDocumentHeader().getWorkflowDocument();
    if (workflowDocument.isInitiated() || workflowDocument.isSaved()) {
        editModes.add(CUKFSAuthorizationConstants.AdvanceDepositEditMode.EDITABLE_ADVANCE_DEPOSITS);
    }
    return editModes;
}
Also used : WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) AccountingDocument(org.kuali.kfs.sys.document.AccountingDocument) AmountTotaling(org.kuali.kfs.sys.document.AmountTotaling)

Example 10 with WorkflowDocument

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

the class CuDisbursementVoucherDocumentPresentationController method addTravelSystemGeneratedEntryMode.

/**
 * If the DV was generated from a connection with the Cornell Travel System, enforces special edit rules regarding information on the disbursement voucher.
 *
 * Added condition that DV is not in the Payment Method Reviewers' queue, as the check amount needs to be editable for that circustance.
 *
 * @param document the disbursement voucher document authorization is being sought on
 * @param editModes the edit modes so far, which can be added to
 */
protected void addTravelSystemGeneratedEntryMode(Document document, Set<String> editModes) {
    final CuDisbursementVoucherDocument dvDocument = (CuDisbursementVoucherDocument) document;
    final WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
    final Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
    boolean isAssociatedWithTrip = SpringContext.getBean(CULegacyTravelService.class).isCULegacyTravelIntegrationInterfaceAssociatedWithTrip(dvDocument);
    if (isAssociatedWithTrip && !currentRouteLevels.contains(KFSConstants.RouteLevelNames.PAYMENT_METHOD)) {
        LOG.info("Checking travel system generated entry permissions.");
        editModes.add(CUKFSAuthorizationConstants.DisbursementVoucherEditMode.TRAVEL_SYSTEM_GENERATED_ENTRY);
    }
}
Also used : CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument) CULegacyTravelService(edu.cornell.kfs.fp.document.service.CULegacyTravelService)

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