mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-09 21:22:26 +03:00
cli: use a blank acct name for postings without the specified pivot tag
Eg. if you --pivot code, postings from transactions with no code value were formerly displayed with the unpivoted account name, so you'd see a mixture of account names and codes. Now we always pivot the account name, to blank if nothing else. This probably makes reports pretty ugly, it's just another step towards making --pivot's behaviour clearer.
This commit is contained in:
parent
dfbb683573
commit
39662260cd
@ -92,7 +92,7 @@ pivot tag j = j{jtxns = map pivotTrans . jtxns $ j}
|
||||
pivotTrans t = t{tpostings = map pivotPosting . tpostings $ t}
|
||||
pivotPosting p
|
||||
| Just (_ , value) <- tagTuple = p{paccount = value, porigin = Just $ originalPosting p}
|
||||
| _ <- tagTuple = p
|
||||
| _ <- tagTuple = p{paccount = T.pack ""}
|
||||
where tagTuple = find ((tag ==) . fst) . postingAllImplicitTags $ p
|
||||
|
||||
-- | Apply the anonymisation transformation on a journal, if option is present
|
||||
|
@ -9,8 +9,8 @@ hledger -f- --pivot TAG print
|
||||
; TAG: value
|
||||
>>>
|
||||
2016/02/16 Test Transaction
|
||||
Account1 2 EUR
|
||||
value -2 EUR
|
||||
2 EUR
|
||||
value -2 EUR
|
||||
; TAG: value
|
||||
|
||||
>>>=0
|
||||
@ -23,8 +23,8 @@ hledger -f- --pivot member bal --no-total
|
||||
income:member fees -2 EUR
|
||||
; member: John Doe
|
||||
>>>
|
||||
2 EUR
|
||||
-2 EUR John Doe
|
||||
2 EUR assets:bank account
|
||||
>>>=0
|
||||
|
||||
# check with another example
|
||||
@ -35,8 +35,8 @@ hledger -f- --pivot budget bal --no-total
|
||||
income:donations -2 EUR
|
||||
; budget: Freifunk
|
||||
>>>
|
||||
2 EUR
|
||||
-2 EUR Freifunk
|
||||
2 EUR assets:bank account
|
||||
>>>=0
|
||||
|
||||
# query on account will find either effective name or original one
|
||||
|
Loading…
Reference in New Issue
Block a user