From abb2e6bfc2e3c2badab359382f91a26ab14364c2 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 27 Apr 2018 10:57:40 -0700 Subject: [PATCH] reg: include txn's code field in register CSV output (#746) --- hledger/Hledger/Cli/Commands/Register.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Register.hs b/hledger/Hledger/Cli/Commands/Register.hs index c90c66e7d..6e402a080 100644 --- a/hledger/Hledger/Cli/Commands/Register.hs +++ b/hledger/Hledger/Cli/Commands/Register.hs @@ -68,15 +68,16 @@ register opts@CliOpts{reportopts_=ropts} j = do postingsReportAsCsv :: PostingsReport -> CSV postingsReportAsCsv (_,is) = - ["txnidx","date","description","account","amount","total"] + ["txnidx","date","code","description","account","amount","total"] : map postingsReportItemAsCsvRecord is postingsReportItemAsCsvRecord :: PostingsReportItem -> Record -postingsReportItemAsCsvRecord (_, _, _, p, b) = [idx,date,desc,acct,amt,bal] +postingsReportItemAsCsvRecord (_, _, _, p, b) = [idx,date,code,desc,acct,amt,bal] where idx = show $ maybe 0 tindex $ ptransaction p date = showDate $ postingDate p -- XXX csv should show date2 with --date2 + code = maybe "" (T.unpack . tcode) $ ptransaction p desc = T.unpack $ maybe "" tdescription $ ptransaction p acct = bracket $ T.unpack $ paccount p where