1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.validation.impl;
17
18 import org.kuali.ole.module.purap.businessobject.PurApAccountingLine;
19 import org.kuali.ole.module.purap.document.OlePurchasingAccountsPayableDocument;
20 import org.kuali.ole.module.purap.document.PurchasingAccountsPayableDocument;
21 import org.kuali.ole.module.purap.document.service.PurapService;
22 import org.kuali.ole.sys.context.SpringContext;
23 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
24 import org.kuali.ole.sys.service.FinancialSystemWorkflowHelperService;
25 import org.kuali.rice.krad.util.GlobalVariables;
26
27
28
29
30 public class PurchaseOrderAmendmentAccountingLineAccessibleValidation extends OlePurchasingAccountsPayableAccountingLineAccessibleValidation {
31
32 protected PurapService purapService;
33
34
35
36
37
38
39
40 @Override
41 public boolean validate(AttributedDocumentEvent event) {
42
43 if (purapService.isDocumentStoppedInRouteNode((OlePurchasingAccountsPayableDocument) event.getDocument(), "New Unordered Items")) {
44
45 return true;
46
47 } else if (SpringContext.getBean(FinancialSystemWorkflowHelperService.class).isAdhocApprovalRequestedForPrincipal(event.getDocument().getDocumentHeader().getWorkflowDocument(), GlobalVariables.getUserSession().getPrincipalId())) {
48 return true;
49 } else {
50 boolean result = false;
51 boolean setDummyAccountIdentifier = false;
52
53 if (needsDummyAccountIdentifier()) {
54 ((PurApAccountingLine) getAccountingLineForValidation()).setAccountIdentifier(Integer.MAX_VALUE);
55 setDummyAccountIdentifier = true;
56 }
57
58 result = super.validate(event);
59
60 if (setDummyAccountIdentifier) {
61 ((PurApAccountingLine) getAccountingLineForValidation()).setAccountIdentifier(null);
62 }
63
64 return result;
65 }
66 }
67
68 public void setPurapService(PurapService purapService) {
69 this.purapService = purapService;
70 }
71
72 }
73