lib: fix posting-date-and-balance-assignment error properly (#894)

This commit is contained in:
Simon Michael 2018-10-09 16:08:47 -07:00
parent 8c7c59017a
commit 6c57629b8c
2 changed files with 6 additions and 6 deletions

View File

@ -636,8 +636,8 @@ discriminateByDate tx
| True = do | True = do
when (any (isJust . pdate) $ tpostings tx) $ when (any (isJust . pdate) $ tpostings tx) $
throwError $ unlines $ throwError $ unlines $
["Sorry, a dated posting with a balance assignment and no explicit amount is not" ["postings may not have both a custom date and a balance assignment."
,"allowed. Write the amount, or remove the posting date or balance assignment:\n" ,"Write the posting amount explicitly, or remove the posting date:\n"
, showTransaction tx] , showTransaction tx]
return return
[(tdate tx, Right $ tx { tpostings = removePrices <$> tpostings tx })] [(tdate tx, Right $ tx { tpostings = removePrices <$> tpostings tx })]

View File

@ -222,17 +222,17 @@ hledger -f - stats
>>> /Transactions/ >>> /Transactions/
>>>2 >>>2
>>>=0 >>>=0
# 12. Having both assignements and posting dates is not supported. # 12. Having both assignments and posting dates is not supported.
hledger -f - stats hledger -f - stats
<<< <<<
2013/1/1 2013/1/1
a $1 =$1 a $1 =$1
b =$-1 ; date:2012/1/1 b =$-1 ; date:2012/1/1
>>>2 /Not supported/ >>>2 /postings may not have both a custom date and a balance assignment/
>>>=1 >>>=1
# 13. Having both assignements and posting dates is not supported. # 13. Having both assignments and posting dates is not supported.
hledger -f - stats hledger -f - stats
<<< <<<
@ -246,7 +246,7 @@ hledger -f - stats
d = 3 d = 3
>>>2 /Not supported/ >>>2 /postings may not have both a custom date and a balance assignment/
>>>=1 >>>=1
# 14. Posting Date # 14. Posting Date