/** * All document-load operations get routed through here * * @see * org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#loadDocument(org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase) */ @Override protected void loadDocument(KualiDocumentFormBase kualiDocumentFormBase) throws WorkflowException { super.loadDocument(kualiDocumentFormBase); KualiAccountingDocumentFormBase tform = (KualiAccountingDocumentFormBase) kualiDocumentFormBase; // clear out the new accounting line holders tform.setNewSourceLine(null); tform.setNewTargetLine(null); processAccountingLineOverrides(tform); }
/** * This method will add a TargetAccountingLine to a FinancialDocument. This assumes that the user * presses the add button for a specific accounting line on the document and that the document is * represented by a FinancialDocumentFormBase. It first validates the line for data integrity and * then checks appropriate business rules. * * @param mapping * @param form * @param request * @param response * @return ActionForward * @throws Exception */ public ActionForward insertTargetLine( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form; TargetAccountingLine line = financialDocumentForm.getNewTargetLine(); // populate chartOfAccountsCode from account number if accounts cant cross chart and Javascript // is turned off // SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(line); boolean rulePassed = true; // before we check the regular rules we need to check the sales tax rules // TODO: Refactor rules so we no longer have to call this before a copy of the // accountingLine rulePassed &= checkSalesTax( (AccountingDocument) financialDocumentForm.getDocument(), line, false, true, 0); // check any business rules rulePassed &= SpringContext.getBean(KualiRuleService.class) .applyRules( new AddAccountingLineEvent( KFSConstants.NEW_TARGET_ACCT_LINE_PROPERTY_NAME, financialDocumentForm.getDocument(), line)); // if the rule evaluation passed, let's add it if (rulePassed) { // add accountingLine SpringContext.getBean(PersistenceService.class).refreshAllNonUpdatingReferences(line); insertAccountingLine(false, financialDocumentForm, line); // clear the used newTargetLine financialDocumentForm.setNewTargetLine(null); } return mapping.findForward(KFSConstants.MAPPING_BASIC); }