001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.fp.document.authorization; 017 018 import java.util.Arrays; 019 import java.util.List; 020 021 import org.kuali.kfs.sys.KFSConstants; 022 import org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader; 023 import org.kuali.kfs.sys.document.authorization.AccountingDocumentPresentationControllerBase; 024 import org.kuali.rice.kew.exception.WorkflowException; 025 import org.kuali.rice.kns.document.Document; 026 import org.kuali.rice.kns.workflow.service.KualiWorkflowDocument; 027 028 public class ProcurementCardDocumentPresentationController extends AccountingDocumentPresentationControllerBase { 029 030 /** 031 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canCancel(org.kuali.rice.kns.document.Document) 032 */ 033 @Override 034 protected boolean canCancel(Document document) { 035 return false; 036 } 037 038 /** 039 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canCopy(org.kuali.rice.kns.document.Document) 040 */ 041 @Override 042 protected boolean canCopy(Document document) { 043 return false; 044 } 045 046 /** 047 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canDisapprove(org.kuali.rice.kns.document.Document) 048 */ 049 @Override 050 protected boolean canDisapprove(Document document) { 051 return false; 052 } 053 054 /** 055 * @see org.kuali.rice.kns.document.authorization.DocumentPresentationControllerBase#canEdit(org.kuali.rice.kns.document.Document) 056 */ 057 @Override 058 protected boolean canEdit(Document document) { 059 KualiWorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); 060 List<String> activeNodes = getCurrentRouteLevels(workflowDocument); 061 062 // FULL_ENTRY only if: a) person has an approval request, b) we are at the correct level, c) it's not a correction document, 063 // d) it is not an ADHOC request (important so that ADHOC don't get full entry). 064 if (workflowDocument.isApprovalRequested() && activeNodes.contains(KFSConstants.RouteLevelNames.ACCOUNT_REVIEW_FULL_EDIT) && (((FinancialSystemDocumentHeader) document.getDocumentHeader()).getFinancialDocumentInErrorNumber() == null) && !workflowDocument.isAdHocRequested()) { 065 return true; 066 } 067 068 return super.canEdit(document); 069 } 070 }