register: fix a regression, register should not show posting comments

This commit is contained in:
Simon Michael 2010-02-15 20:33:49 +00:00
parent 1698592706
commit 298d192678
4 changed files with 27 additions and 4 deletions

View File

@ -135,7 +135,7 @@ showposting withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] +
datewidth = 10
descwidth = datedescwidth - datewidth - 2
desc = printf ("%-"++(show descwidth)++"s") $ elideRight descwidth de :: String
pstr = showPostingWithoutPrice p
pstr = showPostingForRegister p
bal = padleft 12 (showMixedAmountOrZeroWithoutPrice b)
(da,de) = case ptransaction p of Just (Transaction{tdate=da',tdescription=de'}) -> (da',de')
Nothing -> (nulldate,"")

View File

@ -34,8 +34,8 @@ showPosting (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) =
showamount = padleft 12 . showMixedAmountOrZero
comment = if null com then "" else " ; " ++ com
-- XXX refactor
showPostingWithoutPrice (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) =
concatTopPadded [showaccountname a ++ " ", showamount amt, comment]
showPostingForRegister (Posting{paccount=a,pamount=amt,ptype=t}) =
concatTopPadded [showaccountname a ++ " ", showamount amt]
where
ledger3ishlayout = False
acctnamewidth = if ledger3ishlayout then 25 else 22
@ -45,7 +45,6 @@ showPostingWithoutPrice (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) =
VirtualPosting -> (\s -> "("++s++")", acctnamewidth-2)
_ -> (id,acctnamewidth)
showamount = padleft 12 . showMixedAmountOrZeroWithoutPrice
comment = if null com then "" else " ; " ++ com
isReal :: Posting -> Bool
isReal p = ptype p == RegularPosting

View File

@ -0,0 +1,13 @@
# a posting comment should appear in print
-f - print
<<<
2010/01/01 x
a 1 ; comment
b -1
>>>
2010/01/01 x
a 1 ; comment
b -1
>>>2

View File

@ -0,0 +1,11 @@
# a posting comment should not appear in register
-f - register
<<<
2010/1/1 x
a 1 ; comment
b
>>>
2010/01/01 x a 1 1
b -1 0
>>>2