register: fix a regression, register should not show posting comments
This commit is contained in:
		
							parent
							
								
									1698592706
								
							
						
					
					
						commit
						298d192678
					
				| @ -135,7 +135,7 @@ showposting withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] + | |||||||
|       datewidth = 10 |       datewidth = 10 | ||||||
|       descwidth = datedescwidth - datewidth - 2 |       descwidth = datedescwidth - datewidth - 2 | ||||||
|       desc = printf ("%-"++(show descwidth)++"s") $ elideRight descwidth de :: String |       desc = printf ("%-"++(show descwidth)++"s") $ elideRight descwidth de :: String | ||||||
|       pstr = showPostingWithoutPrice p |       pstr = showPostingForRegister p | ||||||
|       bal = padleft 12 (showMixedAmountOrZeroWithoutPrice b) |       bal = padleft 12 (showMixedAmountOrZeroWithoutPrice b) | ||||||
|       (da,de) = case ptransaction p of Just (Transaction{tdate=da',tdescription=de'}) -> (da',de') |       (da,de) = case ptransaction p of Just (Transaction{tdate=da',tdescription=de'}) -> (da',de') | ||||||
|                                        Nothing -> (nulldate,"") |                                        Nothing -> (nulldate,"") | ||||||
|  | |||||||
| @ -34,8 +34,8 @@ showPosting (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) = | |||||||
|       showamount = padleft 12 . showMixedAmountOrZero |       showamount = padleft 12 . showMixedAmountOrZero | ||||||
|       comment = if null com then "" else "  ; " ++ com |       comment = if null com then "" else "  ; " ++ com | ||||||
| -- XXX refactor | -- XXX refactor | ||||||
| showPostingWithoutPrice (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) = | showPostingForRegister (Posting{paccount=a,pamount=amt,ptype=t}) = | ||||||
|     concatTopPadded [showaccountname a ++ " ", showamount amt, comment] |     concatTopPadded [showaccountname a ++ " ", showamount amt] | ||||||
|     where |     where | ||||||
|       ledger3ishlayout = False |       ledger3ishlayout = False | ||||||
|       acctnamewidth = if ledger3ishlayout then 25 else 22 |       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) |                           VirtualPosting -> (\s -> "("++s++")", acctnamewidth-2) | ||||||
|                           _ -> (id,acctnamewidth) |                           _ -> (id,acctnamewidth) | ||||||
|       showamount = padleft 12 . showMixedAmountOrZeroWithoutPrice |       showamount = padleft 12 . showMixedAmountOrZeroWithoutPrice | ||||||
|       comment = if null com then "" else "  ; " ++ com |  | ||||||
| 
 | 
 | ||||||
| isReal :: Posting -> Bool | isReal :: Posting -> Bool | ||||||
| isReal p = ptype p == RegularPosting | isReal p = ptype p == RegularPosting | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								tests/print-posting-comment.test
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tests/print-posting-comment.test
									
									
									
									
									
										Normal 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 | ||||||
							
								
								
									
										11
									
								
								tests/register-posting-comment.test
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/register-posting-comment.test
									
									
									
									
									
										Normal 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 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user