diff options
| -rw-r--r-- | docs/INVOICING.md | 3 | ||||
| -rw-r--r-- | docs/STATE.md | 10 | ||||
| -rw-r--r-- | src/commands.c | 8 |
3 files changed, 19 insertions, 2 deletions
diff --git a/docs/INVOICING.md b/docs/INVOICING.md index f509997..7c6ce2e 100644 --- a/docs/INVOICING.md +++ b/docs/INVOICING.md @@ -149,7 +149,8 @@ form (draft in the TUI) - Default bank/receivable account `1510` (setting `invoice_receivable_account`). - Revenue account per line, default from setting `invoice_revenue_account` - (`3001`), overridable per row. + (`3001`), overridable per row. The seller's payment reference comes from + setting `invoice_bankgiro` (e.g. `5750-4144`). - VAT per row via `vat_code`: `25`, `12`, `6`, `0`, `rc` (omvänd skattskyldighet, no VAT on the invoice, `Momsfritt` in the summary) and `eu` (EU sale, `Momsfritt`). diff --git a/docs/STATE.md b/docs/STATE.md index 428bb79..8c6eaa3 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -148,6 +148,16 @@ check. real PDF without consuming the number, and SMTP sending with the password encrypted in the DB (AES-256-GCM, `BOKFD_SECRET_KEY`). Implementation waves: schema v9 + PDF, SMTP, TUI (Fakturering). + **Wave 1 done 2026-09-20**: schema v9 (`customers`, `invoice_sequence`, + `invoices`, `invoice_rows`, widened `vouchers.source` with a table + rebuild), the PDF renderer (`src/invoice.c`, 2.2 % raw pixel diff vs the + Google Sheets original — all structure exact; only Arial-vs-Helvetica + glyphs differ), and `customer.*`, `invoice.sequence_get/set`, + `invoice.preview/issue/list/get/pdf`. Issue is atomic: number + PDF + attachment + voucher (D 1510/K 3xxx+26xx, `source:"invoice"`) + links. + Settings `invoice_receivable_account`, `invoice_revenue_account`, + `invoice_bankgiro`. **Open detail: invoice 1 (Andrabygg) carries a Swish + QR image — decide whether the generator should support one.** ## Pending decisions diff --git a/src/commands.c b/src/commands.c index 72a8f70..a587ce3 100644 --- a/src/commands.c +++ b/src/commands.c @@ -2655,7 +2655,7 @@ static yyjson_mut_val *h_settings_set(struct req *r) if (!key || !value) return fail(r, "INVALID_ARGS", "key and value are required"); size_t maxlen; - int digits_only = 0; + int digits_only = 0, bankgiro = 0; if (strcmp(key, "default_series") == 0) maxlen = 8; else if (strcmp(key, "attachment_dir") == 0) @@ -2665,6 +2665,9 @@ static yyjson_mut_val *h_settings_set(struct req *r) strcmp(key, "invoice_revenue_account") == 0) { maxlen = 10; digits_only = 1; + } else if (strcmp(key, "invoice_bankgiro") == 0) { + maxlen = 16; + bankgiro = 1; } else return fail(r, "UNSUPPORTED", "unknown setting"); size_t len = strlen(value); @@ -2674,6 +2677,9 @@ static yyjson_mut_val *h_settings_set(struct req *r) for (const char *p = value; *p; p++) { if (digits_only && (*p < '0' || *p > '9')) return failf(r, "INVALID_ARGS", "%s must be digits only", key); + if (bankgiro && !((*p >= '0' && *p <= '9') || *p == '-')) + return failf(r, "INVALID_ARGS", + "%s must be digits and hyphens", key); if ((unsigned char)*p < 32) return failf(r, "INVALID_ARGS", "%s must not contain control characters", key); |
