mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 10:17:35 +03:00
imp: "type:" queries now see through aliases/pivots, like acct: (fix #2018)
When doing a type: match we now also check the original unaliased, unpivoted posting, as when doing an acct: match. This is effectively how things worked with the older account type detection in hledger <1.27.
This commit is contained in:
parent
78271d9204
commit
6e7575317a
@ -828,7 +828,16 @@ matchesPostingExtra :: (AccountName -> Maybe AccountType) -> Query -> Posting ->
|
||||
matchesPostingExtra atype (Not q ) p = not $ matchesPostingExtra atype q p
|
||||
matchesPostingExtra atype (Or qs) p = any (\q -> matchesPostingExtra atype q p) qs
|
||||
matchesPostingExtra atype (And qs) p = all (\q -> matchesPostingExtra atype q p) qs
|
||||
matchesPostingExtra atype (Type ts) p = maybe False (\t -> any (t `isAccountSubtypeOf`) ts) . atype $ paccount p
|
||||
matchesPostingExtra atype (Type ts) p =
|
||||
-- does posting's account's type, if we can detect it, match any of the given types ?
|
||||
(maybe False (\t -> any (t `isAccountSubtypeOf`) ts) . atype $ paccount p)
|
||||
-- or, try the same test with the original (pre-aliasing/pivoting) posting's account
|
||||
|| (fromMaybe False $ do
|
||||
porig <- poriginal p
|
||||
let a = paccount porig
|
||||
t <- atype a
|
||||
Just $ any (t `isAccountSubtypeOf`) ts
|
||||
)
|
||||
matchesPostingExtra _ q p = matchesPosting q p
|
||||
|
||||
-- | Does the match expression match this transaction ?
|
||||
|
Loading…
Reference in New Issue
Block a user