fix(validator): make pdf_abgleich compare XML values with the PDF text

The check only recognized the English patterns "Invoice" and "Total:",
so it compared nothing on German invoices and always passed. It now
reports every key XML value (invoice number, net, VAT and gross total)
that does not appear in the PDF text, tolerant of number notation and
of columns running together in extracted text. Mismatches stay warnings.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 18:33:19 +01:00
co-authored by Claude Fable 5.2
parent fa9eaa4f82
commit 34490db0ad
3 changed files with 170 additions and 41 deletions
+1 -1
View File
@@ -299,7 +299,7 @@
"items": {
"type": "string",
"enum": ["pflichtfelder", "betraege", "ustid", "pdf_abgleich"],
"description": "Validation check type. Choose one or more:\n- pflichtfelder: Validates all required fields are present and non-empty (invoice_number, invoice_date, supplier.name, supplier.vat_id, buyer.name, totals fields, line_items)\n- betraege: Validates all monetary calculations are correct (line totals, VAT breakdown, totals)\n- ustid: Validates VAT ID format for DE, AT, CH\n- pdf_abgleich: Compares XML data against PDF text (requires pdf_text)"
"description": "Validation check type. Choose one or more:\n- pflichtfelder: Validates all required fields are present and non-empty (invoice_number, invoice_date, supplier.name, supplier.vat_id, buyer.name, totals fields, line_items)\n- betraege: Validates all monetary calculations are correct (line totals, VAT breakdown, totals)\n- ustid: Validates VAT ID format for DE, AT, CH\n- pdf_abgleich: Checks that invoice number and the net, VAT and gross totals of xml_data appear in the PDF text (requires pdf_text; mismatches are warnings)"
}
}
},