diff --git a/DECISIONS.md b/DECISIONS.md index 8e31ad8b..f746f4c6 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -1287,3 +1287,4 @@ One line per decision: `[YYYY-MM-DD] : `. Appended by agents and [2026-08-26] Dashboard layout diet (responsiveness plan B4): the four nav-visibility probes (WooCommerce/Shopify connections, webshop orders, mileage trips) became one SECURITY INVOKER RPC get_dashboard_nav_flags (20260826120000) rather than a client-side badge hook, because the flags gate whole nav rows and loading them after mount pops rows into the sidebar; RLS still applies inside the function. The layout's getDashboardAuthContext now verifies the JWT locally (lib/auth/claims.ts, shared with requireAuth) with getUser() as the fallback: the proxy already did the per-request revocation check, so the layout's own getUser() was a second Supabase Auth round trip on every hard load. The user-keyed reads (profile, preferences, memberships) moved into the company-resolution wave and the memberships join now supplies the active company row and role, so the layout went from ~20 network calls in 4 waves to ~12 in 2. The memberships-with-embedded-settings single query was NOT attempted: the PostgREST embed shape was unverified and the settings-names query is parallel anyway. [2026-08-26] OAuth consent pre-checks ALL scopes (one-click, list collapsed in details): founder call after the read-only default dead-ended agent flows; defensible because every write is staged for approval, rows stay untickable, grant revocable. [2026-08-26] accounting_method optional with form default (AB=accrual, EF=cash) in CompanySetupSchema/planCompanySetup: founder call to cut agent onboarding input to orgnr + moms period; the default is flagged (accounting_method_defaulted) and must be read back in the preview, never silent. +[2026-08-26] Removed the 1580 entry from ACCOUNT_DESCRIPTIONS and flipped AccountNumber name precedence to DB-name-first: the entry falsely labeled 1580 'Fordran for skatt' (tax receivables are 1640/1650; 1580 was traditionally card/coupon receivables, moved by BAS to 1686), and the hardcoded name silently overrode users' own kontoplan names. No replacement entry: 1580 is deliberately off-catalog, so companies with a legacy 1580 now see their own account name. diff --git a/components/ui/account-number.tsx b/components/ui/account-number.tsx index 627e638f..de899096 100644 --- a/components/ui/account-number.tsx +++ b/components/ui/account-number.tsx @@ -46,7 +46,10 @@ export function AccountNumber({ // descriptions for non-hardcoded accounts are available. useBasReference() const desc = getAccountDescription(number) - const displayName = desc?.name ?? name + // The company's own account name wins over the BAS reference name: a chart + // row is user-editable data and must never be visually overridden by our + // hardcoded copy. The tooltip still shows the BAS name as reference. + const displayName = name || desc?.name const numberElement = ( { expect(getAccountDescription('9999')).toBeUndefined() expect(getAccountDescription('')).toBeUndefined() }) + + it('has no entry for 1580 (removed from BAS; was mislabeled as tax receivable)', () => { + // Tax receivables are 1640/1650. Card/coupon receivables moved from + // 1580 to 1686. 1580 must stay undefined so a company's own account + // name is what renders. + expect(getAccountDescription('1580')).toBeUndefined() + }) }) describe('data completeness', () => { diff --git a/lib/bookkeeping/account-descriptions.ts b/lib/bookkeeping/account-descriptions.ts index f107b750..e0267742 100644 --- a/lib/bookkeeping/account-descriptions.ts +++ b/lib/bookkeeping/account-descriptions.ts @@ -18,12 +18,11 @@ const ACCOUNT_DESCRIPTIONS: Record = { type: 'asset', explanation: 'Pengar som kunder är skyldiga dig för skickade fakturor som inte betalats ännu.', }, - '1580': { - name: 'Fordran för skatt', - classLabel: 'Tillgångar', - type: 'asset', - explanation: 'Pengar du har att fordra från Skatteverket, t.ex. överskjutande moms.', - }, + // 1580 is intentionally absent: BAS moved card/coupon acquirer receivables + // from 1580 to 1686, and 1580 is excluded from the BAS 2026 catalog as + // non-standard (see bas-reference.test.ts). A hardcoded entry here once + // mislabeled it as a tax receivable (that is 1640/1650); companies with a + // legacy 1580 see their own account name instead. '1630': { name: 'Skattekonto', classLabel: 'Tillgångar',