* feat: multi-series SIE import, reusable FiscalYearSelector, library templates in picker
- SIE import preserves each voucher's source series (B/C/I/V/...), essential
for Fortnox migrations where series carry semantic meaning (kundfakturor,
inbetalningar, etc.). Target numbering still goes through next_voucher_number
per series; source (series, number) is stored in the migration mapping for
BFNAR 2013:2 audit trail.
- Execute route reads company_settings.default_voucher_series as the fallback
for vouchers arriving without a series (SIE4I).
- Extract shared FiscalYearSelector component; adopt in /reports and
/bookkeeping.
- Transaction TemplatePicker now surfaces user-created library templates
(company + team scope) alongside the static registry, with a helper to
convert simple library templates into the BookingTemplate shape.
- Exclude 8999 "Årets resultat" from income statement financial section and
monthly breakdown so year-end closing entries don't cancel the net result.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: skip Bokio SIE regression when fixtures are absent
/dev_docs is gitignored (contains anonymised customer exports), so the
integration test can't find its input files in CI. Gate the suite on
fixture presence so it still runs locally.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix: address Greptile review feedback
- convertLibraryToBookingTemplate: default entity_applicability to 'all'
when the source template has no entity_type, so TemplatePicker doesn't
silently hide it for companies with a set entity type.
- FiscalYearSelector: fire onReady in the no-company early-return branch
so consumers (e.g. ReportsPage) don't get stuck in a loading skeleton
while the company context is still hydrating.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat: implement viewer role permissions for bank transaction imports and connections
* feat: add booking_template_library table with 30 system templates
Three-level scoping (system/team/company), RLS policies for
read/write/delete, and pre-seeded templates for EU reverse charge,
tax account, private transfers, salary, representation, year-end,
VAT netting, and bank/finance scenarios.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add template library types, helpers, and tests
- BookingTemplateLibrary/Line/Category types in types/index.ts
- applyTemplate() converts template lines + amount into form lines
- Category labels, scope helpers for UI display
- 8 unit tests for amount calculation, VAT, rounding, and scope detection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add booking template CRUD, export, and import API routes
- GET/POST/DELETE /api/settings/booking-templates (list, create, soft-delete)
- PUT /api/settings/booking-templates/[id] (update non-system templates)
- GET /api/settings/booking-templates/export (JSON download)
- POST /api/settings/booking-templates/import (bulk import from JSON)
All routes enforce auth, write permissions, and Zod validation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add template picker UI and settings management panel
- BookingTemplatePicker: dialog with search, category/entity-type filter,
line preview, and amount input — integrated into JournalEntryForm
- BookingTemplatesPanel: settings page with grouped templates
(system/team/company), create dialog, export/import, soft-delete
- Settings templates page now shows both booking and counterparty templates
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Update supabase/migrations/20260413160000_booking_template_library.sql
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>