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.Iterator;
19  import java.util.List;
20  
21  import org.kuali.ole.fp.businessobject.FiscalYearFunctionControl;
22  import org.kuali.ole.fp.service.FiscalYearFunctionControlService;
23  import org.kuali.ole.sys.context.SpringContext;
24  import org.kuali.ole.sys.service.UniversityDateService;
25  
26  
27  
28  
29  public class YearEndBudgetAdjustmentDocumentPresentationController extends BudgetAdjustmentDocumentPresentationController {
30  
31      
32  
33  
34  
35  
36      @Override
37      public boolean canInitiate(String documentTypeName) {
38          List allowedYears = SpringContext.getBean(FiscalYearFunctionControlService.class).getBudgetAdjustmentAllowedYears();
39          Integer previousPostingYear = new Integer(SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear().intValue() - 1);
40          boolean previousActive = false;
41  		if (allowedYears != null) {
42              for (Iterator iter = allowedYears.iterator(); iter.hasNext();) {
43                  FiscalYearFunctionControl fyControl = (FiscalYearFunctionControl) iter.next();
44                  if (fyControl.getUniversityFiscalYear().equals(previousPostingYear)) {
45                      previousActive = true;
46                  }
47              }
48          }
49          return super.canInitiate(documentTypeName) && previousActive;
50      }
51  }
52