Search in sources :

Example 1 with SufficientFundRebuild

use of org.kuali.kfs.gl.businessobject.SufficientFundRebuild in project cu-kfs by CU-CommunityApps.

the class Account method preUpdate.

@Override
protected void preUpdate() {
    super.preUpdate();
    try {
        // KULCOA-549: update the sufficient funds table
        // get the current data from the database
        BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
        Account originalAcct = (Account) boService.retrieve(this);
        if (originalAcct != null) {
            if (!originalAcct.getSufficientFundsCode().equals(getSufficientFundsCode()) || originalAcct.isExtrnlFinEncumSufficntFndIndicator() != isExtrnlFinEncumSufficntFndIndicator() || originalAcct.isIntrnlFinEncumSufficntFndIndicator() != isIntrnlFinEncumSufficntFndIndicator() || originalAcct.isPendingAcctSufficientFundsIndicator() != isPendingAcctSufficientFundsIndicator() || originalAcct.isFinPreencumSufficientFundIndicator() != isFinPreencumSufficientFundIndicator()) {
                SufficientFundRebuild sfr = new SufficientFundRebuild();
                sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_ACCOUNT);
                sfr.setChartOfAccountsCode(getChartOfAccountsCode());
                sfr.setAccountNumberFinancialObjectCode(getAccountNumber());
                if (boService.retrieve(sfr) == null) {
                    boService.save(sfr);
                }
            }
        }
    } catch (Exception ex) {
        LOG.error("Problem updating sufficient funds rebuild table: ", ex);
    }
}
Also used : SufficientFundRebuild(org.kuali.kfs.gl.businessobject.SufficientFundRebuild) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

SufficientFundRebuild (org.kuali.kfs.gl.businessobject.SufficientFundRebuild)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1