Skip to content

Import: keep the member number of Handkassa lines - #98

Merged
PeterTheOne merged 2 commits into
masterfrom
fix/handkassa-member-number
Nov 14, 2026
Merged

PeterTheOne merged 2 commits into
masterfrom
fix/handkassa-member-number

Conversation

@PeterTheOne

Copy link
Copy Markdown
Member

Problem

import.php reads the Mitgliedsnummer column of the Handkassa format ($data[9]), but before the member matching the member number was reset to 0 for every format, so it was always lost.

Change

  • Handkassa: the column is accepted only if it is digits only, one to nine digits and greater than 0 (preg_match('/^\d{1,9}$/D') + intval); anything else (empty, +9004, ten digits, 0, text) counts as no number, as before.
  • The reset to 0 now applies to the other formats only. A line with a number gets member = true and type 1 (same as a successful name match; a negative amount still becomes type 28) and is not matched by name or by a member name in the line, so the given number wins. Lines without a number: name matching unchanged.
  • Behaviour to note for review: a numbered line becomes type 1 even if its name matches no member (before: type 8). The number is not checked against the member list.
  • person_type is not stored by the import INSERT, so it is untouched.
  • Reference recording: import-latin9-handkassa.sql loses the name lookup for the fixture's numbered line (Testa Mitglied;9031); its INSERT is identical.
  • CHANGELOG: Unreleased / Fixed.

Tests

  • Red first: new block in tests/http-import.php with synthetic Handkassa lines (number + non-member name; zero-padded number + empty name with another member's name in the text; ten digits; signed; 0). Before the fix the first line was stored as member f, number 0, type 8. Green after; ImportMemberMatchTest, ReceiptImportTest pass.
  • Mutation (local, --only): six new mutants in tests/mutation/targets/import-checks.php: 6/6 killed.
  • Local lane with PGACC_COVERAGE_BASE=origin/master: import.php: 6 changed executable lines, all covered. That run also had an http-receipts.php failure ("revision in a deadlock returned HTTP 302"), which pulled the file.php and import2.php coverage floors down. The test doesn't touch this change; CI reruns it.

🤖 Generated with Claude Code

PeterTheOne and others added 2 commits November 14, 2026 23:40
import.php read the "Mitgliedsnummer" column of the Handkassa format but
reset the member number to 0 for every format before the member
matching, so the number was always lost. A Handkassa number of one to
nine digits greater than 0 is now kept: the line is that member's fee
(member true, type 1, as for a name match) and is not matched by name or
by a member name in the line. Other values (empty, signed, longer, 0,
text) count as no number and the name matching runs as before. Other
formats are unchanged.

The reference recording loses the name lookup for the fixture's numbered
Handkassa line; its INSERT is unchanged. Red test in tests/http-import.php,
six mutants in the import-checks target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve CHANGELOG.md Unreleased conflict, keeping both entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PeterTheOne
PeterTheOne merged commit 5ac9e3f into master Nov 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant