MeOS

Accounts and businesses

# Setup specification

Pair: [user guide](../../user/accounting/setup.md). Entry: public/setup.php?section=accounts or businesses. setup-api.php dispatches init → setup_catalog and save → setup_save. private/actions/accounts.php separately supports importer account selection/new-account creation.

Tables: statement_accounts and accounting_businesses. Stable account_key/business_key identify namespace nodes independently of mutable display_name. Setup-generated keys use random suffixes; importer-created accounts use a sanitized name with a random collision suffix. These are separate current paths, not guaranteed identical key formats.

setup_save accepts {kind:accounts|businesses,id:0|existing,name,active,currency}. Name is trimmed, nonempty and at most 160 bytes. Currency is uppercased and must match three ASCII uppercase letters. Once an account has statement_imports, currency changes are rejected. Existing rows are locked for update. Save is transactional and invalidates classification_view and statement_preview.

There is no account/business deletion action. Active flags preserve existing identities. known_accounts and resolve_account intentionally do not filter is_active so historical statements can be imported for closed accounts. Business suggestion selection uses active entries. Classification validation allows retaining an existing inactive business, not newly assigning it.

setup.php?section=categories redirects to Category Management; setup_save rejects category writes. setup_catalog still returns old compatibility fields, including an empty applicability list. Hidden legacy markup remains; see [discrepancies](../discrepancies.md), not an authorization to restore Use filtering.

Verification: empty installation can create accounts/businesses; rename retains stable keys; used currency cannot change; inactive historical account imports; inactive business retained on existing record; category route cannot write through Setup.

Developer / AI specification · Finalized documentation stage · 12 October 2026