diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index b6a59db395b..6dcb44c25bc 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -745,7 +745,7 @@ addOrAssignAmountAndCheckAssertionB p@Posting{paccount=acc, pamount=amt, pbalanc newbal = oldbalothercommodities + assignedbalthiscommodity diff <- setAmountB acc newbal return (diff,newbal) - let p' = p{pamount=diff, porigin=Just $ originalPosting p} + let p' = p{pamount=diff, poriginal=Just $ originalPosting p} whenM (R.reader bsAssrt) $ checkBalanceAssertionB p' newbal return p' @@ -1050,7 +1050,7 @@ transactionPivot fieldortagname t = t{tpostings = map (postingPivot fieldortagna -- | Replace this posting's account name with the value -- of the given field or tag, if any, otherwise the empty string. postingPivot :: Text -> Posting -> Posting -postingPivot fieldortagname p = p{paccount = pivotedacct, porigin = Just $ originalPosting p} +postingPivot fieldortagname p = p{paccount = pivotedacct, poriginal = Just $ originalPosting p} where pivotedacct | Just t <- ptransaction p, fieldortagname == "code" = tcode t diff --git a/hledger-lib/Hledger/Data/Posting.hs b/hledger-lib/Hledger/Data/Posting.hs index dd9e1e2cfa7..18c67df5c00 100644 --- a/hledger-lib/Hledger/Data/Posting.hs +++ b/hledger-lib/Hledger/Data/Posting.hs @@ -91,7 +91,7 @@ nullposting = Posting ,ptags=[] ,pbalanceassertion=Nothing ,ptransaction=Nothing - ,porigin=Nothing + ,poriginal=Nothing } posting = nullposting @@ -112,7 +112,7 @@ assertion = nullassertion -- Get the original posting, if any. originalPosting :: Posting -> Posting -originalPosting p = fromMaybe p $ porigin p +originalPosting p = fromMaybe p $ poriginal p -- XXX once rendered user output, but just for debugging now; clean up showPosting :: Posting -> String diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index becf506e134..a5eba6b45f8 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -416,7 +416,7 @@ inferBalancingAmount styles t@Transaction{tpostings=ps} in case minferredamt of Nothing -> (p, Nothing) - Just a -> (p{pamount=a', porigin=Just $ originalPosting p}, Just a') + Just a -> (p{pamount=a', poriginal=Just $ originalPosting p}, Just a') where -- Inferred amounts are converted to cost. -- Also ensure the new amount has the standard style for its commodity @@ -483,7 +483,7 @@ priceInferrerFor t pt = inferprice inferprice p@Posting{pamount=Mixed [a]} | caninferprices && ptype p == pt && acommodity a == fromcommodity - = p{pamount=Mixed [a{aprice=conversionprice}], porigin=Just $ originalPosting p} + = p{pamount=Mixed [a{aprice=conversionprice}], poriginal=Just $ originalPosting p} where fromcommodity = head $ filter (`elem` sumcommodities) pcommodities -- these heads are ugly but should be safe conversionprice diff --git a/hledger-lib/Hledger/Data/Types.hs b/hledger-lib/Hledger/Data/Types.hs index f4b365eefb7..d20832826ff 100644 --- a/hledger-lib/Hledger/Data/Types.hs +++ b/hledger-lib/Hledger/Data/Types.hs @@ -297,7 +297,7 @@ data Posting = Posting { -- in a single commodity, excluding subaccounts. ptransaction :: Maybe Transaction, -- ^ this posting's parent transaction (co-recursive types). -- Tying this knot gets tedious, Maybe makes it easier/optional. - porigin :: Maybe Posting -- ^ When this posting has been transformed in some way + poriginal :: Maybe Posting -- ^ When this posting has been transformed in some way -- (eg its amount or price was inferred, or the account name was -- changed by a pivot or budget report), this references the original -- untransformed posting (which will have Nothing in this field). @@ -324,7 +324,7 @@ instance Show Posting where ,"ptags=" ++ show ptags ,"pbalanceassertion=" ++ show pbalanceassertion ,"ptransaction=" ++ show (ptransaction $> "txn") - ,"porigin=" ++ show porigin + ,"poriginal=" ++ show poriginal ] ++ "}" -- TODO: needs renaming, or removal if no longer needed. See also TextPosition in Hledger.UI.Editor diff --git a/hledger-lib/Hledger/Reports/BudgetReport.hs b/hledger-lib/Hledger/Reports/BudgetReport.hs index 1f2e1e8e186..23605fb6a37 100644 --- a/hledger-lib/Hledger/Reports/BudgetReport.hs +++ b/hledger-lib/Hledger/Reports/BudgetReport.hs @@ -171,7 +171,7 @@ budgetRollUp budgetedaccts showunbudgeted j = j { jtxns = remapTxn <$> jtxns j } remapTxn = mapPostings (map remapPosting) where mapPostings f t = txnTieKnot $ t { tpostings = f $ tpostings t } - remapPosting p = p { paccount = remapAccount $ paccount p, porigin = Just . fromMaybe p $ porigin p } + remapPosting p = p { paccount = remapAccount $ paccount p, poriginal = Just . fromMaybe p $ poriginal p } where remapAccount a | hasbudget = a diff --git a/hledger-web/Hledger/Web/Json.hs b/hledger-web/Hledger/Web/Json.hs index 8e6237eeea4..18d68e715fa 100644 --- a/hledger-web/Hledger/Web/Json.hs +++ b/hledger-web/Hledger/Web/Json.hs @@ -69,7 +69,7 @@ instance ToJSON Posting where -- in a dummy field. When re-parsed, there will be no parent. ,"ptransaction_" .= toJSON (maybe "" (show.tindex) ptransaction) -- This is probably not wanted in json, we discard it. - ,"porigin" .= toJSON (Nothing :: Maybe Posting) + ,"poriginal" .= toJSON (Nothing :: Maybe Posting) ] instance ToJSON Transaction instance ToJSON Account where diff --git a/hledger/Hledger/Cli/Utils.hs b/hledger/Hledger/Cli/Utils.hs index 1039ec3c7b6..5ed96c7bca9 100644 --- a/hledger/Hledger/Cli/Utils.hs +++ b/hledger/Hledger/Cli/Utils.hs @@ -106,7 +106,7 @@ anonymise j pAnons p = p { paccount = T.intercalate (T.pack ":") . map anon . T.splitOn (T.pack ":") . paccount $ p , pcomment = T.empty , ptransaction = fmap tAnons . ptransaction $ p - , porigin = pAnons <$> porigin p + , poriginal = pAnons <$> poriginal p } tAnons txn = txn { tpostings = map pAnons . tpostings $ txn , tdescription = anon . tdescription $ txn