View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.sys.web.struts;
17  
18  import static org.kuali.ole.sys.OLEKeyConstants.ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_INVALID_ACCOUNT;
19  import static org.kuali.ole.sys.OLEKeyConstants.ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED;
20  import static org.kuali.ole.sys.OLEKeyConstants.ERROR_REQUIRED;
21  
22  import java.io.FileNotFoundException;
23  import java.io.IOException;
24  import java.util.ArrayList;
25  import java.util.Arrays;
26  import java.util.HashSet;
27  import java.util.Iterator;
28  import java.util.List;
29  import java.util.Properties;
30  import java.util.Set;
31  
32  import javax.servlet.http.HttpServletRequest;
33  import javax.servlet.http.HttpServletResponse;
34  
35  import org.apache.commons.lang.StringUtils;
36  import org.apache.struts.action.ActionForm;
37  import org.apache.struts.action.ActionForward;
38  import org.apache.struts.action.ActionMapping;
39  import org.apache.struts.upload.FormFile;
40  import org.kuali.ole.fp.businessobject.SalesTax;
41  import org.kuali.ole.sys.OLEConstants;
42  import org.kuali.ole.sys.OLEKeyConstants;
43  import org.kuali.ole.sys.OLEPropertyConstants;
44  import org.kuali.ole.sys.businessobject.AccountingLine;
45  import org.kuali.ole.sys.businessobject.AccountingLineOverride;
46  import org.kuali.ole.sys.businessobject.AccountingLineParser;
47  import org.kuali.ole.sys.businessobject.FinancialSystemDocumentHeader;
48  import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry;
49  import org.kuali.ole.sys.businessobject.SourceAccountingLine;
50  import org.kuali.ole.sys.businessobject.TargetAccountingLine;
51  import org.kuali.ole.sys.context.SpringContext;
52  import org.kuali.ole.sys.document.AccountingDocument;
53  import org.kuali.ole.sys.document.AmountTotaling;
54  import org.kuali.ole.sys.document.validation.event.AddAccountingLineEvent;
55  import org.kuali.ole.sys.document.validation.event.DeleteAccountingLineEvent;
56  import org.kuali.ole.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.APPLICATION_PARAMETER;
57  import org.kuali.ole.sys.document.web.struts.FinancialSystemTransactionalDocumentActionBase;
58  import org.kuali.ole.sys.exception.AccountingLineParserException;
59  import org.kuali.ole.sys.service.impl.OleParameterConstants;
60  import org.kuali.rice.core.api.parameter.ParameterEvaluator;
61  import org.kuali.rice.core.api.parameter.ParameterEvaluatorService;
62  import org.kuali.rice.coreservice.framework.parameter.ParameterService;
63  import org.kuali.rice.kew.api.exception.WorkflowException;
64  import org.kuali.rice.kns.service.DataDictionaryService;
65  import org.kuali.rice.kns.service.DictionaryValidationService;
66  import org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase;
67  import org.kuali.rice.krad.service.BusinessObjectService;
68  import org.kuali.rice.krad.service.KualiRuleService;
69  import org.kuali.rice.krad.service.PersistenceService;
70  import org.kuali.rice.krad.util.GlobalVariables;
71  import org.kuali.rice.krad.util.KRADConstants;
72  import org.kuali.rice.krad.util.ObjectUtils;
73  import org.kuali.rice.krad.util.UrlFactory;
74  
75  /**
76   * This class handles UI actions for all shared methods of financial documents.
77   */
78  public class KualiAccountingDocumentActionBase extends FinancialSystemTransactionalDocumentActionBase {
79      protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KualiAccountingDocumentActionBase.class);
80  
81      /**
82       * Adds check for accountingLine updates, generates and dispatches any events caused by such updates
83       * 
84       * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm,
85       *      javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
86       */
87      @Override
88      public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
89          KualiAccountingDocumentFormBase transForm = (KualiAccountingDocumentFormBase) form;
90  
91          // handle changes to accountingLines
92          if (transForm.hasDocumentId()) {
93              AccountingDocument financialDocument = (AccountingDocument) transForm.getDocument();
94  
95              processAccountingLines(financialDocument, transForm, OLEConstants.SOURCE);
96              processAccountingLines(financialDocument, transForm, OLEConstants.TARGET);
97          }
98  
99          // This is after a potential handleUpdate(), to display automatically cleared overrides following a route or save.
100         processAccountingLineOverrides(transForm);
101 
102         // proceed as usual
103         ActionForward result = super.execute(mapping, form, request, response);
104         return result;
105     }
106 
107     /**
108      * All document-load operations get routed through here
109      * 
110      * @see org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#loadDocument(org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase)
111      */
112     @Override
113     protected void loadDocument(KualiDocumentFormBase kualiDocumentFormBase) throws WorkflowException {
114         super.loadDocument(kualiDocumentFormBase);
115 
116 
117         KualiAccountingDocumentFormBase tform = (KualiAccountingDocumentFormBase) kualiDocumentFormBase;
118 
119         // clear out the new accounting line holders
120         tform.setNewSourceLine(null);
121         tform.setNewTargetLine(null);
122 
123         processAccountingLineOverrides(tform);
124     }
125 
126     /**
127      * Needed to override this to keep from losing Sales Tax information
128      * 
129      * @see org.kuali.rice.kns.web.struts.action.KualiAction#refresh(org.apache.struts.action.ActionMapping,
130      *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
131      */
132     @Override
133     public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
134         super.refresh(mapping, form, request, response);
135         refreshSalesTaxInfo(form);
136 
137         return mapping.findForward(OLEConstants.MAPPING_BASIC);
138     }
139 
140     /**
141      * Needed to override this to keep from losing Sales Tax information
142      * 
143      * @see org.kuali.rice.kns.web.struts.action.KualiAction#toggleTab(org.apache.struts.action.ActionMapping,
144      *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
145      */
146     @Override
147     public ActionForward toggleTab(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
148         super.toggleTab(mapping, form, request, response);
149         refreshSalesTaxInfo(form);
150 
151         return mapping.findForward(OLEConstants.MAPPING_BASIC);
152     }
153 
154 
155     // Set of actions for which updateEvents should be generated
156     protected static final Set UPDATE_EVENT_ACTIONS;
157     static {
158         String[] updateEventActions = { OLEConstants.SAVE_METHOD, OLEConstants.ROUTE_METHOD, OLEConstants.APPROVE_METHOD, OLEConstants.BLANKET_APPROVE_METHOD };
159         UPDATE_EVENT_ACTIONS = new HashSet();
160         for (int i = 0; i < updateEventActions.length; ++i) {
161             UPDATE_EVENT_ACTIONS.add(updateEventActions[i]);
162         }
163     }
164 
165     /**
166      * @param transForm
167      */
168     protected void processAccountingLineOverrides(KualiAccountingDocumentFormBase transForm) {
169         processAccountingLineOverrides(transForm.getNewSourceLine());
170         processAccountingLineOverrides(transForm.getNewTargetLine());
171         if (transForm.hasDocumentId()) {
172             AccountingDocument financialDocument = (AccountingDocument) transForm.getDocument();
173 
174             processAccountingLineOverrides(financialDocument,financialDocument.getSourceAccountingLines());
175             processAccountingLineOverrides(financialDocument,financialDocument.getTargetAccountingLines());
176         }
177     }
178 
179     /**
180      * @param line
181      */
182     protected void processAccountingLineOverrides(AccountingLine line) {
183         processAccountingLineOverrides(Arrays.asList(new AccountingLine[] { line }));
184     }
185 
186     protected void processAccountingLineOverrides(List accountingLines) {
187         processAccountingLineOverrides(null,accountingLines);
188     }
189     /**
190      * @param accountingLines
191      */
192     protected void processAccountingLineOverrides(AccountingDocument financialDocument ,List accountingLines) {
193         if (!accountingLines.isEmpty()) {
194             
195 
196             for (Iterator i = accountingLines.iterator(); i.hasNext();) {
197                 AccountingLine line = (AccountingLine) i.next();
198                // line.refreshReferenceObject("account");
199                 SpringContext.getBean(PersistenceService.class).retrieveReferenceObjects(line, AccountingLineOverride.REFRESH_FIELDS);
200                 AccountingLineOverride.processForOutput(financialDocument,line);
201             }
202         }
203     }
204 
205     /**
206      * @param transDoc
207      * @param transForm
208      * @param lineSet
209      */
210     protected void processAccountingLines(AccountingDocument transDoc, KualiAccountingDocumentFormBase transForm, String lineSet) {
211         // figure out which set of lines we're looking at
212         List formLines;
213         String pathPrefix;
214         boolean source;
215         if (lineSet.equals(OLEConstants.SOURCE)) {
216             formLines = transDoc.getSourceAccountingLines();
217             pathPrefix = OLEConstants.DOCUMENT_PROPERTY_NAME + "." + OLEConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME;
218             source = true;
219         }
220         else {
221             formLines = transDoc.getTargetAccountingLines();
222             pathPrefix = OLEConstants.DOCUMENT_PROPERTY_NAME + "." + OLEConstants.EXISTING_TARGET_ACCT_LINE_PROPERTY_NAME;
223             source = false;
224         }
225 
226         // find and process corresponding form and baselines
227         int index = 0;
228         for (Iterator i = formLines.iterator(); i.hasNext(); index++) {
229             AccountingLine formLine = (AccountingLine) i.next();
230 
231             // update sales tax required attribute for view
232             // handleSalesTaxRequired(transDoc, formLine, source, false, index);
233             checkSalesTax(transDoc, formLine, source, false, index);
234         }
235     }
236 
237    
238 
239     /**
240      * This method will remove a TargetAccountingLine from a FinancialDocument. This assumes that the user presses the delete button
241      * for a specific accounting line on the document and that the document is represented by a FinancialDocumentFormBase.
242      * 
243      * @param mapping
244      * @param form
245      * @param request
246      * @param response
247      * @return ActionForward
248      * @throws Exception
249      */
250     public ActionForward deleteTargetLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
251         KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;
252 
253         int deleteIndex = getLineToDelete(request);
254         String errorPath = OLEConstants.DOCUMENT_PROPERTY_NAME + "." + OLEConstants.EXISTING_TARGET_ACCT_LINE_PROPERTY_NAME + "[" + deleteIndex + "]";
255         boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new DeleteAccountingLineEvent(errorPath, financialDocumentForm.getDocument(), ((AccountingDocument) financialDocumentForm.getDocument()).getTargetAccountingLine(deleteIndex), false));
256 
257         // if the rule evaluation passed, let's delete it
258         if (rulePassed) {
259             deleteAccountingLine(false, financialDocumentForm, deleteIndex);
260         }
261         else {
262             String[] errorParams = new String[] { "target", Integer.toString(deleteIndex + 1) };
263             GlobalVariables.getMessageMap().putError(errorPath, OLEKeyConstants.ERROR_ACCOUNTINGLINE_DELETERULE_INVALIDACCOUNT, errorParams);
264         }
265 
266         return mapping.findForward(OLEConstants.MAPPING_BASIC);
267     }
268 
269     /**
270      * This method will remove a SourceAccountingLine from a FinancialDocument. This assumes that the user presses the delete button
271      * for a specific accounting line on the document and that the document is represented by a FinancialDocumentFormBase.
272      * 
273      * @param mapping
274      * @param form
275      * @param request
276      * @param response
277      * @return ActionForward
278      * @throws Exception
279      */
280     public ActionForward deleteSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
281         KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;
282 
283         int deleteIndex = getLineToDelete(request);
284         String errorPath = OLEConstants.DOCUMENT_PROPERTY_NAME + "." + OLEConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + deleteIndex + "]";
285         boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new DeleteAccountingLineEvent(errorPath, financialDocumentForm.getDocument(), ((AccountingDocument) financialDocumentForm.getDocument()).getSourceAccountingLine(deleteIndex), false));
286 
287         // if the rule evaluation passed, let's delete it
288         if (rulePassed) {
289             deleteAccountingLine(true, financialDocumentForm, deleteIndex);
290         }
291         else {
292             String[] errorParams = new String[] { "source", Integer.toString(deleteIndex + 1) };
293             GlobalVariables.getMessageMap().putError(errorPath, OLEKeyConstants.ERROR_ACCOUNTINGLINE_DELETERULE_INVALIDACCOUNT, errorParams);
294         }
295 
296         return mapping.findForward(OLEConstants.MAPPING_BASIC);
297     }
298 
299 
300     /**
301      * Deletes the source or target accountingLine with the given index from the given form. Assumes that the rule- and form-
302      * validation have already occurred.
303      * 
304      * @param isSource
305      * @param financialDocumentForm
306      * @param deleteIndex
307      */
308     protected void deleteAccountingLine(boolean isSource, KualiAccountingDocumentFormBase financialDocumentForm, int deleteIndex) {
309         if (isSource) {
310             // remove from document
311             financialDocumentForm.getFinancialDocument().getSourceAccountingLines().remove(deleteIndex);
312 
313         }
314         else {
315             // remove from document
316             financialDocumentForm.getFinancialDocument().getTargetAccountingLines().remove(deleteIndex);
317         }
318         // update the doc total
319         AccountingDocument tdoc = (AccountingDocument) financialDocumentForm.getDocument();
320         if (tdoc instanceof AmountTotaling) {
321             ((FinancialSystemDocumentHeader) financialDocumentForm.getDocument().getDocumentHeader()).setFinancialDocumentTotalAmount(((AmountTotaling) tdoc).getTotalDollarAmount());
322         }
323 
324     }
325 
326 
327     /**
328      * This action executes a call to upload CSV accounting line values as TargetAccountingLines for a given transactional document.
329      * The "uploadAccountingLines()" method handles the multi-part request.
330      * 
331      * @param mapping
332      * @param form
333      * @param request
334      * @param response
335      * @return ActionForward
336      * @throws Exception
337      */
338     public ActionForward uploadTargetLines(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
339 
340         // call method that sourceform and destination list
341         uploadAccountingLines(false, form);
342 
343         return mapping.findForward(OLEConstants.MAPPING_BASIC);
344     }
345 
346 
347     /**
348      * This action executes a call to upload CSV accounting line values as SourceAccountingLines for a given transactional document.
349      * The "uploadAccountingLines()" method handles the multi-part request.
350      * 
351      * @param mapping
352      * @param form
353      * @param request
354      * @param response
355      * @return ActionForward
356      * @throws FileNotFoundException
357      * @throws IOException
358      */
359     public ActionForward uploadSourceLines(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FileNotFoundException, IOException {
360         LOG.info("Uploading source accounting lines");
361         // call method that sourceform and destination list
362         uploadAccountingLines(true, form);
363 
364         return mapping.findForward(OLEConstants.MAPPING_BASIC);
365     }
366 
367     /**
368      * This method determines whether we are uploading source or target lines, and then calls uploadAccountingLines directly on the
369      * document object. This method handles retrieving the actual upload file as an input stream into the document.
370      * 
371      * @param isSource
372      * @param form
373      * @throws FileNotFoundException
374      * @throws IOException
375      */
376     protected void uploadAccountingLines(boolean isSource, ActionForm form) throws FileNotFoundException, IOException {
377         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
378 
379         List importedLines = null;
380 
381         AccountingDocument financialDocument = tmpForm.getFinancialDocument();
382         AccountingLineParser accountingLineParser = financialDocument.getAccountingLineParser();
383 
384         // import the lines
385         String errorPathPrefix = null;
386         try {
387             if (isSource) {
388                 errorPathPrefix = OLEConstants.DOCUMENT_PROPERTY_NAME + "." + OLEConstants.SOURCE_ACCOUNTING_LINE_ERRORS;
389                 FormFile sourceFile = tmpForm.getSourceFile();
390                 checkUploadFile(sourceFile);
391                 importedLines = accountingLineParser.importSourceAccountingLines(sourceFile.getFileName(), sourceFile.getInputStream(), financialDocument);
392             }
393             else {
394                 errorPathPrefix = OLEConstants.DOCUMENT_PROPERTY_NAME + "." + OLEConstants.TARGET_ACCOUNTING_LINE_ERRORS;
395                 FormFile targetFile = tmpForm.getTargetFile();
396                 checkUploadFile(targetFile);
397                 importedLines = accountingLineParser.importTargetAccountingLines(targetFile.getFileName(), targetFile.getInputStream(), financialDocument);
398             }
399         }
400         catch (AccountingLineParserException e) {
401             GlobalVariables.getMessageMap().putError(errorPathPrefix, e.getErrorKey(), e.getErrorParameters());
402         }
403 
404         // add line to list for those lines which were successfully imported
405         if (importedLines != null) {
406             for (Iterator i = importedLines.iterator(); i.hasNext();) {
407                 AccountingLine importedLine = (AccountingLine) i.next();
408                 insertAccountingLine(isSource, tmpForm, importedLine);
409             }
410         }
411     }
412 
413     protected void checkUploadFile(FormFile file) {
414         if (file == null) {
415             throw new AccountingLineParserException("invalid (null) upload file", OLEKeyConstants.ERROR_UPLOADFILE_NULL);
416         }
417     }
418 
419     /**
420      * This method will add a TargetAccountingLine to a FinancialDocument. This assumes that the user presses the add button for a
421      * specific accounting line on the document and that the document is represented by a FinancialDocumentFormBase. It first
422      * validates the line for data integrity and then checks appropriate business rules.
423      * 
424      * @param mapping
425      * @param form
426      * @param request
427      * @param response
428      * @return ActionForward
429      * @throws Exception
430      */
431     public ActionForward insertTargetLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
432         KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;
433         TargetAccountingLine line = financialDocumentForm.getNewTargetLine();
434         
435         // populate chartOfAccountsCode from account number if accounts cant cross chart and Javascript is turned off
436         //SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(line);
437         
438         boolean rulePassed = true;
439         // before we check the regular rules we need to check the sales tax rules
440         // TODO: Refactor rules so we no longer have to call this before a copy of the
441         // accountingLine
442         rulePassed &= checkSalesTax((AccountingDocument) financialDocumentForm.getDocument(), line, false, true, 0);
443 
444         // check any business rules
445         rulePassed &= SpringContext.getBean(KualiRuleService.class).applyRules(new AddAccountingLineEvent(OLEConstants.NEW_TARGET_ACCT_LINE_PROPERTY_NAME, financialDocumentForm.getDocument(), line));
446 
447         // if the rule evaluation passed, let's add it
448         if (rulePassed) {
449             // add accountingLine
450             SpringContext.getBean(PersistenceService.class).refreshAllNonUpdatingReferences(line);
451             insertAccountingLine(false, financialDocumentForm, line);
452 
453             // clear the used newTargetLine
454             financialDocumentForm.setNewTargetLine(null);
455         }
456 
457         return mapping.findForward(OLEConstants.MAPPING_BASIC);
458     }
459 
460 
461     /**
462      * This action executes an insert of a SourceAccountingLine into a document only after validating the accounting line and
463      * checking any appropriate business rules.
464      * 
465      * @param mapping
466      * @param form
467      * @param request
468      * @param response
469      * @return ActionForward
470      * @throws Exception
471      */
472     public ActionForward insertSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
473         KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;       
474         SourceAccountingLine line = financialDocumentForm.getNewSourceLine();
475         
476         // populate chartOfAccountsCode from account number if accounts cant cross chart and Javascript is turned off
477         //SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(line);
478         
479         boolean rulePassed = true;
480         // before we check the regular rules we need to check the sales tax rules
481         // TODO: Refactor rules so we no longer have to call this before a copy of the
482         // accountingLine
483         rulePassed &= checkSalesTax((AccountingDocument) financialDocumentForm.getDocument(), line, true, true, 0);
484         // check any business rules
485         rulePassed &= SpringContext.getBean(KualiRuleService.class).applyRules(new AddAccountingLineEvent(OLEConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME, financialDocumentForm.getDocument(), line));
486 
487         if (rulePassed) {
488             // add accountingLine
489             SpringContext.getBean(PersistenceService.class).refreshAllNonUpdatingReferences(line);
490             insertAccountingLine(true, financialDocumentForm, line);
491 
492             // clear the used newTargetLine
493             financialDocumentForm.setNewSourceLine(null);
494         }
495 
496         return mapping.findForward(OLEConstants.MAPPING_BASIC);
497     }
498 
499     /**
500      * Adds the given accountingLine to the appropriate form-related data structures.
501      * 
502      * @param isSource
503      * @param financialDocumentForm
504      * @param line
505      */
506     protected void insertAccountingLine(boolean isSource, KualiAccountingDocumentFormBase financialDocumentForm, AccountingLine line) {
507         AccountingDocument tdoc = financialDocumentForm.getFinancialDocument();
508         if (isSource) {
509             // add it to the document
510             tdoc.addSourceAccountingLine((SourceAccountingLine) line);
511 
512             // add PK fields to sales tax if needed
513             if (line.isSalesTaxRequired()) {
514                 populateSalesTax(line);
515             }
516 
517             // Update the doc total
518             if (tdoc instanceof AmountTotaling)
519                 ((FinancialSystemDocumentHeader) financialDocumentForm.getDocument().getDocumentHeader()).setFinancialDocumentTotalAmount(((AmountTotaling) tdoc).getTotalDollarAmount());
520         }
521         else {
522             // add it to the document
523             tdoc.addTargetAccountingLine((TargetAccountingLine) line);
524 
525             // add PK fields to sales tax if needed
526             if (line.isSalesTaxRequired()) {
527                 populateSalesTax(line);
528             }
529         }
530     }
531 
532     /**
533      * TODO: remove this method once baseline accounting lines has been removed
534      */
535     protected List deepCopyAccountingLinesList(List originals) {
536         if (originals == null) {
537             return null;
538         }
539         List copiedLines = new ArrayList();
540         for (int i = 0; i < originals.size(); i++) {
541             copiedLines.add(ObjectUtils.deepCopy((AccountingLine) originals.get(i)));
542         }
543         return copiedLines;
544     }
545 
546     /**
547      * This action changes the value of the hide field in the user interface so that when the page is rendered, the UI knows to show
548      * all of the labels for each of the accounting line values.
549      * 
550      * @param mapping
551      * @param form
552      * @param request
553      * @param response
554      * @return ActionForward
555      * @throws Exception
556      */
557     public ActionForward showDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
558         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
559         tmpForm.setHideDetails(false);
560         return mapping.findForward(OLEConstants.MAPPING_BASIC);
561     }
562 
563     /**
564      * This method is triggered when the user toggles the show/hide button to "hide" thus making the UI render without any of the
565      * accounting line labels/descriptions showing up underneath the values in the UI.
566      * 
567      * @param mapping
568      * @param form
569      * @param request
570      * @param response
571      * @return ActionForward
572      * @throws Exception
573      */
574     public ActionForward hideDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
575         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
576         tmpForm.setHideDetails(true);
577         return mapping.findForward(OLEConstants.MAPPING_BASIC);
578     }
579 
580     /**
581      * Takes care of storing the action form in the User session and forwarding to the balance inquiry report menu action for a
582      * source accounting line.
583      * 
584      * @param mapping
585      * @param form
586      * @param request
587      * @param response
588      * @return ActionForward
589      * @throws Exception
590      */
591     public ActionForward performBalanceInquiryForSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
592         SourceAccountingLine line = this.getSourceAccountingLine(form, request);
593         return performBalanceInquiryForAccountingLine(mapping, form, request, line);
594     }
595 
596     /**
597      * Takes care of storing the action form in the User session and forwarding to the balance inquiry report menu action for a
598      * target accounting line.
599      * 
600      * @param mapping
601      * @param form
602      * @param request
603      * @param response
604      * @return ActionForward
605      * @throws Exception
606      */
607     public ActionForward performBalanceInquiryForTargetLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
608         int lineIndex = getSelectedLine(request);
609 
610         TargetAccountingLine line = this.getTargetAccountingLine(form, request);
611 
612         return performBalanceInquiryForAccountingLine(mapping, form, request, line);
613     }
614 
615     /**
616      * This method is a helper method that will return a source accounting line. The reason we're making it protected in here is so
617      * that we can override this method in some of the modules. PurchasingActionBase is one of the subclasses that will be
618      * overriding this, because in PurchasingActionBase, we'll need to get the source accounting line using both an item index and
619      * an account index.
620      * 
621      * @param form
622      * @param request
623      * @param isSource
624      * @return
625      */
626     protected SourceAccountingLine getSourceAccountingLine(ActionForm form, HttpServletRequest request) {
627         int lineIndex = getSelectedLine(request);
628         SourceAccountingLine line = (SourceAccountingLine) ObjectUtils.deepCopy(((KualiAccountingDocumentFormBase) form).getFinancialDocument().getSourceAccountingLine(lineIndex));
629         return line;
630     }
631 
632     protected TargetAccountingLine getTargetAccountingLine(ActionForm form, HttpServletRequest request) {
633         int lineIndex = getSelectedLine(request);
634         TargetAccountingLine line = (TargetAccountingLine) ((KualiAccountingDocumentFormBase) form).getFinancialDocument().getTargetAccountingLine(lineIndex);
635 
636         return line;
637     }
638 
639     /**
640      * This method handles preparing all of the accounting line data so that it can be pushed up to the balance inquiries for
641      * populating the search criteria of each.
642      * 
643      * @param mapping
644      * @param form
645      * @param request
646      * @param line
647      * @return ActionForward
648      */
649     protected ActionForward performBalanceInquiryForAccountingLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, AccountingLine line) {
650         // build out base path for return location
651         String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
652 
653         // build out the actual form key that will be used to retrieve the form on refresh
654         String callerDocFormKey = GlobalVariables.getUserSession().addObjectWithGeneratedKey(form);
655 
656         // now add required parameters
657         Properties parameters = new Properties();
658         parameters.put(OLEConstants.DISPATCH_REQUEST_PARAMETER, OLEConstants.START_METHOD);
659         // need this next param b/c the lookup's return back will overwrite
660         // the original doc form key
661         parameters.put(OLEConstants.BALANCE_INQUIRY_REPORT_MENU_CALLER_DOC_FORM_KEY, callerDocFormKey);
662         parameters.put(OLEConstants.DOC_FORM_KEY, callerDocFormKey);
663         parameters.put(OLEConstants.BACK_LOCATION, basePath + mapping.getPath() + ".do");
664 
665         if (line.getPostingYear() != null) {
666             parameters.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, line.getPostingYear().toString());
667         }
668         if (StringUtils.isNotBlank(line.getReferenceOriginCode())) {
669             parameters.put("referenceOriginCode", line.getReferenceOriginCode());
670         }
671         if (StringUtils.isNotBlank(line.getReferenceNumber())) {
672             parameters.put("referenceNumber", line.getReferenceNumber());
673         }
674         if (StringUtils.isNotBlank(line.getReferenceTypeCode())) {
675             parameters.put("referenceTypeCode", line.getReferenceTypeCode());
676         }
677         if (StringUtils.isNotBlank(line.getDebitCreditCode())) {
678             parameters.put("debitCreditCode", line.getDebitCreditCode());
679         }
680         if (StringUtils.isNotBlank(line.getChartOfAccountsCode())) {
681             parameters.put("chartOfAccountsCode", line.getChartOfAccountsCode());
682         }
683         if (StringUtils.isNotBlank(line.getAccountNumber())) {
684             parameters.put("accountNumber", line.getAccountNumber());
685         }
686         if (StringUtils.isNotBlank(line.getFinancialObjectCode())) {
687             parameters.put("financialObjectCode", line.getFinancialObjectCode());
688         }
689         if (StringUtils.isNotBlank(line.getSubAccountNumber())) {
690             parameters.put("subAccountNumber", line.getSubAccountNumber());
691         }
692         if (StringUtils.isNotBlank(line.getFinancialSubObjectCode())) {
693             parameters.put("financialSubObjectCode", line.getFinancialSubObjectCode());
694         }
695         if (StringUtils.isNotBlank(line.getProjectCode())) {
696             parameters.put("projectCode", line.getProjectCode());
697         }
698         if (StringUtils.isNotBlank(getObjectTypeCodeFromLine(line))) {
699             if (!StringUtils.isBlank(line.getObjectTypeCode())) {
700                 parameters.put("objectTypeCode", line.getObjectTypeCode());
701             }
702             else {
703                 line.refreshReferenceObject("objectCode");
704                 parameters.put("objectTypeCode", line.getObjectCode().getFinancialObjectTypeCode());
705             }
706         }
707 
708         String lookupUrl = UrlFactory.parameterizeUrl(basePath + "/" + OLEConstants.BALANCE_INQUIRY_REPORT_MENU_ACTION, parameters);
709 
710         // register that we're going to come back w/ to this form w/ a refresh methodToCall
711         ((KualiAccountingDocumentFormBase) form).registerEditableProperty(KRADConstants.DISPATCH_REQUEST_PARAMETER);
712 
713         return new ActionForward(lookupUrl, true);
714     }
715 
716     /**
717      * A hook so that most accounting lines - which don't have object types - can have their object type codes used in balance
718      * inquiries
719      * 
720      * @param line the line to get the object type code from
721      * @return the object type code the line would use
722      */
723     protected String getObjectTypeCodeFromLine(AccountingLine line) {
724         line.refreshReferenceObject("objectCode");
725         return line.getObjectCode().getFinancialObjectTypeCode();
726     }
727 
728     @Override
729     public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
730         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
731 
732         ActionForward forward = super.save(mapping, form, request, response);
733 
734         // need to check on sales tax for all the accounting lines
735         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getSourceAccountingLines());
736         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getTargetAccountingLines());
737         return forward;
738     }
739 
740     @Override
741     public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
742         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
743 
744         ActionForward forward = super.approve(mapping, form, request, response);
745 
746         // need to check on sales tax for all the accounting lines
747         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getSourceAccountingLines());
748         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getTargetAccountingLines());
749 
750         return forward;
751     }
752 
753     @Override
754     public ActionForward route(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
755         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
756      //   this.applyCapitalAssetInformation(tmpForm);
757 
758         ActionForward forward = super.route(mapping, form, request, response);
759 
760         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getSourceAccountingLines());
761         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getTargetAccountingLines());
762 
763         return forward;
764     }
765 
766     @Override
767     public ActionForward blanketApprove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
768         KualiAccountingDocumentFormBase tmpForm = (KualiAccountingDocumentFormBase) form;
769 
770         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getSourceAccountingLines());
771         checkSalesTaxRequiredAllLines(tmpForm, tmpForm.getFinancialDocument().getTargetAccountingLines());
772 
773         ActionForward forward = super.blanketApprove(mapping, form, request, response);
774 
775         return forward;
776     }
777 
778     /**
779      * Encapsulate the rule check so we can call it from multiple places
780      * 
781      * @param document
782      * @param line
783      * @return true if sales is either not required or it contains sales tax
784      */
785     protected boolean checkSalesTax(AccountingDocument document, AccountingLine line, boolean source, boolean newLine, int index) {
786         boolean passed = true;
787         if (isSalesTaxRequired(document, line)) {
788             // then set the salesTaxRequired on the accountingLine
789             line.setSalesTaxRequired(true);
790             populateSalesTax(line);
791             // check to see if the sales tax info has been put in
792             passed &= isValidSalesTaxEntered(line, source, newLine, index);
793         } else {
794             //we do not need the saleTax bo for the line otherwise validations will fail.
795             line.setSalesTax(null);
796         }
797         return passed;
798     }
799 
800     /**
801      * This method checks to see if this doctype needs sales tax If it does then it checks to see if the account and object code
802      * require sales tax If it does then it returns true. Note - this is hackish as we shouldn't have to call rules directly from
803      * the action class But we need to in this instance because we are copying the lines before calling rules and need a way to
804      * modify them before they go on
805      * 
806      * @param accountingLine
807      * @return true if sales tax check is needed, false otherwise
808      */
809     protected boolean isSalesTaxRequired(AccountingDocument financialDocument, AccountingLine accountingLine) {
810         boolean required = false;
811         String docType = SpringContext.getBean(DataDictionaryService.class).getDocumentTypeNameByClass(financialDocument.getClass());
812         // first we need to check just the doctype to see if it needs the sales tax check
813         ParameterService parameterService = SpringContext.getBean(ParameterService.class);
814         // apply the rule, see if it fails
815         ParameterEvaluator docTypeSalesTaxCheckEvaluator = /*REFACTORME*/SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(OleParameterConstants.FINANCIAL_PROCESSING_DOCUMENT.class, APPLICATION_PARAMETER.DOCTYPE_SALES_TAX_CHECK, docType);
816         if (docTypeSalesTaxCheckEvaluator.evaluationSucceeds()) {
817             required = true;
818         }
819 
820         // second we need to check the account and object code combination to see if it needs sales tax
821         if (required) {
822             // get the object code and account
823             String objCd = accountingLine.getFinancialObjectCode();
824             String account = accountingLine.getAccountNumber();
825             if (!StringUtils.isEmpty(objCd) && !StringUtils.isEmpty(account)) {
826                 String compare = account + ":" + objCd;
827                 ParameterEvaluator salesTaxApplicableAcctAndObjectEvaluator = /*REFACTORME*/SpringContext.getBean(ParameterEvaluatorService.class).getParameterEvaluator(OleParameterConstants.FINANCIAL_PROCESSING_DOCUMENT.class, APPLICATION_PARAMETER.SALES_TAX_APPLICABLE_ACCOUNTS_AND_OBJECT_CODES, compare);
828                 if (!salesTaxApplicableAcctAndObjectEvaluator.evaluationSucceeds()) {
829                     required = false;
830                 }
831             }
832             else {
833                 // the two fields are currently empty and we don't need to check yet
834                 required = false;
835             }
836         }
837         return required;
838     }
839 
840     /**
841      * This method checks to see if the sales tax information was put into the accounting line
842      * 
843      * @param accountingLine
844      * @return true if entered correctly, false otherwise
845      */
846     protected boolean isValidSalesTaxEntered(AccountingLine accountingLine, boolean source, boolean newLine, int index) {
847         boolean valid = true;
848         DictionaryValidationService dictionaryValidationService = SpringContext.getBean(DictionaryValidationService.class);
849         BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
850         String objCd = accountingLine.getFinancialObjectCode();
851         String account = accountingLine.getAccountNumber();
852         SalesTax salesTax = accountingLine.getSalesTax();
853         String pathPrefix = "";
854         if (source && !newLine) {
855             pathPrefix = "document." + OLEConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + index + "]";
856         }
857         else if (!source && !newLine) {
858             pathPrefix = "document." + OLEConstants.EXISTING_TARGET_ACCT_LINE_PROPERTY_NAME + "[" + index + "]";
859         }
860         else if (source && newLine) {
861             pathPrefix = OLEConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME;
862         }
863         else if (!source && newLine) {
864             pathPrefix = OLEConstants.NEW_TARGET_ACCT_LINE_PROPERTY_NAME;
865         }
866         GlobalVariables.getMessageMap().addToErrorPath(pathPrefix);
867         if (ObjectUtils.isNull(salesTax)) {
868             valid &= false;
869             GlobalVariables.getMessageMap().putError("salesTax.chartOfAccountsCode", ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED, account, objCd);
870         }
871         else {
872 
873             if (StringUtils.isBlank(salesTax.getChartOfAccountsCode())) {
874                 valid &= false;
875                 GlobalVariables.getMessageMap().putError("salesTax.chartOfAccountsCode", ERROR_REQUIRED, "Chart of Accounts");
876             }
877             if (StringUtils.isBlank(salesTax.getAccountNumber())) {
878                 valid &= false;
879                 GlobalVariables.getMessageMap().putError("salesTax.accountNumber", ERROR_REQUIRED, "Account Number");
880             }
881             if (salesTax.getFinancialDocumentGrossSalesAmount() == null) {
882                 valid &= false;
883                 GlobalVariables.getMessageMap().putError("salesTax.financialDocumentGrossSalesAmount", ERROR_REQUIRED, "Gross Sales Amount");
884             }
885             if (salesTax.getFinancialDocumentTaxableSalesAmount() == null) {
886                 valid &= false;
887                 GlobalVariables.getMessageMap().putError("salesTax.financialDocumentTaxableSalesAmount", ERROR_REQUIRED, "Taxable Sales Amount");
888             }
889             if (salesTax.getFinancialDocumentSaleDate() == null) {
890                 valid &= false;
891                 GlobalVariables.getMessageMap().putError("salesTax.financialDocumentSaleDate", ERROR_REQUIRED, "Sale Date");
892             }
893             if (StringUtils.isNotBlank(salesTax.getChartOfAccountsCode()) && StringUtils.isNotBlank(salesTax.getAccountNumber())) {
894 
895                 if (boService.getReferenceIfExists(salesTax, "account") == null) {
896                     valid &= false;
897                     GlobalVariables.getMessageMap().putError("salesTax.accountNumber", ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_INVALID_ACCOUNT, salesTax.getChartOfAccountsCode(), salesTax.getAccountNumber());
898 
899                 }
900             }
901             if (!valid) {
902                 GlobalVariables.getMessageMap().putError("salesTax.chartOfAccountsCode", ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED, account, objCd);
903             }
904         }
905         GlobalVariables.getMessageMap().removeFromErrorPath(pathPrefix);
906         return valid;
907     }
908 
909     /**
910      * This method removes the sales tax information from a line that no longer requires it
911      * 
912      * @param accountingLine
913      */
914     protected void removeSalesTax(AccountingLine accountingLine) {
915         SalesTax salesTax = accountingLine.getSalesTax();
916         if (ObjectUtils.isNotNull(salesTax)) {
917             accountingLine.setSalesTax(null);
918         }
919     }
920 
921 
922     /**
923      * This method checks to see if the given accounting needs sales tax and if it does it sets the salesTaxRequired variable on the
924      * line If it doesn't and it has it then it removes the sales tax information from the line This method is called from the
925      * execute() on all accounting lines that have been edited or lines that have already been added to the document, not on new
926      * lines
927      * 
928      * @param transDoc
929      * @param formLine
930      * @param baseLine
931      */
932     protected void handleSalesTaxRequired(AccountingDocument transDoc, AccountingLine formLine, boolean source, boolean newLine, int index) {
933         boolean salesTaxRequired = isSalesTaxRequired(transDoc, formLine);
934         if (salesTaxRequired) {
935             formLine.setSalesTaxRequired(true);
936             populateSalesTax(formLine);
937         }
938         else if (!salesTaxRequired && hasSalesTaxBeenEntered(formLine, source, newLine, index)) {
939             // remove it if it has been added but is no longer required
940             removeSalesTax(formLine);
941             formLine.setSalesTax(null);
942         }
943         
944         if (!salesTaxRequired) {
945             formLine.setSalesTax(null);
946         }
947     }
948 
949     protected boolean hasSalesTaxBeenEntered(AccountingLine accountingLine, boolean source, boolean newLine, int index) {
950         boolean entered = true;
951         String objCd = accountingLine.getFinancialObjectCode();
952         String account = accountingLine.getAccountNumber();
953         SalesTax salesTax = accountingLine.getSalesTax();
954         if (ObjectUtils.isNull(salesTax)) {
955             return false;
956         }
957         if (StringUtils.isBlank(salesTax.getChartOfAccountsCode())) {
958             entered &= false;
959         }
960         if (StringUtils.isBlank(salesTax.getAccountNumber())) {
961             entered &= false;
962         }
963         if (salesTax.getFinancialDocumentGrossSalesAmount() == null) {
964             entered &= false;
965         }
966         if (salesTax.getFinancialDocumentTaxableSalesAmount() == null) {
967             entered &= false;
968         }
969         if (salesTax.getFinancialDocumentSaleDate() == null) {
970             entered &= false;
971         }
972         return entered;
973     }
974 
975     /**
976      * This method is called from the createDocument and processes through all the accouting lines and checks to see if they need
977      * sales tax fields
978      * 
979      * @param kualiDocumentFormBase
980      * @param baselineSourceLines
981      */
982     protected void handleSalesTaxRequiredAllLines(KualiDocumentFormBase kualiDocumentFormBase, List<AccountingLine> baselineAcctingLines) {
983         AccountingDocument accoutingDocument = (AccountingDocument) kualiDocumentFormBase.getDocument();
984         int index = 0;
985         for (AccountingLine accountingLine : baselineAcctingLines) {
986             boolean source = false;
987             if (accountingLine.isSourceAccountingLine()) {
988                 source = true;
989             }
990             handleSalesTaxRequired(accoutingDocument, accountingLine, source, false, index);
991             index++;
992         }
993 
994     }
995 
996     protected boolean checkSalesTaxRequiredAllLines(KualiDocumentFormBase kualiDocumentFormBase, List<AccountingLine> baselineAcctingLines) {
997         AccountingDocument accoutingDocument = (AccountingDocument) kualiDocumentFormBase.getDocument();
998         boolean passed = true;
999         int index = 0;
1000         for (AccountingLine accountingLine : baselineAcctingLines) {
1001             boolean source = false;
1002             if (accountingLine.isSourceAccountingLine()) {
1003                 source = true;
1004             }
1005             passed &= checkSalesTax(accoutingDocument, accountingLine, source, false, index);
1006             index++;
1007         }
1008         return passed;
1009     }
1010 
1011     /**
1012      * This method refreshes the sales tax fields on a refresh or tab toggle so that all the information that was there before is
1013      * still there after a state change
1014      * 
1015      * @param form
1016      */
1017     protected void refreshSalesTaxInfo(ActionForm form) {
1018         KualiAccountingDocumentFormBase accountingForm = (KualiAccountingDocumentFormBase) form;
1019         AccountingDocument document = (AccountingDocument) accountingForm.getDocument();
1020         List sourceLines = document.getSourceAccountingLines();
1021         List targetLines = document.getTargetAccountingLines();
1022         handleSalesTaxRequiredAllLines(accountingForm, sourceLines);
1023         handleSalesTaxRequiredAllLines(accountingForm, targetLines);
1024 
1025         AccountingLine newTargetLine = accountingForm.getNewTargetLine();
1026         AccountingLine newSourceLine = accountingForm.getNewSourceLine();
1027         if (newTargetLine != null) {
1028             handleSalesTaxRequired(document, newTargetLine, false, true, 0);
1029         }
1030         if (newSourceLine != null) {
1031             handleSalesTaxRequired(document, newSourceLine, true, true, 0);
1032         }
1033     }
1034 
1035     /**
1036      * This method populates the sales tax for a given accounting line with the appropriate primary key fields from the accounting
1037      * line since OJB won't do it automatically for us
1038      * 
1039      * @param line
1040      */
1041     protected void populateSalesTax(AccountingLine line) {
1042         SalesTax salesTax = line.getSalesTax();
1043 
1044         if (ObjectUtils.isNotNull(salesTax)) {
1045             salesTax.setDocumentNumber(line.getDocumentNumber());
1046             salesTax.setFinancialDocumentLineTypeCode(line.getFinancialDocumentLineTypeCode());
1047             salesTax.setFinancialDocumentLineNumber(line.getSequenceNumber());
1048         }
1049     }
1050 
1051     @Override
1052     public ActionForward performLookup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
1053         // parse out the business object name from our methodToCall parameter
1054         String fullParameter = (String) request.getAttribute(OLEConstants.METHOD_TO_CALL_ATTRIBUTE);
1055         String boClassName = StringUtils.substringBetween(fullParameter, OLEConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL, OLEConstants.METHOD_TO_CALL_BOPARM_RIGHT_DEL);
1056 
1057         if (!StringUtils.equals(boClassName, GeneralLedgerPendingEntry.class.getName())) {
1058             return super.performLookup(mapping, form, request, response);
1059         }
1060 
1061         String path = super.performLookup(mapping, form, request, response).getPath();
1062         path = path.replaceFirst(OLEConstants.LOOKUP_ACTION, OLEConstants.GL_MODIFIED_INQUIRY_ACTION);
1063 
1064         return new ActionForward(path, true);
1065     }
1066     
1067 }