summaryrefslogtreecommitdiff
path: root/src/post.cc
diff options
context:
space:
mode:
authorDiogo Trentini <diogotrentini@gmail.com>2020-09-16 22:38:01 -0300
committerMartin Michlmayr <tbm@cyrius.com>2021-02-02 17:45:10 +0800
commit5560b0c40f3986704df25095fcc485bcc1de9e5b (patch)
treef61df53eea9a57da82717409c89b1309f09ecd32 /src/post.cc
parentebd2d8dd0865ef41d1931c5304cb42ee1b312cb7 (diff)
downloadfork-ledger-5560b0c40f3986704df25095fcc485bcc1de9e5b.tar.gz
fork-ledger-5560b0c40f3986704df25095fcc485bcc1de9e5b.tar.bz2
fork-ledger-5560b0c40f3986704df25095fcc485bcc1de9e5b.zip
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.
Diffstat (limited to 'src/post.cc')
-rw-r--r--src/post.cc14
1 files changed, 12 insertions, 2 deletions
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<date_t> post_t::aux_date() const
return date;
}
-string post_t::payee() const
+string post_t::payee_from_tag() const
{
if (optional<value_t> 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 {