From 5560b0c40f3986704df25095fcc485bcc1de9e5b Mon Sep 17 00:00:00 2001 From: Diogo Trentini Date: Wed, 16 Sep 2020 22:38:01 -0300 Subject: Fix issues related to payees declared on posting's metadata Payees declared on posting's metadata are now validated with `--check-payees` option. Also, their aliases are now considered on reports as well. --- src/post.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/post.cc') diff --git a/src/post.cc b/src/post.cc index 97f6b6d4..9cc0594b 100644 --- a/src/post.cc +++ b/src/post.cc @@ -120,12 +120,22 @@ optional post_t::aux_date() const return date; } -string post_t::payee() const +string post_t::payee_from_tag() const { if (optional post_payee = get_tag(_("Payee"))) return post_payee->as_string(); else - return xact->payee; + return ""; +} + +string post_t::payee() const +{ + if (_payee) + return *_payee; + + string post_payee = payee_from_tag(); + + return post_payee != "" ? post_payee : xact->payee; } namespace { -- cgit v1.2.3