1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.web.struts;
17
18 import org.kuali.ole.module.purap.document.ElectronicInvoiceRejectDocument;
19 import org.kuali.ole.pdp.PdpPropertyConstants;
20 import org.kuali.ole.pdp.businessobject.PurchasingPaymentDetail;
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.ole.sys.OLEParameterKeyConstants;
23 import org.kuali.ole.sys.context.SpringContext;
24 import org.kuali.ole.sys.document.web.struts.FinancialSystemTransactionalDocumentFormBase;
25 import org.kuali.ole.sys.service.impl.OleParameterConstants;
26 import org.kuali.rice.core.api.config.property.ConfigurationService;
27 import org.kuali.rice.coreservice.framework.parameter.ParameterService;
28 import org.kuali.rice.kns.web.ui.ExtraButton;
29 import org.kuali.rice.krad.util.KRADConstants;
30 import org.kuali.rice.krad.util.UrlFactory;
31
32 import java.util.List;
33 import java.util.Properties;
34
35
36
37
38 public class ElectronicInvoiceRejectForm extends FinancialSystemTransactionalDocumentFormBase {
39
40
41
42
43 public ElectronicInvoiceRejectForm() {
44 super();
45 }
46
47 @Override
48 protected String getDefaultDocumentTypeName() {
49 return "OLE_EIRT";
50 }
51
52 public ElectronicInvoiceRejectDocument getElectronicInvoiceRejectDocument() {
53 return (ElectronicInvoiceRejectDocument) getDocument();
54 }
55
56 public void setElectronicInvoiceRejectDocument(ElectronicInvoiceRejectDocument eirDocument) {
57 setDocument(eirDocument);
58 }
59
60
61
62
63
64
65
66
67
68
69
70 @Override
71 public List<ExtraButton> getExtraButtons() {
72
73 extraButtons.clear();
74
75 ElectronicInvoiceRejectDocument eirDoc = this.getElectronicInvoiceRejectDocument();
76
77 String externalImageURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.RICE_EXTERNALIZABLE_IMAGES_URL_KEY);
78 String appExternalImageURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.EXTERNALIZABLE_IMAGES_URL_KEY);
79
80 if (eirDoc.getDocumentHeader().getWorkflowDocument().isEnroute()) {
81 if (eirDoc.isInvoiceResearchIndicator()) {
82 addExtraButton("methodToCall.completeResearch", appExternalImageURL + "buttonsmall_complresearch.gif", "Complete Research");
83 } else {
84 addExtraButton("methodToCall.startResearch", appExternalImageURL + "buttonsmall_research.gif", "Research");
85 }
86 }
87
88 return extraButtons;
89 }
90
91
92
93
94
95
96
97
98
99
100 protected void addExtraButton(String property, String source, String altText) {
101
102 ExtraButton newButton = new ExtraButton();
103
104 newButton.setExtraButtonProperty(property);
105 newButton.setExtraButtonSource(source);
106 newButton.setExtraButtonAltText(altText);
107
108 extraButtons.add(newButton);
109 }
110
111
112
113
114
115
116 public String getDisbursementInfoUrl() {
117 String basePath = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.APPLICATION_URL_KEY);
118 ParameterService parameterService = SpringContext.getBean(ParameterService.class);
119
120 String orgCode = parameterService.getParameterValueAsString(OleParameterConstants.PURCHASING_BATCH.class, OLEParameterKeyConstants.PurapPdpParameterConstants.PURAP_PDP_ORG_CODE);
121 String subUnitCode = parameterService.getParameterValueAsString(OleParameterConstants.PURCHASING_BATCH.class, OLEParameterKeyConstants.PurapPdpParameterConstants.PURAP_PDP_SUB_UNIT_CODE);
122
123 Properties parameters = new Properties();
124 parameters.put(OLEConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.SEARCH_METHOD);
125 parameters.put(OLEConstants.BACK_LOCATION, basePath + "/" + OLEConstants.MAPPING_PORTAL + ".do");
126 parameters.put(KRADConstants.DOC_FORM_KEY, "88888888");
127 parameters.put(OLEConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, PurchasingPaymentDetail.class.getName());
128 parameters.put(OLEConstants.HIDE_LOOKUP_RETURN_LINK, "true");
129 parameters.put(OLEConstants.SUPPRESS_ACTIONS, "false");
130 parameters.put(PdpPropertyConstants.PaymentDetail.PAYMENT_UNIT_CODE, orgCode);
131 parameters.put(PdpPropertyConstants.PaymentDetail.PAYMENT_SUBUNIT_CODE, subUnitCode);
132
133 String lookupUrl = UrlFactory.parameterizeUrl(basePath + "/" + OLEConstants.LOOKUP_ACTION, parameters);
134
135 return lookupUrl;
136 }
137
138 }