A posting's note includes its parent xact's note

This commit is contained in:
John Wiegley 2009-11-01 21:17:23 -05:00
parent a0a91a61c4
commit 39973b1277

View file

@ -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>);