Skip to content

Commit 0bc16d4

Browse files
committed
lib, cli, web: rename porigin -> poriginal
1 parent 2dc716c commit 0bc16d4

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

hledger-lib/Hledger/Data/Journal.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ addOrAssignAmountAndCheckAssertionB p@Posting{paccount=acc, pamount=amt, pbalanc
745745
newbal = oldbalothercommodities + assignedbalthiscommodity
746746
diff <- setAmountB acc newbal
747747
return (diff,newbal)
748-
let p' = p{pamount=diff, porigin=Just $ originalPosting p}
748+
let p' = p{pamount=diff, poriginal=Just $ originalPosting p}
749749
whenM (R.reader bsAssrt) $ checkBalanceAssertionB p' newbal
750750
return p'
751751

@@ -1050,7 +1050,7 @@ transactionPivot fieldortagname t = t{tpostings = map (postingPivot fieldortagna
10501050
-- | Replace this posting's account name with the value
10511051
-- of the given field or tag, if any, otherwise the empty string.
10521052
postingPivot :: Text -> Posting -> Posting
1053-
postingPivot fieldortagname p = p{paccount = pivotedacct, porigin = Just $ originalPosting p}
1053+
postingPivot fieldortagname p = p{paccount = pivotedacct, poriginal = Just $ originalPosting p}
10541054
where
10551055
pivotedacct
10561056
| Just t <- ptransaction p, fieldortagname == "code" = tcode t

hledger-lib/Hledger/Data/Posting.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ nullposting = Posting
9191
,ptags=[]
9292
,pbalanceassertion=Nothing
9393
,ptransaction=Nothing
94-
,porigin=Nothing
94+
,poriginal=Nothing
9595
}
9696
posting = nullposting
9797

@@ -112,7 +112,7 @@ assertion = nullassertion
112112

113113
-- Get the original posting, if any.
114114
originalPosting :: Posting -> Posting
115-
originalPosting p = fromMaybe p $ porigin p
115+
originalPosting p = fromMaybe p $ poriginal p
116116

117117
-- XXX once rendered user output, but just for debugging now; clean up
118118
showPosting :: Posting -> String

hledger-lib/Hledger/Data/Transaction.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ inferBalancingAmount styles t@Transaction{tpostings=ps}
416416
in
417417
case minferredamt of
418418
Nothing -> (p, Nothing)
419-
Just a -> (p{pamount=a', porigin=Just $ originalPosting p}, Just a')
419+
Just a -> (p{pamount=a', poriginal=Just $ originalPosting p}, Just a')
420420
where
421421
-- Inferred amounts are converted to cost.
422422
-- Also ensure the new amount has the standard style for its commodity
@@ -483,7 +483,7 @@ priceInferrerFor t pt = inferprice
483483

484484
inferprice p@Posting{pamount=Mixed [a]}
485485
| caninferprices && ptype p == pt && acommodity a == fromcommodity
486-
= p{pamount=Mixed [a{aprice=conversionprice}], porigin=Just $ originalPosting p}
486+
= p{pamount=Mixed [a{aprice=conversionprice}], poriginal=Just $ originalPosting p}
487487
where
488488
fromcommodity = head $ filter (`elem` sumcommodities) pcommodities -- these heads are ugly but should be safe
489489
conversionprice

hledger-lib/Hledger/Data/Types.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ data Posting = Posting {
297297
-- in a single commodity, excluding subaccounts.
298298
ptransaction :: Maybe Transaction, -- ^ this posting's parent transaction (co-recursive types).
299299
-- Tying this knot gets tedious, Maybe makes it easier/optional.
300-
porigin :: Maybe Posting -- ^ When this posting has been transformed in some way
300+
poriginal :: Maybe Posting -- ^ When this posting has been transformed in some way
301301
-- (eg its amount or price was inferred, or the account name was
302302
-- changed by a pivot or budget report), this references the original
303303
-- untransformed posting (which will have Nothing in this field).
@@ -324,7 +324,7 @@ instance Show Posting where
324324
,"ptags=" ++ show ptags
325325
,"pbalanceassertion=" ++ show pbalanceassertion
326326
,"ptransaction=" ++ show (ptransaction $> "txn")
327-
,"porigin=" ++ show porigin
327+
,"poriginal=" ++ show poriginal
328328
] ++ "}"
329329

330330
-- TODO: needs renaming, or removal if no longer needed. See also TextPosition in Hledger.UI.Editor

hledger-lib/Hledger/Reports/BudgetReport.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ budgetRollUp budgetedaccts showunbudgeted j = j { jtxns = remapTxn <$> jtxns j }
171171
remapTxn = mapPostings (map remapPosting)
172172
where
173173
mapPostings f t = txnTieKnot $ t { tpostings = f $ tpostings t }
174-
remapPosting p = p { paccount = remapAccount $ paccount p, porigin = Just . fromMaybe p $ porigin p }
174+
remapPosting p = p { paccount = remapAccount $ paccount p, poriginal = Just . fromMaybe p $ poriginal p }
175175
where
176176
remapAccount a
177177
| hasbudget = a

hledger-web/Hledger/Web/Json.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ instance ToJSON Posting where
6969
-- in a dummy field. When re-parsed, there will be no parent.
7070
,"ptransaction_" .= toJSON (maybe "" (show.tindex) ptransaction)
7171
-- This is probably not wanted in json, we discard it.
72-
,"porigin" .= toJSON (Nothing :: Maybe Posting)
72+
,"poriginal" .= toJSON (Nothing :: Maybe Posting)
7373
]
7474
instance ToJSON Transaction
7575
instance ToJSON Account where

hledger/Hledger/Cli/Utils.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ anonymise j
106106
pAnons p = p { paccount = T.intercalate (T.pack ":") . map anon . T.splitOn (T.pack ":") . paccount $ p
107107
, pcomment = T.empty
108108
, ptransaction = fmap tAnons . ptransaction $ p
109-
, porigin = pAnons <$> porigin p
109+
, poriginal = pAnons <$> poriginal p
110110
}
111111
tAnons txn = txn { tpostings = map pAnons . tpostings $ txn
112112
, tdescription = anon . tdescription $ txn

0 commit comments

Comments
 (0)