Exemple #1
0
 protected void populatePersonnelHierarchySummary(BudgetForm budgetForm) {
   if (Boolean.valueOf(budgetForm.getDocument().getParentDocument().getProposalBudgetFlag())) {
     ProposalDevelopmentDocument parentDocument =
         (ProposalDevelopmentDocument) budgetForm.getDocument().getParentDocument();
     String proposalNumber = parentDocument.getDevelopmentProposal().getProposalNumber();
     budgetForm.setHierarchyPersonnelSummaries(
         getHierarchyHelper().getHierarchyPersonnelSummaries(proposalNumber));
     for (HierarchyPersonnelSummary hierarchyPersonnelSummary :
         budgetForm.getHierarchyPersonnelSummaries()) {
       for (Budget budget : hierarchyPersonnelSummary.getHierarchyBudgets()) {
         reconcilePersonnelRoles(budget.getBudgetDocument());
       }
     }
   }
 }
Exemple #2
0
  public ActionForward summaryTotals(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    BudgetForm budgetForm = (BudgetForm) form;
    BudgetDocument budgetDocument = budgetForm.getDocument();
    populatePersonnelRoles(budgetDocument);
    Budget budget = budgetDocument.getBudget();
    for (BudgetPeriod period : budget.getBudgetPeriods()) {
      for (BudgetLineItem lineItem : period.getBudgetLineItems()) {
        for (BudgetPersonnelDetails budgetPersonnelDetails :
            lineItem.getBudgetPersonnelDetailsList()) {
          budgetPersonnelDetails.refreshReferenceObject("budgetPerson");
        }
      }
    }

    budget.getBudgetTotals();
    budgetForm.setProposalHierarchyIndirectObjectCode(
        getParameterService()
            .getParameterValue(
                BudgetDocument.class, "proposalHierarchySubProjectIndirectCostElement"));
    return mapping.findForward(Constants.BUDGET_SUMMARY_TOTALS_PAGE);
  }
Exemple #3
0
  /**
   * Need to suppress buttons here when 'Totals' tab is clicked.
   *
   * @see
   *     org.kuali.core.web.struts.action.KualiDocumentActionBase#execute(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    final BudgetForm budgetForm = (BudgetForm) form;
    if (budgetForm.getMethodToCall().equals("close")) {
      setupDocumentExit();
    }
    ActionForward actionForward = null;

    actionForward = super.execute(mapping, budgetForm, request, response);

    if (actionForward != null) {
      if ("summaryTotals".equals(actionForward.getName())) {
        budgetForm.suppressButtonsForTotalPage();
      }
    }
    // check if audit rule check is done from PD
    if (budgetForm.isAuditActivated() && !"route".equals(((KualiForm) form).getMethodToCall())) {
      KraServiceLocator.getService(KualiRuleService.class)
          .applyRules(new DocumentAuditEvent(budgetForm.getDocument()));
    }

    return actionForward;
  }
Exemple #4
0
 public ActionForward modularBudget(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   BudgetForm budgetForm = (BudgetForm) form;
   BudgetModularService budgetModularService =
       KraServiceLocator.getService(BudgetModularService.class);
   budgetForm.setBudgetModularSummary(
       budgetModularService.generateModularSummary(budgetForm.getDocument().getBudget()));
   return mapping.findForward(Constants.BUDGET_MODULAR_PAGE);
 }
Exemple #5
0
 public ActionForward budgetActions(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response) {
   BudgetForm budgetForm = (BudgetForm) form;
   BudgetDocument budgetDocument = budgetForm.getDocument();
   Budget budget = budgetDocument.getBudget();
   populateBudgetPrintForms(budget);
   KraServiceLocator.getService(BudgetSubAwardService.class)
       .populateBudgetSubAwardAttachments(budget);
   return mapping.findForward(Constants.BUDGET_ACTIONS_PAGE);
 }
Exemple #6
0
  /**
   * @see
   *     org.kuali.core.web.struts.action.KualiDocumentActionBase#docHandler(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward docHandler(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionForward forward = super.docHandler(mapping, form, request, response);
    BudgetForm budgetForm = (BudgetForm) form;
    if (KEWConstants.INITIATE_COMMAND.equals(budgetForm.getCommand())) {
      budgetForm.getDocument().initialize();
    } else {
      budgetForm.initialize();
    }
    BudgetDocument budgetDocument = budgetForm.getBudgetDocument();
    if (budgetDocument.isBudgetDeleted()) {
      return mapping.findForward("deleted");
    }
    Budget budget = budgetDocument.getBudget();
    copyLineItemToPersonnelDetails(budgetDocument);
    if (budget.getActivityTypeCode().equals("x")) {
      budget.setActivityTypeCode(
          KraServiceLocator.getService(BudgetService.class)
              .getActivityTypeForBudget(budgetDocument));
    }

    if (budget.getOhRateClassCode() != null
        && ((BudgetForm) GlobalVariables.getKualiForm()) != null) {
      ((BudgetForm) GlobalVariables.getKualiForm())
          .setOhRateClassCodePrevValue(budget.getOhRateClassCode());
    }
    if (budget.getUrRateClassCode() != null
        && ((BudgetForm) GlobalVariables.getKualiForm()) != null) {
      ((BudgetForm) GlobalVariables.getKualiForm())
          .setUrRateClassCodePrevValue(budget.getUrRateClassCode());
    }

    if (budgetDocument.getParentDocument() instanceof AwardDocument
        && StringUtils.isNotBlank(budgetForm.getSyncBudgetRate())
        && budgetForm.getSyncBudgetRate().equals("Y")) {
      getBudgetRatesService().syncParentDocumentRates(budgetDocument);
      getBudgetCommonService(budgetDocument.getParentDocument()).calculateBudgetOnSave(budget);
    }

    reconcileBudgetStatus(budgetForm);
    if ("Personnel".equals(budgetForm.getActivePanelName())) {
      forward = personnel(mapping, budgetForm, request, response);
    }
    return forward;
  }
Exemple #7
0
  /** {@inheritDoc} */
  @Override
  public ActionForward save(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    BudgetForm budgetForm = (BudgetForm) form;
    final BudgetDocument budgetDoc = budgetForm.getDocument();
    fixDocHeaderVersion(budgetDoc);
    Budget budget = budgetDoc.getBudget();
    getBudgetCommonService(budgetDoc.getParentDocument()).calculateBudgetOnSave(budget);
    ActionForward forward = super.save(mapping, form, request, response);
    BudgetForm savedBudgetForm = (BudgetForm) form;
    BudgetDocument savedBudgetDoc = savedBudgetForm.getDocument();
    refreshBudgetDocumentVersion(savedBudgetDoc);
    getBusinessObjectService().save(savedBudgetDoc.getParentDocument().getBudgetDocumentVersions());

    final BudgetTDCValidator tdcValidator = new BudgetTDCValidator(request);
    if (budgetForm.toBudgetVersionsPage()
        || "BudgetVersionsAction".equals(budgetForm.getActionName())) {
      GlobalVariables.getErrorMap()
          .addToErrorPath(KNSConstants.DOCUMENT_PROPERTY_NAME + ".proposal");
      tdcValidator.validateGeneratingErrorsAndWarnings(budgetDoc.getParentDocument());
    } else {
      tdcValidator.validateGeneratingWarnings(budgetDoc.getParentDocument());
    }

    if (budgetForm.getMethodToCall().equals("save") && budgetForm.isAuditActivated()) {
      if (Boolean.valueOf(savedBudgetDoc.getParentDocument().getProposalBudgetFlag())) {
        forward = this.getReturnToProposalForward(budgetForm);
      } else {
        forward = mapping.findForward("budgetActions");
      }
    }

    return forward;
  }
