fix(export): paginate the archive size estimate and explain scope counts (#1635)

The period branch of estimateArchiveSize ran a single unpaginated
document read with one flat IN() over every posted entry id in the
year: past the PostgREST row cap it silently undercounts, and past a
few hundred entry ids the URL itself blows up. Chunk the id filter
(CHILD_FK_CHUNK) and paginate every read with fetchAllRows, mirroring
what writeDocuments already did (the ZIP content was never affected).

The dialog now says per scope which documents are counted: full
history includes unlinked inbox/receipt documents, a single year only
those linked to posted vouchers. Without that line, a company with
many unlinked receipts reads the count gap as a pagination bug.

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-17 10:20:18 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5
parent 62c6fc44fe
commit 2eb3441244
6 changed files with 83 additions and 20 deletions
+3
View File
@@ -1422,6 +1422,7 @@
"default_payment_terms_label": "Payment terms (days)",
"default_account_label": "Default account",
"default_account_placeholder": "e.g. 5410",
"default_account_clear": "Clear default account",
"default_currency_label": "Default currency",
"notes_label": "Notes",
"notes_placeholder": "Internal notes about the supplier...",
@@ -7055,6 +7056,8 @@
"archive_scope_label": "Scope",
"archive_scope_all": "Full history",
"archive_scope_period": "Single fiscal year",
"archive_scope_all_note": "All accounting records, including documents not yet linked to any voucher (inbox and unmatched receipts).",
"archive_scope_period_note": "Documents linked to posted vouchers in the selected year. Unlinked documents are only included in Full history.",
"archive_include_docs_label": "Include receipts and supporting documents",
"archive_include_docs_help": "Voucher attachments (receipts, invoices, PDFs) are packed into the ZIP. Turn off for a smaller archive with bookkeeping data only.",
"archive_calculating_size": "Calculating size…",
+3
View File
@@ -1422,6 +1422,7 @@
"default_payment_terms_label": "Betalningsvillkor (dagar)",
"default_account_label": "Standardkonto",
"default_account_placeholder": "T.ex. 5410",
"default_account_clear": "Rensa standardkonto",
"default_currency_label": "Standardvaluta",
"notes_label": "Anteckningar",
"notes_placeholder": "Interna anteckningar om leverantören...",
@@ -7055,6 +7056,8 @@
"archive_scope_label": "Omfattning",
"archive_scope_all": "Hela historiken",
"archive_scope_period": "Ett räkenskapsår",
"archive_scope_all_note": "Allt räkenskapsmaterial, även underlag som ännu inte är kopplade till något verifikat (inkorg och okopplade kvitton).",
"archive_scope_period_note": "Underlag kopplade till bokförda verifikat i det valda året. Okopplade underlag ingår bara i Hela historiken.",
"archive_include_docs_label": "Inkludera kvitton och underlag",
"archive_include_docs_help": "Bilagor till verifikationer (kvitton, fakturor, PDF:er) packas med i ZIP:en. Stäng av för ett mindre arkiv med bara bokföringsdata.",
"archive_calculating_size": "Beräknar storlek…",