summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGwyneth Morgan <gwymor@tilde.club>2022-10-10 19:36:55 +0000
committerJohn Wiegley <johnw@newartisans.com>2022-10-10 16:13:47 -0400
commit7cfc585deb5877c558f150a2fa90cfe5c705fcbb (patch)
treea702e7c3a1bd2a164a4141d65dc3eb41f4685d60 /src
parent401fede79815c3396b9a915622347424ef76ac8d (diff)
downloadfork-ledger-7cfc585deb5877c558f150a2fa90cfe5c705fcbb.tar.gz
fork-ledger-7cfc585deb5877c558f150a2fa90cfe5c705fcbb.tar.bz2
fork-ledger-7cfc585deb5877c558f150a2fa90cfe5c705fcbb.zip
xml: Include posting-specific payee in output
In `ledger xml` export, include the `<posting>`-specific payee (from the `Payee:` tag) as `<payee>`. This data is already included under `<metadata>` as `<value key="Payee">`, but that is more specific to Ledger's implementation; if in the future there is another way to set the payee (or perhaps an option to have the Payee tag in one's own language), that field wouldn't be a reliable method of getting this info. Example: 2022-01-01 Transaction-level payee a 10 b ; Payee: Posting-level payee Relevant XML output: <transaction> <date>2022-01-01</date> <payee>Transaction-level payee</payee> <postings> <posting> <account ref="0000558defd6f260"> <name>a</name> </account> <post-amount> <amount> <quantity>10</quantity> </amount> </post-amount> <total> <amount> <quantity>10</quantity> </amount> </total> </posting> <posting> <payee>Posting-level payee</payee> <account ref="0000558defd6f960"> <name>b</name> </account> <post-amount> <amount> <quantity>-10</quantity> </amount> </post-amount> <note> Payee: Posting-level payee</note> <metadata> <value key="Payee"> <string>Posting-level payee</string> </value> </metadata> <total> <amount> <quantity>0</quantity> </amount> </total> </posting> </postings> </transaction>
Diffstat (limited to 'src')
-rw-r--r--src/post.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/post.cc b/src/post.cc
index 308283af..7c5379c4 100644
--- a/src/post.cc
+++ b/src/post.cc
@@ -723,6 +723,9 @@ void put_post(property_tree::ptree& st, const post_t& post)
if (post._date_aux)
put_date(st.put("aux-date", ""), *post._date_aux);
+ if (post.payee_from_tag() != "")
+ st.put("payee", post.payee_from_tag());
+
if (post.account) {
property_tree::ptree& t(st.put("account", ""));