Exemplo n.º 1
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;
  }
Exemplo n.º 2
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;
  }