feat: multi-series SIE import, reusable FiscalYearSelector, library templates in picker (#278)
* 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>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
d708a85d4c
commit
23664e79cb
@@ -44,12 +44,22 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ error: 'Ingen fil bifogad. Gå tillbaka och ladda upp filen igen.' }, { status: 400 })
|
||||
}
|
||||
|
||||
// Parse options
|
||||
const options = optionsJson ? JSON.parse(optionsJson) : {
|
||||
// Parse options. The voucherSeries option is only a fallback for vouchers
|
||||
// that arrive without a series (SIE4I subsystem files); the import engine
|
||||
// preserves each #VER's source series per voucher.
|
||||
const parsedOptions = optionsJson ? JSON.parse(optionsJson) : null
|
||||
const { data: companySettings } = await supabase
|
||||
.from('company_settings')
|
||||
.select('default_voucher_series')
|
||||
.eq('company_id', companyId)
|
||||
.maybeSingle()
|
||||
const companyDefaultSeries = companySettings?.default_voucher_series || 'B'
|
||||
|
||||
const options = parsedOptions ?? {
|
||||
createFiscalPeriod: true,
|
||||
importOpeningBalances: true,
|
||||
importTransactions: true,
|
||||
voucherSeries: 'B',
|
||||
voucherSeries: companyDefaultSeries,
|
||||
}
|
||||
|
||||
// Read and decode file
|
||||
@@ -207,7 +217,7 @@ export async function POST(request: Request) {
|
||||
createFiscalPeriod: options.createFiscalPeriod,
|
||||
importOpeningBalances: options.importOpeningBalances,
|
||||
importTransactions: options.importTransactions,
|
||||
voucherSeries: options.voucherSeries || 'B',
|
||||
voucherSeries: options.voucherSeries || companyDefaultSeries,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user