def __init__(self, booking: 'Booking', code: str) -> None:
super().__init__(booking)
self.currency = ''
+ self.amount: Optional[Decimal] = None
if not code[0].isspace():
self.errors += ['transfer line not indented']
toks = code.lstrip().split()
self.account = toks[0]
- self.amount: Optional[Decimal] = None
- if 3 <= len(toks):
- self.currency = toks[2]
+ if len(toks) > 1:
+ self.currency = toks[2] if 3 == len(toks) else '€'
try:
self.amount = Decimal(toks[1])
except DecimalInvalidOperation:
self.errors += [f'improper amount value: {toks[1]}']
- if len(toks) not in {1, 3}:
+ if len(toks) > 3:
self.errors += ['illegal number of tokens']
@property
const dat_line = dat_lines[i];
const tr = document.createElement("tr");
table.appendChild(tr);
- function add_input(name, value, colspan=1) {
+ function add_input(name, value, colspan=1, placeholder='') {
const td = add_td(tr, colspan);
const input = document.createElement("input");
td.appendChild(input);
input.name = `line_${i}_${name}`
input.value = value.trim();
+ input.placeholder = placeholder;
input.onchange = taint;
if (dat_line.error) {
td.classList.add("invalid");
} else if (!dat_line.error) {
add_input('account', dat_line.booking_line.account);
add_input('amount', dat_line.booking_line.amount == 'None' ? '' : dat_line.booking_line.amount);
- add_input('currency', dat_line.booking_line.currency);
+ add_input('currency', dat_line.booking_line.currency, 1, '€');
} else {
add_input('error', dat_line.code, 3)
}