Fix to xact_t::valid()
This commit is contained in:
parent
3497076e04
commit
c5c2027624
3 changed files with 7 additions and 13 deletions
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
15
src/xact.h
15
src/xact.h
|
|
@ -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. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue