- printf '
- [form .ibanassign action="%s/ledgers/iban_assign.sh" method=POST
- [input type=hidden name=session_id value="%s"]
- [h3 . %s]
- ' "${_BASE}" "$SESSION_ID" "$(l10n "IBAN Assignments")"
- printf '[datalist id=lattendants .'
- pdi_load "${_DATA}"/vcard/*.vcf |sed -n '/^FN\;:/!b; s;^FN\;:;;; p;' \
- | while read name; do
- printf '[option value="%s"]' "$(HTML "$name")"
- done
- printf ']'
- l10n_attendant="$(l10n attendant)"
- { pdi_load "${_DATA}"/vcard/*.vcf
- printf 'BEGIN:LEDGERS\n'
- cat "${_DATA}"/ledgers/????-??-??\ -\ ????-??-??\ -\ ????.tbl
- } | "${_EXEC}"/ledgers/iban_assign.awk \
- | while read -r state iban data; do
- iban="$(UNSTRING "$iban")"
- [ ! "$iban" ] && iban="??????????"
- printf '[input type=checkbox id="use_%s" name="use_%s" value=true]' "$iban" "$iban"
- printf '[fieldset .iban .%s [legend . %s ]' \
- "$state" "$iban"
- if [ $state = sure ]; then
- for card in $data; do
- uid="${card%%/*}" name="$(UNSTRING "${card#*/}")"
- printf '[span .card . %s]' "$(HTML "${name}")"
- done
- :
- elif [ $state = guess ]; then
- record="$(UNSTRING "${data%% *}")"
- cards="${data#* }"
- date="${record%% *}"
- principal="${record#* * * }" principal="${principal%% *}"
- subject="${record#* * * * }" subject="${subject%% *}"
- amount="${record#* * * * * }" amount="${amount%% *}"
- printf '[p .principal . %s][p .date %s][p .amount %s][p .subject . %s]' \
- "$(UNSTRING "$principal" |HTML)" "$date" "$(credit "$amount")" "$(UNSTRING "$subject" |HTML)"
- n=0; for card in $cards; do
- n=$((n+1)); uid="${card%%/*}" name="$(UNSTRING "${card#*/}")"
- cat <<-EOF
- [input type=checkbox id="check_${iban}_$n" name="check_${iban}_$n" value=true checked=checked]
- [input .card name="fn_${iban}_$n" value="$(HTML "$name")" .disabled tabindex="-1"]
- [label .del for="check_${iban}_$n" . -]
+ unassigned="$(printf %s\\n "$IBAN_ASSIGN" |grep -E '^guess|^unknown' |wc -l)"
+ cat <<-EOF
+ [div
+ [h1 . $(l10n IBAN Assignments)]
+ $(printf "$(l10n "%i IBANs are unassigned")" "$unassigned")
+ [a href="${_BASE}/ledgers/iban_assign/" . $(l10n Assign IBANs)]
+ ]
+ [form action="${_BASE}/ledgers/account.sh" method=POST
+ [select name=uid
+ $(printf %s\\n "$IBAN_ASSIGN" \
+ | sed -E '
+ /^sure /!d;
+ s;^sure [^\t]+;;;
+ s;([^\t]+)/([^\t]+);\1 \2\n;g;
+ s;\n$;;
+ ' \
+ | while read uid fn; do
+ uid="$(HTML "$uid")"
+ fn="$(UNSTRING "$fn" |HTML)"
+ printf '[option value="%s" . %s]' "$uid" "$fn"
+ done)
+ ]
+ [button type="submit" . $(l10n Account)]
+ ]