summaryrefslogtreecommitdiff
path: root/journal.cc
diff options
context:
space:
mode:
Diffstat (limited to 'journal.cc')
-rw-r--r--journal.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/journal.cc b/journal.cc
index 232bb97a..98847520 100644
--- a/journal.cc
+++ b/journal.cc
@@ -264,7 +264,7 @@ auto_entry_t::~auto_entry_t()
delete predicate;
}
-void auto_entry_t::extend_entry(entry_base_t& entry)
+void auto_entry_t::extend_entry(entry_base_t& entry, bool post)
{
transactions_list initial_xacts(entry.transactions.begin(),
entry.transactions.end());
@@ -277,10 +277,15 @@ void auto_entry_t::extend_entry(entry_base_t& entry)
t != transactions.end();
t++) {
amount_t amt;
- if ((*t)->amount.commodity().symbol.empty())
+ if (! (*t)->amount.commodity()) {
+ if (! post)
+ continue;
amt = (*i)->amount * (*t)->amount;
- else
+ } else {
+ if (post)
+ continue;
amt = (*t)->amount;
+ }
account_t * account = (*t)->account;
std::string fullname = account->fullname();
@@ -458,7 +463,9 @@ bool journal_t::add_entry(entry_t * entry)
{
entry->journal = this;
- if (! run_hooks(entry_finalize_hooks, *entry) || ! entry->finalize()) {
+ if (! run_hooks(entry_finalize_hooks, *entry, false) ||
+ ! entry->finalize() ||
+ ! run_hooks(entry_finalize_hooks, *entry, true)) {
entry->journal = NULL;
return false;
}