1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.document.authorization;
17
18 import java.util.Set;
19
20 import org.kuali.ole.fp.document.DisbursementVoucherConstants;
21 import org.kuali.ole.fp.document.DisbursementVoucherDocument;
22 import org.kuali.ole.sys.OLEConstants;
23 import org.kuali.ole.sys.OleAuthorizationConstants;
24 import org.kuali.ole.sys.document.authorization.AccountingDocumentPresentationControllerBase;
25 import org.kuali.rice.kew.api.WorkflowDocument;
26 import org.kuali.rice.krad.document.Document;
27
28 public class DisbursementVoucherDocumentPresentationController extends AccountingDocumentPresentationControllerBase {
29
30
31
32 @Override
33 public boolean canBlanketApprove(Document document) {
34 return false;
35 }
36
37 @Override
38 public Set<String> getDocumentActions(Document document) {
39
40 Set<String> documentActions = super.getDocumentActions(document);
41
42 documentActions.remove(OLEConstants.YEAR_END_ACCOUNTING_PERIOD_VIEW_DOCUMENT_ACTION);
43
44 return documentActions;
45 }
46
47
48
49
50 @Override
51 public Set<String> getEditModes(Document document) {
52 Set<String> editModes = super.getEditModes(document);
53
54 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.TAX_ENTRY);
55 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.FRN_ENTRY);
56 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.WIRE_ENTRY);
57 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.IMMEDIATE_DISBURSEMENT_ENTRY);
58
59 addFullEntryEntryMode(document, editModes);
60 addPayeeEditEntryMode(document, editModes);
61 addTravelEntryMode(document, editModes);
62 addPaymentHandlingEntryMode(document, editModes);
63 addVoucherDeadlineEntryMode(document, editModes);
64 addSpecialHandlingChagingEntryMode(document, editModes);
65
66 return editModes;
67 }
68
69 protected void addPayeeEditEntryMode(Document document, Set<String> editModes) {
70 WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
71
72 if ((workflowDocument.isInitiated() || workflowDocument.isSaved())) {
73 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.PAYEE_ENTRY);
74 }
75 else if (workflowDocument.isEnroute()) {
76 Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
77 if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.ACCOUNT) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TAX) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.AWARD) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.CAMPUS) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TRAVEL)) {
78 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.PAYEE_ENTRY);
79 }
80 }
81 }
82
83 protected void addFullEntryEntryMode(Document document, Set<String> editModes) {
84 WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
85
86 if ((workflowDocument.isInitiated() || workflowDocument.isSaved())) {
87 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.FULL_ENTRY);
88 }
89 }
90
91
92
93
94
95
96 protected void addPaymentHandlingEntryMode(Document document, Set<String> editModes) {
97 final WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
98
99 if ((workflowDocument.isInitiated() || workflowDocument.isSaved())) {
100 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.PAYMENT_HANDLING_ENTRY);
101 }
102 final Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
103 if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.ACCOUNT) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.CAMPUS) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TRAVEL) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TAX)) {
104 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.PAYMENT_HANDLING_ENTRY);
105 }
106 }
107
108
109
110
111
112
113 protected void addVoucherDeadlineEntryMode(Document document, Set<String> editModes) {
114 final WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
115
116 if ((workflowDocument.isInitiated() || workflowDocument.isSaved())) {
117 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.VOUCHER_DEADLINE_ENTRY);
118 }
119 final Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
120 if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.ACCOUNT) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.CAMPUS) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TAX) || currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TRAVEL)) {
121 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.VOUCHER_DEADLINE_ENTRY);
122 }
123 }
124
125
126
127
128
129
130 protected void addTravelEntryMode(Document document, Set<String> editModes) {
131 final WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
132
133 final Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
134 if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.ACCOUNT)) {
135 } else if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.TAX)) {
136
137
138
139
140 } else if (currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.PAYMENT_METHOD) && ((DisbursementVoucherDocument)document).getDisbVchrPaymentMethodCode().equals(DisbursementVoucherConstants.PAYMENT_METHOD_DRAFT)) {
141 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.TRAVEL_ENTRY);
142 } else {
143 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.TRAVEL_ENTRY);
144 }
145 }
146
147
148
149
150
151
152 protected void addSpecialHandlingChagingEntryMode(Document document, Set<String> editModes) {
153 final WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
154 final Set<String> currentRouteLevels = workflowDocument.getCurrentNodeNames();
155
156 if (!currentRouteLevels.contains(DisbursementVoucherConstants.RouteLevelNames.PURCHASING)) {
157 editModes.add(OleAuthorizationConstants.DisbursementVoucherEditMode.SPECIAL_HANDLING_CHANGING_ENTRY);
158 }
159 }
160 }