(add_entry): Run `entry_finalize_hooks' before finalizing an entry.
This allows automated entries to add their transactions to the current matching entry before that entry's balance is checked.
This commit is contained in:
parent
7154896d20
commit
21722ae484
1 changed files with 4 additions and 3 deletions
|
|
@ -72,13 +72,15 @@ bool entry_base_t::remove_transaction(transaction_t * xact)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value_t entry_balance;
|
||||||
|
|
||||||
bool entry_base_t::finalize()
|
bool entry_base_t::finalize()
|
||||||
{
|
{
|
||||||
// Scan through and compute the total balance for the entry. This
|
// Scan through and compute the total balance for the entry. This
|
||||||
// is used for auto-calculating the value of entries with no cost,
|
// is used for auto-calculating the value of entries with no cost,
|
||||||
// and the per-unit price of unpriced commodities.
|
// and the per-unit price of unpriced commodities.
|
||||||
|
|
||||||
value_t balance;
|
value_t& balance = entry_balance;
|
||||||
|
|
||||||
bool no_amounts = true;
|
bool no_amounts = true;
|
||||||
for (transactions_list::const_iterator x = transactions.begin();
|
for (transactions_list::const_iterator x = transactions.begin();
|
||||||
|
|
@ -453,8 +455,7 @@ bool journal_t::add_entry(entry_t * entry)
|
||||||
{
|
{
|
||||||
entry->journal = this;
|
entry->journal = this;
|
||||||
|
|
||||||
if (! entry->finalize() ||
|
if (! run_hooks(entry_finalize_hooks, *entry) || ! entry->finalize()) {
|
||||||
! run_hooks(entry_finalize_hooks, *entry)) {
|
|
||||||
entry->journal = NULL;
|
entry->journal = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue