lib: amount1 is no longer magical

This commit is contained in:
Dmitry Astapov 2019-10-16 23:49:28 +01:00
parent 490d2407f4
commit 637741a755

View File

@ -465,22 +465,8 @@ parseCsvRules rulesfile s =
validateRules :: CsvRules -> Either String CsvRules
validateRules rules = do
unless (isAssigned "date") $ Left "Please specify (at top level) the date field. Eg: date %1\n"
unless ((amount && not (amountin || amountout)) ||
(not amount && (amountin && amountout)) ||
balance)
$ Left $ unlines [
"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" || 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