(chain_xact_handlers): When budgeting and forecasting are being used,
never update the binary cache (and don't create one if none was there). This is because certain intermediary accounts get created during generation of these reports, which should never be recorded in the cache as actual accounts. Also, run the account filter both before and after the budgeting and forecasting filters, to ensure that only the accounts the user is interested in get included in the report.
This commit is contained in:
parent
62eb99ec5a
commit
69881ae385
1 changed files with 27 additions and 0 deletions
27
main.cc
27
main.cc
|
|
@ -186,16 +186,43 @@ chain_xact_handlers(const std::string& command,
|
|||
// them against anything but the future balance.
|
||||
|
||||
if (config.budget_flags) {
|
||||
// Don't generate a cache file after calculating a budget report,
|
||||
// since certain intermediary accounts may get created which
|
||||
// aren't intended to be saved. For example, the user might have
|
||||
// an "Expenses" budget, to catch all other expenses. This will
|
||||
// result in an "Expenses" account being created in the journal --
|
||||
// to reflect the calculated totals -- even though no such account
|
||||
// was ever actually used. Because budgeting and forecasting
|
||||
// might create such "ghost" accounts for internal purposes, we
|
||||
// don't want to change the cache.
|
||||
config.use_cache = false;
|
||||
|
||||
budget_transactions * handler
|
||||
= new budget_transactions(formatter, config.budget_flags);
|
||||
handler->add_period_entries(journal->period_entries);
|
||||
ptrs.push_back(formatter = handler);
|
||||
|
||||
// Apply this before the budget handler, so that only matching
|
||||
// transactions are calculated toward the budget. The use of
|
||||
// filter_transactions above will further clean the results so
|
||||
// that no automated transactions that don't match the filter get
|
||||
// reported.
|
||||
if (! config.predicate.empty())
|
||||
ptrs.push_back(formatter = new filter_transactions(formatter,
|
||||
config.predicate));
|
||||
}
|
||||
else if (! config.forecast_limit.empty()) {
|
||||
config.use_cache = false; // see note above
|
||||
|
||||
forecast_transactions * handler
|
||||
= new forecast_transactions(formatter, config.forecast_limit);
|
||||
handler->add_period_entries(journal->period_entries);
|
||||
ptrs.push_back(formatter = handler);
|
||||
|
||||
// See above, under budget_transactions.
|
||||
if (! config.predicate.empty())
|
||||
ptrs.push_back(formatter = new filter_transactions(formatter,
|
||||
config.predicate));
|
||||
}
|
||||
|
||||
if (config.comm_as_payee)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue