diff options
-rw-r--r-- | src/item.cc | 5 | ||||
-rw-r--r-- | src/textual.cc | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/item.cc b/src/item.cc index c6f77987..359f05d7 100644 --- a/src/item.cc +++ b/src/item.cc @@ -41,6 +41,9 @@ namespace { value_t get_status(item_t& item) { return long(item.state()); } + value_t get_uncleared(item_t& item) { + return item.state() == item_t::CLEARED; + } value_t get_cleared(item_t& item) { return item.state() == item_t::CLEARED; } @@ -111,7 +114,7 @@ expr_t::ptr_op_t item_t::lookup(const string& name) case 'u': if (name == "uncleared") - return expr_t::op_t::wrap_value(1L); + return WRAP_FUNCTOR(get_wrapper<&get_uncleared>); break; case 'X': diff --git a/src/textual.cc b/src/textual.cc index eef2cc27..61cfd09a 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -552,7 +552,9 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master, } if (xact_t * xact = parse_xact(line, master, curr.get())) { - xact->set_state(state); + if ((state == item_t::CLEARED && xact->state() != item_t::CLEARED) || + (state == item_t::PENDING && xact->state() == item_t::UNCLEARED)) + xact->set_state(state); xact->beg_pos = beg_pos; xact->beg_line = beg_line; |