Fix postingCleared for individually-cleared postings

The previous code simply looked directly to the parent transaction's
status to determine whether the posting was cleared. This gave
erroneous information for postings that were individually cleared
even though the parent transaction was not cleared.
This commit is contained in:
Omari Norman 2010-12-26 22:39:28 +00:00
parent c14e533555
commit 4ec0cc474f

View File

@ -74,8 +74,14 @@ sumPostings = sumMixedAmountsPreservingHighestPrecision . map pamount
postingDate :: Posting -> Day postingDate :: Posting -> Day
postingDate p = maybe nulldate tdate $ ptransaction p postingDate p = maybe nulldate tdate $ ptransaction p
-- |Is this posting cleared? If this posting was individually marked
-- as cleared, returns True. Otherwise, return the parent
-- transaction's cleared status or, if there is no parent
-- transaction, return False.
postingCleared :: Posting -> Bool postingCleared :: Posting -> Bool
postingCleared p = maybe False tstatus $ ptransaction p postingCleared p = if pstatus p
then True
else maybe False tstatus $ ptransaction p
-- | Does this posting fall within the given date span ? -- | Does this posting fall within the given date span ?
isPostingInDateSpan :: DateSpan -> Posting -> Bool isPostingInDateSpan :: DateSpan -> Posting -> Bool