diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index f3edc6716..9b6840867 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -358,14 +358,14 @@ transactionsPostings = concatMap tpostings data BalancingOpts = BalancingOpts { ignore_assertions_ :: Bool -- ^ Ignore balance assertions - , infer_prices_ :: Bool -- ^ Infer prices in unbalanced multicommodity amounts + , infer_transaction_prices_ :: Bool -- ^ Infer prices in unbalanced multicommodity amounts , commodity_styles_ :: Maybe (M.Map CommoditySymbol AmountStyle) -- ^ commodity display styles } deriving (Show) defbalancingopts :: BalancingOpts defbalancingopts = BalancingOpts { ignore_assertions_ = False - , infer_prices_ = True + , infer_transaction_prices_ = True , commodity_styles_ = Nothing } @@ -450,7 +450,7 @@ balanceTransactionHelper :: -> Either String (Transaction, [(AccountName, MixedAmount)]) balanceTransactionHelper bopts t = do (t', inferredamtsandaccts) <- inferBalancingAmount (fromMaybe M.empty $ commodity_styles_ bopts) $ - if infer_prices_ bopts then inferBalancingPrices t else t + if infer_transaction_prices_ bopts then inferBalancingPrices t else t case transactionCheckBalanced bopts t' of [] -> Right (txnTieKnot t', inferredamtsandaccts) errs -> Left $ transactionBalanceError t' errs diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 1caf9c4d9..63129cc08 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -227,7 +227,7 @@ rawOptsToInputOpts day rawopts = ,auto_ = boolopt "auto" rawopts ,balancingopts_ = defbalancingopts{ ignore_assertions_ = boolopt "ignore-assertions" rawopts - , infer_prices_ = not noinferprice + , infer_transaction_prices_ = not noinferprice , commodity_styles_ = Just commodity_styles } ,strict_ = boolopt "strict" rawopts diff --git a/hledger-lib/Hledger/Reports/MultiBalanceReport.hs b/hledger-lib/Hledger/Reports/MultiBalanceReport.hs index 7754840a9..83b412136 100644 --- a/hledger-lib/Hledger/Reports/MultiBalanceReport.hs +++ b/hledger-lib/Hledger/Reports/MultiBalanceReport.hs @@ -103,7 +103,7 @@ type ClippedAccountName = AccountName -- by the bs/cf/is commands. multiBalanceReport :: ReportSpec -> Journal -> MultiBalanceReport multiBalanceReport rspec j = multiBalanceReportWith rspec j (journalPriceOracle infer j) - where infer = infer_value_ $ _rsReportOpts rspec + where infer = infer_prices_ $ _rsReportOpts rspec -- | A helper for multiBalanceReport. This one takes an extra argument, -- a PriceOracle to be used for looking up market prices. Commands which @@ -134,7 +134,7 @@ multiBalanceReportWith rspec' j priceoracle = report compoundBalanceReport :: ReportSpec -> Journal -> [CBCSubreportSpec a] -> CompoundPeriodicReport a MixedAmount compoundBalanceReport rspec j = compoundBalanceReportWith rspec j (journalPriceOracle infer j) - where infer = infer_value_ $ _rsReportOpts rspec + where infer = infer_prices_ $ _rsReportOpts rspec -- | A helper for compoundBalanceReport, similar to multiBalanceReportWith. compoundBalanceReportWith :: ReportSpec -> Journal -> PriceOracle diff --git a/hledger-lib/Hledger/Reports/ReportOptions.hs b/hledger-lib/Hledger/Reports/ReportOptions.hs index 6ca8f7c43..991bd19cd 100644 --- a/hledger-lib/Hledger/Reports/ReportOptions.hs +++ b/hledger-lib/Hledger/Reports/ReportOptions.hs @@ -116,7 +116,7 @@ data ReportOpts = ReportOpts { ,statuses_ :: [Status] -- ^ Zero, one, or two statuses to be matched ,cost_ :: Costing -- ^ Should we convert amounts to cost, when present? ,value_ :: Maybe ValuationType -- ^ What value should amounts be converted to ? - ,infer_value_ :: Bool -- ^ Infer market prices from transactions ? + ,infer_prices_ :: Bool -- ^ Infer market prices from transactions ? ,depth_ :: Maybe Int ,date2_ :: Bool ,empty_ :: Bool @@ -171,7 +171,7 @@ defreportopts = ReportOpts , statuses_ = [] , cost_ = NoCost , value_ = Nothing - , infer_value_ = False + , infer_prices_ = False , depth_ = Nothing , date2_ = False , empty_ = False @@ -223,7 +223,7 @@ rawOptsToReportOpts d rawopts = ,statuses_ = statusesFromRawOpts rawopts ,cost_ = costing ,value_ = valuation - ,infer_value_ = boolopt "infer-market-prices" rawopts + ,infer_prices_ = boolopt "infer-market-prices" rawopts ,depth_ = maybeposintopt "depth" rawopts ,date2_ = boolopt "date2" rawopts ,empty_ = boolopt "empty" rawopts @@ -494,7 +494,7 @@ flat_ = not . tree_ journalApplyValuationFromOpts :: ReportSpec -> Journal -> Journal journalApplyValuationFromOpts rspec j = journalApplyValuationFromOptsWith rspec j priceoracle - where priceoracle = journalPriceOracle (infer_value_ $ _rsReportOpts rspec) j + where priceoracle = journalPriceOracle (infer_prices_ $ _rsReportOpts rspec) j -- | Like journalApplyValuationFromOpts, but takes PriceOracle as an argument. journalApplyValuationFromOptsWith :: ReportSpec -> Journal -> PriceOracle -> Journal diff --git a/hledger-ui/Hledger/UI/TransactionScreen.hs b/hledger-ui/Hledger/UI/TransactionScreen.hs index 2062ab3a6..3370d19c9 100644 --- a/hledger-ui/Hledger/UI/TransactionScreen.hs +++ b/hledger-ui/Hledger/UI/TransactionScreen.hs @@ -77,7 +77,7 @@ tsDraw UIState{aopts=UIOpts{uoCliOpts=copts@CliOpts{reportspec_=rspec@ReportSpec t = transactionMapPostingAmounts mixedAmountSetFullPrecision t' maincontent = Widget Greedy Greedy $ do let - prices = journalPriceOracle (infer_value_ ropts) j + prices = journalPriceOracle (infer_prices_ ropts) j styles = journalCommodityStyles j periodlast = fromMaybe (error' "TransactionScreen: expected a non-empty journal") $ -- PARTIAL: shouldn't happen diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index 69097af52..32798a3f0 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -189,6 +189,7 @@ reportflags = [ -- 2021-02, --infer-market-price added, --infer-value deprecated -- 2021-09, --infer-value hidden -- --infer-market-price renamed to --infer-market-prices, old spelling still works + -- ReportOptions{infer_value_} renamed to infer_prices_ (and BalancingOpts{infer_prices_} renamed to infer_transaction_prices_) ,flagNone ["infer-market-prices"] (setboolopt "infer-market-prices") "use transaction prices (recorded with @ or @@) as additional market prices, as if they were P directives" diff --git a/hledger/Hledger/Cli/Commands/Roi.hs b/hledger/Hledger/Cli/Commands/Roi.hs index 9965489b7..4615bee8b 100644 --- a/hledger/Hledger/Cli/Commands/Roi.hs +++ b/hledger/Hledger/Cli/Commands/Roi.hs @@ -62,7 +62,7 @@ roi CliOpts{rawopts_=rawopts, reportspec_=rspec@ReportSpec{_rsReportOpts=ReportO -- We may be converting posting amounts to value, per hledger_options.m4.md "Effect of --value on reports". let today = _rsDay rspec - priceOracle = journalPriceOracle infer_value_ j + priceOracle = journalPriceOracle infer_prices_ j styles = journalCommodityStyles j mixedAmountValue periodlast date = maybe id (mixedAmountApplyValuation priceOracle styles periodlast today date) value_