/** * Sets the encumbrance code of the line based on the balance type. * * @param sourceLine - line to set code on */ protected void populateSourceAccountingLineEncumbranceCode(SourceAccountingLine sourceLine) { BalanceType selectedBalanceType = getSelectedBalanceType(); if (ObjectUtils.isNotNull(selectedBalanceType)) { selectedBalanceType.refresh(); sourceLine.setBalanceTyp(selectedBalanceType); sourceLine.setBalanceTypeCode(selectedBalanceType.getCode()); // set the encumbrance update code appropriately // KFSMI-5565 remove the default encumbrance code // no more default encumbrance code // if // (KFSConstants.BALANCE_TYPE_EXTERNAL_ENCUMBRANCE.equals(selectedBalanceType.getCode())) { // // sourceLine.setEncumbranceUpdateCode(KFSConstants.JOURNAL_VOUCHER_ENCUMBRANCE_UPDATE_CODE_BALANCE_TYPE_EXTERNAL_ENCUMBRANCE); // } // else { // sourceLine.setEncumbranceUpdateCode(null); // } } else { // it's the first time in, the form will be empty the first time in // set up default selection value selectedBalanceType = getPopulatedBalanceTypeInstance(KFSConstants.BALANCE_TYPE_ACTUAL); setSelectedBalanceType(selectedBalanceType); setOriginalBalanceType(selectedBalanceType.getCode()); sourceLine.setEncumbranceUpdateCode(null); } }
/** * This method will fully populate a balance type given the passed in code, by calling the * business object service that retrieves the rest of the instances' information. * * @param balanceTypeCode * @return BalanceTyp */ protected BalanceType getPopulatedBalanceTypeInstance(String balanceTypeCode) { // now we have to get the code and the name of the original and new balance types BalanceTypeService bts = SpringContext.getBean(BalanceTypeService.class); BalanceType balanceType = bts.getBalanceTypeByCode(balanceTypeCode); balanceType.setCode(balanceTypeCode); return balanceType; }
/** * Using the selected accounting period to determine university fiscal year and look up all the * encumbrance balance type - check if the selected balance type is for encumbrance * * @return true/false - true if it is an encumbrance balance type */ public boolean getIsEncumbranceBalanceType() { // get encumbrance balance type list BalanceTypeService balanceTypeSerivce = SpringContext.getBean(BalanceTypeService.class); List<String> encumbranceBalanceTypes = balanceTypeSerivce.getEncumbranceBalanceTypes(getSelectedPostingYear()); return encumbranceBalanceTypes.contains(selectedBalanceType.getCode()); }