fix(bookkeeping): editable verifikationstext on andringsverifikation (#1035)
The correction header was always built server-side as "Rattelse: <original description>". When the original entry was labelled after the wrong account, the correction kept echoing that stale label even after the user switched to the correct account (follow-up to the line-description fix in #1029). - CorrectJournalEntrySchema gains an optional trimmed description - correctEntry() accepts options.description; blank or absent falls back to the canonical "Rattelse: <original>" auto text - both correct routes (dashboard + v1, which share the schema) thread the description through - CorrectionEntryDialog surfaces an editable verifikationstext field, pre-filled with the auto text; an untouched or cleared prefill is NOT sent, so the server-side fallback stays the source of truth (same only-overwrite-auto-filled principle as #1029) Forward-only: already-posted corrections are immutable per BFL. Fixes #1031 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
90e4f668c9
commit
6bd85f94b6
@@ -2212,6 +2212,31 @@ describe('CorrectJournalEntrySchema', () => {
|
||||
})
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts an optional description and trims it', () => {
|
||||
const result = CorrectJournalEntrySchema.safeParse({
|
||||
description: ' Rättelse: Skulder till närstående personer, kortfristig del ',
|
||||
lines: [
|
||||
validJournalEntryLine({ account_number: '6200', debit_amount: 500, credit_amount: 0 }),
|
||||
validJournalEntryLine({ account_number: '1930', debit_amount: 0, credit_amount: 500 }),
|
||||
],
|
||||
})
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data.description).toBe('Rättelse: Skulder till närstående personer, kortfristig del')
|
||||
}
|
||||
})
|
||||
|
||||
it('rejects a blank description (omit it to use the server fallback)', () => {
|
||||
const result = CorrectJournalEntrySchema.safeParse({
|
||||
description: ' ',
|
||||
lines: [
|
||||
validJournalEntryLine({ account_number: '6200', debit_amount: 500, credit_amount: 0 }),
|
||||
validJournalEntryLine({ account_number: '1930', debit_amount: 0, credit_amount: 500 }),
|
||||
],
|
||||
})
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user