* fix(settings): validate share-capital pair before saving (#1137)
Entering aktiekapital without antal aktier (or vice versa) died on the DB
pair constraint company_settings_share_capital_pair as a raw 500 with the
generic 'Vardet uppfyller inte de tillatna kraven' toast. The pair rule
(ARL 5 kap 14 $: the aktiekapital note needs both values) now surfaces as
a clear 400 in the PUT route, checked against effective body-or-stored
values so partial API updates are covered too. The form additionally marks
each field required when its sibling is filled, so the browser blocks a
one-sided submit before the request is sent.
Fixes#1137
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: decision-log entry for share-capital pair validation placement
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs(settings): correct the share-capital note citation to ÅRL 5 kap 34 §
5 kap 14 § is ställda säkerheter; the antal aktier/kvotvärde note is 5 kap 34 §
(flagged by the Swedish compliance review bot, verified against the
swedish-financial-reporting skill).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(settings): assert the pair message on the one-sided-clear rejection
CodeRabbit review on #1160. Its second suggestion (assert the update
payload on the partial-update test) is skipped: createQueuedMockSupabase
proxies away builder args, so payloads are not recordable, same as every
other test in this suite.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
- invoice/article posting-account overrides accept active class 1-3 accounts;
class 1-2 (balance-sheet) accounts are rejected on VAT-bearing lines so the
ruta 05 tax base always books to a 3xxx account
- shared posting-account regex across server schemas, pending-operation
re-validation, and client forms
- share-capital settings (aktiekapital/antal_aktier) feed the annual-report
note; kvotvarde derived per ABL 1 kap 6 $; all-or-nothing pair constraint
- signed per-rate VAT breakdown on credit-note PDFs; U+2212 to ASCII hyphen
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(arsredovisning): make the aktiekapital note completable via company settings
The annual report warned every AB that the aktiekapital note was missing
and pointed at Installningar -> Foretag, but the referenced columns
(aktiekapital, antal_aktier, kvotvarde) never existed and no settings UI
was ever built, so the warning was a dead end and no AB could produce a
complete note before Bolagsverket filing.
- migration 20260723103000: company_settings.aktiekapital (numeric) and
antal_aktier (integer) with positive CHECKs; kvotvarde is intentionally
not stored since ABL 1 kap 6 defines it as aktiekapital / antal aktier
- build-data.ts (K2 and K3 note paths): select only the two stored
columns and derive kvotvarde with roundOre
- UpdateSettingsSchema: aktiekapital (positive), antal_aktier (positive
integer), both nullable to allow clearing
- new ShareCapitalForm section on Installningar -> Foretag, rendered for
aktiebolag only, with live derived kvotvarde display; wired through the
existing CompanySettingsContent save path (empty string clears to null)
- sv/en strings; settings route tests (round-trip, clear, 400 on invalid);
builder tests for derived kvotvarde and the empty-settings warning
Staging (metjnjrhvujscngnpzdv) already has the columns applied and the
note verified end-to-end against a rehearsal company.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(arsredovisning): address PR review findings on the share-capital note
- enforce aktiekapital/antal_aktier as an all-or-nothing pair (DB CHECK,
K2/K3 note guard now requires both, partial pair warns instead)
- numeric(15,2) column, .int() Zod constraint, maxFractionDigits 0 render
- guard numberOrNull against NaN; align kvotvarde preview with schema
- strengthen clearing test, add fractional and partial-pair tests
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>