From b2ba1086b6b970588da312a8a56a17b4dc53aaa5 Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Mon, 14 Oct 2019 21:41:25 +0100 Subject: [PATCH] lib: fixed validation rules for minimul viable csv rules to include account1 etc --- hledger-lib/Hledger/Read/CsvReader.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hledger-lib/Hledger/Read/CsvReader.hs b/hledger-lib/Hledger/Read/CsvReader.hs index fccfbd8f7..f8c620df7 100644 --- a/hledger-lib/Hledger/Read/CsvReader.hs +++ b/hledger-lib/Hledger/Read/CsvReader.hs @@ -468,16 +468,18 @@ validateRules rules = do (not amount && (amountin && amountout)) || balance) $ Left $ unlines [ - "Please specify (as a top level CSV rule) either the amount field," - ,"both the amount-in and amount-out fields, or the balance field. Eg:" - ,"amount %2\n" + "Please specify (as a top level CSV rule) either the amount1 field," + ,"both the amount1-in and amount1-out fields, or the balance1 field. Eg:" + ,"amount1 %2\n" + ,"You can also use amount, or both amount-in and amount-out, or balance," + ,"though this syntax is considered legacy." ] Right rules where - amount = isAssigned "amount" - amountin = isAssigned "amount-in" - amountout = isAssigned "amount-out" - balance = isAssigned "balance" || isAssigned "balance1" || isAssigned "balance2" + amount = isAssigned "amount" || isAssigned "amount1" + amountin = isAssigned "amount-in" || isAssigned "amount1-in" + amountout = isAssigned "amount-out" || isAssigned "amount1-out" + balance = isAssigned "balance" || isAssigned "balance1" isAssigned f = isJust $ getEffectiveAssignment rules [] f -- parsers