diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-02 19:17:43 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-02 19:17:43 -0500 |
commit | 46e46dd5a337c009391583a679d6172cf4f5aa42 (patch) | |
tree | 67009e7d8681685afec8b09dcb7930570492e36f /src/post.cc | |
parent | a048afc8a34d3a1c1a6372ef6b7cc373779bcac0 (diff) | |
parent | d6790072eff9cb2a938ee9ed204263ee277a6874 (diff) | |
download | fork-ledger-46e46dd5a337c009391583a679d6172cf4f5aa42.tar.gz fork-ledger-46e46dd5a337c009391583a679d6172cf4f5aa42.tar.bz2 fork-ledger-46e46dd5a337c009391583a679d6172cf4f5aa42.zip |
Merge branch 'next'
Diffstat (limited to 'src/post.cc')
-rw-r--r-- | src/post.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/post.cc b/src/post.cc index 7b5e5325..2a1663cb 100644 --- a/src/post.cc +++ b/src/post.cc @@ -141,6 +141,12 @@ namespace { return string_value(post.xact->payee); } + value_t get_note(post_t& post) { + string note = post.note ? *post.note : empty_string; + note += post.xact->note ? *post.xact->note : empty_string; + return string_value(note); + } + value_t get_magnitude(post_t& post) { return post.xact->magnitude(); } @@ -318,6 +324,11 @@ expr_t::ptr_op_t post_t::lookup(const string& name) return WRAP_FUNCTOR(get_wrapper<&get_magnitude>); break; + case 'n': + if (name == "note") + return WRAP_FUNCTOR(get_wrapper<&get_note>); + break; + case 'p': if (name == "post") return WRAP_FUNCTOR(get_wrapper<&get_this>); @@ -425,4 +436,10 @@ void post_t::add_to_value(value_t& value, const optional<expr_t&>& expr) const } } +void post_t::set_reported_account(account_t * account) +{ + xdata().account = account; + account->xdata().reported_posts.push_back(this); +} + } // namespace ledger |