Exemple #8
0
  public ActionForward hierarchy(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    BudgetForm budgetForm = (BudgetForm) form;
    ProposalDevelopmentDocument aDoc =
        (ProposalDevelopmentDocument) budgetForm.getDocument().getParentDocument();

    budgetForm.setHierarchyProposalSummaries(
        getHierarchyHelper()
            .getHierarchyProposalSummaries(aDoc.getDevelopmentProposal().getProposalNumber()));
    return mapping.findForward(Constants.HIERARCHY_PAGE);
  }
Exemple #9
0
  public ActionForward expenses(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    BudgetForm budgetForm = (BudgetForm) form;

    populateNonPersonnelCategoryTypeCodes(budgetForm);

    BudgetDocument budgetDocument = budgetForm.getDocument();
    Budget budget = budgetDocument.getBudget();
    budget.refreshReferenceObject("budgetPeriods");

    return mapping.findForward(Constants.BUDGET_EXPENSES_PAGE);
  }
Exemple #10
0
  /**
   * This method sets additional document information in the document header of the budget form. If
   * the document contained in the budget form is null then empty values will be placed for the
   * additional information.
   *
   * @param budgetForm the budget form
   */
  private void setAdditionalDocumentHeaderInfo(final BudgetForm budgetForm) {
    assert budgetForm != null : "the budgetForm is null";

    final BudgetDocument budgetDocument = budgetForm.getDocument();
    Budget budget = budgetDocument.getBudget();
    BudgetParentDocument parentDocument = budgetDocument.getParentDocument();
    if (budget != null
        && parentDocument != null
        && parentDocument.getBudgetDocumentVersions() != null) {
      boolean setAdditionalInfo = false;
      for (final BudgetDocumentVersion budgetVersion : parentDocument.getBudgetDocumentVersions()) {
        if (budgetVersion
            .getBudgetVersionOverview()
            .getBudgetVersionNumber()
            .equals(budget.getBudgetVersionNumber())) {
          budgetForm
              .getDocInfo()
              .add(
                  new HeaderField(
                      BudgetForm.BUDGET_NAME_KEY,
                      budgetVersion.getBudgetVersionOverview().getDocumentDescription()));
          setAdditionalInfo = true;
          break;
        } else {
          budgetForm
              .getDocInfo()
              .add(new HeaderField(BudgetForm.BUDGET_NAME_KEY, Constants.EMPTY_STRING));
        }
      }
      if (!setAdditionalInfo) {
        budgetForm
            .getDocInfo()
            .add(new HeaderField(BudgetForm.BUDGET_NAME_KEY, Constants.EMPTY_STRING));
      }

      if (budget.getBudgetVersionNumber() != null) {
        budgetForm
            .getDocInfo()
            .add(
                new HeaderField(
                    BudgetForm.VERSION_NUMBER_KEY, budget.getBudgetVersionNumber().toString()));
      } else {
        budgetForm
            .getDocInfo()
            .add(new HeaderField(BudgetForm.VERSION_NUMBER_KEY, Constants.EMPTY_STRING));
      }
    }
  }
