Skip to content

Commit e2a7832

Browse files
committed
[FIX] fix 04 regex and add acount_nb on statement
1 parent 6b83706 commit e2a7832

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

cfonb/parser/common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,17 @@ class ParserContent04(Parser):
133133
('desk_code', G_N % 5 ),
134134
('currency_code', G_A_ % 3 ),
135135
('nb_of_dec', G_N_ % 1 ),
136-
('_1', G_AN_ % 1 ),
136+
('_1', G_ALL % 1 ),
137137
('account_nb', G_AN % 11),
138138
('operation_code', G_AN % 2 ),
139139
('operation_date', G_N % 6 ),
140140
('reject_code', G_N_ % 2 ),
141141
('value_date', G_N % 6 ),
142142
('label', G_ALL % 31),
143-
('_2', G_AN_ % 2 ),
144-
('reference', G_AN % 7 ),
145-
('exempt_code', G_AN_ % 1 ),
146-
('_3', G_AN_ % 1 ),
143+
('_2', G_ALL % 2 ),
144+
('reference', G_ALL % 7 ),
145+
('exempt_code', G_ALL % 1 ),
146+
('_3', G_ALL % 1 ),
147147
('amount', G_AMT ),
148148
('_4:', G_ALL % 16),
149149
]

cfonb/parser/statement.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def parse(self, file_obj):
3030
statement = Statement()
3131
result[row.account_nb] = statement
3232
statement.header = row
33+
statement.account_nb = row.account_nb
3334

3435
elif line[0:2] == '04':
3536
row = Row(line)
@@ -52,7 +53,7 @@ def parse(self, file_obj):
5253
else:
5354
raise ParsingError('line %s is invalid: "%s"' % (index, line))
5455

55-
56+
print result
5657

5758
return [result[key] for key in result]
5859

@@ -62,5 +63,6 @@ def __init__(self):
6263
self.header = None
6364
self.footer = None
6465
self.lines = list()
66+
self.account_nb = None
6567

6668

0 commit comments

Comments
 (0)