lib: fix accidental switch of income:unknown and expence:unknown in csv parser
This commit is contained in:
parent
77fa81ea4d
commit
f74df08e98
@ -806,7 +806,7 @@ transactionFromCsvRecord sourcepos rules record = t
|
|||||||
postings3to9 = catMaybes $ [ parsePosting i | x<-[3..9], let i = show x]
|
postings3to9 = catMaybes $ [ parsePosting i | x<-[3..9], let i = show x]
|
||||||
postings =
|
postings =
|
||||||
if postings3to9 == []
|
if postings3to9 == []
|
||||||
then [fromMaybe justOnePostingError $ parsePosting' "2" "account2" (Just $ pamount posting1) "amount2" "amount2-in" "amount2-out" "balance2" "comment2"]
|
then [fromMaybe justOnePostingError $ parsePosting' "2" "account2" (Just $ negate $ pamount posting1) "amount2" "amount2-in" "amount2-out" "balance2" "comment2"]
|
||||||
else case parsePosting "2" of
|
else case parsePosting "2" of
|
||||||
Just posting2 -> posting2:postings3to9
|
Just posting2 -> posting2:postings3to9
|
||||||
Nothing -> postings3to9
|
Nothing -> postings3to9
|
||||||
|
|||||||
@ -9,8 +9,8 @@ account1 assets:myacct
|
|||||||
|
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $50
|
assets:myacct $50
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ currency $
|
|||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co🎅
|
2009/09/10 Flubber Co🎅
|
||||||
Assets:MyAccount $50
|
Assets:MyAccount $50
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
2009/09/11 Flubber Co🎅
|
2009/09/11 Flubber Co🎅
|
||||||
Assets:MyAccount $-50
|
Assets:MyAccount $-50
|
||||||
income:unknown
|
expense:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ account1 assets:myacct
|
|||||||
|
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $50 = $123
|
assets:myacct $50 = $123
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -87,12 +87,12 @@ account1 assets:myacct
|
|||||||
|
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $50 = $123
|
assets:myacct $50 = $123
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
2009/09/11 Blubber Co
|
2009/09/11 Blubber Co
|
||||||
assets:myacct $60
|
assets:myacct $60
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -109,12 +109,12 @@ account1 assets:myacct
|
|||||||
|
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $50 = $123
|
assets:myacct $50 = $123
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
2009/09/11 Blubber Co
|
2009/09/11 Blubber Co
|
||||||
assets:myacct $60
|
assets:myacct $60
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -161,11 +161,11 @@ currency $
|
|||||||
$ ./hledger-csv --separator ';'
|
$ ./hledger-csv --separator ';'
|
||||||
2009/09/10 Flubber Co🎅
|
2009/09/10 Flubber Co🎅
|
||||||
Assets:MyAccount $50
|
Assets:MyAccount $50
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
2009/09/11 Flubber Co🎅
|
2009/09/11 Flubber Co🎅
|
||||||
Assets:MyAccount $-50
|
Assets:MyAccount $-50
|
||||||
income:unknown
|
expense:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -181,8 +181,8 @@ account1 assets:myacct
|
|||||||
|
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $50
|
assets:myacct $50
|
||||||
expense:unknown = $123
|
income:unknown = $123
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -198,8 +198,8 @@ account1 assets:myacct
|
|||||||
|
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $50 = $321
|
assets:myacct $50 = $321
|
||||||
expense:unknown = $123
|
income:unknown = $123
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -258,11 +258,11 @@ currency $
|
|||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co🎅
|
2009/09/10 Flubber Co🎅
|
||||||
Assets:MyAccount $50
|
Assets:MyAccount $50
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
2009/09/11 Flubber Co🎅
|
2009/09/11 Flubber Co🎅
|
||||||
Assets:MyAccount $-50
|
Assets:MyAccount $-50
|
||||||
income:unknown
|
expense:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -287,8 +287,8 @@ currency $
|
|||||||
account1 assets:myacct
|
account1 assets:myacct
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co Co Co
|
2009/09/10 Flubber Co Co Co
|
||||||
assets:myacct $50
|
assets:myacct $50
|
||||||
expense:unknown
|
income:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
@ -306,14 +306,14 @@ if Flubber
|
|||||||
amount-in (%amount-in)
|
amount-in (%amount-in)
|
||||||
$ ./hledger-csv
|
$ ./hledger-csv
|
||||||
2009/09/10 Flubber Co
|
2009/09/10 Flubber Co
|
||||||
assets:myacct $-50
|
assets:myacct $-50
|
||||||
income:unknown
|
expense:unknown
|
||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
# 16. Real life-ish paypal parsing example
|
# 16. Real life-ish paypal parsing example
|
||||||
<
|
<
|
||||||
"12/22/2018","06:22:50","PST","Someone","Subscription Payment","Completed","USD","10.00","-0.59","9.41","someone@some.where","simon@joyful.com","123456789","Joyful Systems","","9KCXZZZZZXXAX","","57.60",""
|
"12/22/2018","06:22:50","PST","Someone","Subscription Payment","Completed","USD","10.00","-0.59","9.41","someone@some.where","simon@joyful.com","123456789","Joyful Systems","","9KCXINCOME:UNKNOWNZXXAX","","57.60",""
|
||||||
|
|
||||||
RULES
|
RULES
|
||||||
fields date, time, timezone, description, type, status_, currency, grossamount, feeamount, netamount, fromemail, toemail, code, itemtitle, itemid, referencetxnid, receiptid, balance, note
|
fields date, time, timezone, description, type, status_, currency, grossamount, feeamount, netamount, fromemail, toemail, code, itemtitle, itemid, referencetxnid, receiptid, balance, note
|
||||||
@ -336,6 +336,20 @@ $ ./hledger-csv
|
|||||||
|
|
||||||
>=0
|
>=0
|
||||||
|
|
||||||
|
# 18. Show that #415 is fixed
|
||||||
|
<
|
||||||
|
"2016/01/01","$1"
|
||||||
|
"2016/02/02","$1,000.00"
|
||||||
|
RULES
|
||||||
|
account1 unknown
|
||||||
|
amount %2
|
||||||
|
date %1
|
||||||
|
date-format %Y/%m/%d
|
||||||
|
$ ./hledger-csv | hledger balance -f - --no-total
|
||||||
|
$-1,001.00 income:unknown
|
||||||
|
$1,001.00 unknown
|
||||||
|
>=0
|
||||||
|
|
||||||
# . TODO: without --separator gives obscure error
|
# . TODO: without --separator gives obscure error
|
||||||
# |
|
# |
|
||||||
# 1 | 10/2009/09;Flubber Co🎅;50;
|
# 1 | 10/2009/09;Flubber Co🎅;50;
|
||||||
@ -355,7 +369,7 @@ $ ./hledger-csv
|
|||||||
# $ ./hledger-csv
|
# $ ./hledger-csv
|
||||||
# 2009/09/10 Flubber Co🎅
|
# 2009/09/10 Flubber Co🎅
|
||||||
# Assets:MyAccount $50
|
# Assets:MyAccount $50
|
||||||
# income:unknown $-50
|
# expense:unknown $-50
|
||||||
#
|
#
|
||||||
# 2009/09/11 Flubber Co🎅
|
# 2009/09/11 Flubber Co🎅
|
||||||
# Assets:MyAccount $-50
|
# Assets:MyAccount $-50
|
||||||
@ -378,7 +392,7 @@ $ ./hledger-csv
|
|||||||
# $ ./hledger-csv
|
# $ ./hledger-csv
|
||||||
# 2009/09/10 Flubber Co🎅
|
# 2009/09/10 Flubber Co🎅
|
||||||
# Assets:MyAccount $50
|
# Assets:MyAccount $50
|
||||||
# income:unknown $-50
|
# expense:unknown $-50
|
||||||
#
|
#
|
||||||
# 2009/09/11 Flubber Co🎅
|
# 2009/09/11 Flubber Co🎅
|
||||||
# Assets:MyAccount $-50
|
# Assets:MyAccount $-50
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user