Exemple #11
0
  /**
   * Gets the correct return-to-proposal action forward.
   *
   * @param form the budget form
   * @return the action forward
   * @throws WorkflowException if there is a problem interacting with workflow
   */
  private ActionForward getReturnToProposalForward(final BudgetForm form) throws WorkflowException {
    assert form != null : "the form is null";
    final DocumentService docService = KraServiceLocator.getService(DocumentService.class);
    final String docNumber = form.getDocument().getParentDocument().getDocumentNumber();

    final ProposalDevelopmentDocument pdDoc =
        (ProposalDevelopmentDocument) docService.getByDocumentHeaderId(docNumber);
    String forwardUrl =
        buildForwardUrl(pdDoc.getDocumentHeader().getWorkflowDocument().getRouteHeaderId());
    if (form.isAuditActivated()) {
      forwardUrl =
          StringUtils.replace(forwardUrl, "Proposal.do?", "Actions.do?auditActivated=true&");
    }
    forwardUrl += "&methodToCallAttribute=methodToCall.reload";
    return new ActionForward(forwardUrl, true);
  }
Exemple #12
0
 protected void reconcileBudgetStatus(BudgetForm budgetForm) {
   BudgetDocument budgetDocument = budgetForm.getDocument();
   Budget budget = budgetDocument.getBudget();
   BudgetParent budgetParent = budgetDocument.getParentDocument().getBudgetParent();
   if (budgetParent instanceof DevelopmentProposal) {
     DevelopmentProposal proposal = (DevelopmentProposal) budgetParent;
     KraServiceLocator.getService(ProposalStatusService.class).loadBudgetStatus(proposal);
   }
   if (budget.getFinalVersionFlag() != null && Boolean.TRUE.equals(budget.getFinalVersionFlag())) {
     budget.setBudgetStatus(budgetParent.getBudgetStatus());
   } else {
     String budgetStatusIncompleteCode =
         this.getParameterService()
             .getParameterValue(BudgetDocument.class, Constants.BUDGET_STATUS_INCOMPLETE_CODE);
     budget.setBudgetStatus(budgetStatusIncompleteCode);
   }
 }
Exemple #13
0
  public ActionForward personnel(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    BudgetForm budgetForm = (BudgetForm) form;
    populatePersonnelHierarchySummary(budgetForm);
    populatePersonnelCategoryTypeCodes(budgetForm);
    if (budgetForm.getBudgetDocument().getBudget().getBudgetPersons().isEmpty()) {
      KraServiceLocator.getService(BudgetPersonService.class)
          .synchBudgetPersonsToProposal(budgetForm.getBudgetDocument().getBudget());
    }
    reconcilePersonnelRoles(budgetForm.getDocument());
    BudgetDocument budgetDocument = budgetForm.getBudgetDocument();
    Budget budget = budgetDocument.getBudget();
    for (BudgetPeriod period : budget.getBudgetPeriods()) {
      for (BudgetLineItem lineItem : period.getBudgetLineItems()) {
        for (BudgetPersonnelDetails budgetPersonnelDetails :
            lineItem.getBudgetPersonnelDetailsList()) {
          budgetPersonnelDetails.refreshReferenceObject("budgetPerson");
          ObjectUtils.materializeObjects(
              budgetPersonnelDetails.getBudgetPersonnelCalculatedAmounts());
          for (BudgetPersonnelCalculatedAmount budgetPersonnelCalculatedAmount :
              budgetPersonnelDetails.getBudgetPersonnelCalculatedAmounts()) {
            if (budgetPersonnelCalculatedAmount.getRateClass() == null) {
              budgetPersonnelCalculatedAmount.refreshReferenceObject("rateClass");
            }
          }
        }

        for (BudgetLineItemCalculatedAmount lineItemCalculatedAmount :
            lineItem.getBudgetLineItemCalculatedAmounts()) {
          if (lineItemCalculatedAmount.getRateClass() == null) {
            lineItemCalculatedAmount.refreshReferenceObject("rateClass");
          }
        }
      }
    }
    return mapping.findForward(Constants.BUDGET_PERSONNEL_PAGE);
  }