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.PurchasingAccountsPayableDocument;
20 import org.kuali.ole.module.purap.document.service.PurapService;
21 import org.kuali.ole.sys.context.SpringContext;
22 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
23 import org.kuali.ole.sys.service.FinancialSystemWorkflowHelperService;
24 import org.kuali.rice.krad.util.GlobalVariables;
25
26
27
28
29 public class PurchaseOrderAmendmentAccountingLineAccessibleValidation extends PurchasingAccountsPayableAccountingLineAccessibleValidation {
30
31 protected PurapService purapService;
32
33
34
35
36
37
38
39 @Override
40 public boolean validate(AttributedDocumentEvent event) {
41
42 if (purapService.isDocumentStoppedInRouteNode((PurchasingAccountsPayableDocument) event.getDocument(), "New Unordered Items")) {
43
44 return true;
45
46 } else if (SpringContext.getBean(FinancialSystemWorkflowHelperService.class).isAdhocApprovalRequestedForPrincipal(event.getDocument().getDocumentHeader().getWorkflowDocument(), GlobalVariables.getUserSession().getPrincipalId())) {
47 return true;
48 } else {
49 boolean result = false;
50 boolean setDummyAccountIdentifier = false;
51
52 if (needsDummyAccountIdentifier()) {
53 ((PurApAccountingLine) getAccountingLineForValidation()).setAccountIdentifier(Integer.MAX_VALUE);
54 setDummyAccountIdentifier = true;
55 }
56
57 result = super.validate(event);
58
59 if (setDummyAccountIdentifier) {
60 ((PurApAccountingLine) getAccountingLineForValidation()).setAccountIdentifier(null);
61 }
62
63 return result;
64 }
65 }
66
67 public void setPurapService(PurapService purapService) {
68 this.purapService = purapService;
69 }
70
71 }
72