diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-01 00:20:23 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-01 04:25:23 -0500 |
commit | c5c2027624de16d11e697d6d342e23b0aa5bb23f (patch) | |
tree | 41e0ad703a52b5915127f52c4e3b64aef06daca1 /src | |
parent | 3497076e048f4aa9c4bea729d9a4070fe4dcfe66 (diff) | |
download | fork-ledger-c5c2027624de16d11e697d6d342e23b0aa5bb23f.tar.gz fork-ledger-c5c2027624de16d11e697d6d342e23b0aa5bb23f.tar.bz2 fork-ledger-c5c2027624de16d11e697d6d342e23b0aa5bb23f.zip |
Fix to xact_t::valid()
Diffstat (limited to 'src')
-rw-r--r-- | src/textual.cc | 3 | ||||
-rw-r--r-- | src/xact.cc | 2 | ||||
-rw-r--r-- | src/xact.h | 15 |
3 files changed, 7 insertions, 13 deletions
diff --git a/src/textual.cc b/src/textual.cc index cbd67352..c2976ee1 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -524,6 +524,7 @@ void instance_t::automated_xact_directive(char * line) journal.auto_xacts.push_back(ae.get()); + ae->journal = &journal; ae->pos = position_t(); ae->pos->pathname = pathname; ae->pos->beg_pos = pos; @@ -559,6 +560,7 @@ void instance_t::period_xact_directive(char * line) if (parse_posts(account_stack.front(), *pe.get())) { reveal_context = true; + pe->journal = &journal; if (pe->finalize()) { extend_xact_base(&journal, *pe.get(), true); @@ -574,6 +576,7 @@ void instance_t::period_xact_directive(char * line) pe.release(); } else { + pe->journal = NULL; throw parse_error(_("Period transaction failed to balance")); } } diff --git a/src/xact.cc b/src/xact.cc index 1ab54bdf..34b8c340 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -457,7 +457,7 @@ bool xact_t::valid() const DEBUG("ledger.validate", "xact_t: ! _date"); return false; } - if (! journal) { + if (! has_flags(ITEM_GENERATED | ITEM_TEMP) && ! journal) { DEBUG("ledger.validate", "xact_t: ! journal"); return false; } @@ -79,7 +79,9 @@ public: virtual bool remove_post(post_t * post); virtual bool finalize(); - virtual bool valid() const = 0; + virtual bool valid() const { + return true; + } #if defined(HAVE_BOOST_SERIALIZATION) private: @@ -179,9 +181,6 @@ public: } virtual void extend_xact(xact_base_t& xact, bool post); - virtual bool valid() const { - return true; - } #if defined(HAVE_BOOST_SERIALIZATION) private: @@ -262,14 +261,6 @@ class period_xact_t : public xact_base_t TRACE_DTOR(period_xact_t); } - virtual bool valid() const { - if (! period.is_valid()) { - DEBUG("ledger.validate", "period_xact_t: ! period.is_valid()"); - return false; - } - return true; - } - #if defined(HAVE_BOOST_SERIALIZATION) private: /** Serialization. */ |