Typing "0" into Betalningsvillkor on a customer made the form silently unsavable: the form schema had min(1) and no error was rendered for the field, so the user saw nothing happen. 0 days is a real value (betalning direkt / vid mottagande), and the invoice schema already accepted it. Customer and supplier forms now validate whole days 0-365 and show the rule under the field; the API schemas (customer create/update, supplier) accept 0 the same way; and every `|| 30` fallback that would have turned a stored 0 back into 30 on edit or create is `?? 30`. Closes #2070 Claude-Session: https://claude.ai/code/session_01VnConrmMCxJRQ5kfiPPWyy Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Jakob Wennberg
Claude Fable 5.1
parent
5eac2a492c
commit
1150930cb9
@@ -704,8 +704,13 @@ describe('CreateCustomerSchema', () => {
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects zero payment terms', () => {
|
||||
it('accepts zero payment terms (betalning direkt, issue #2070)', () => {
|
||||
const result = CreateCustomerSchema.safeParse(validCustomer({ default_payment_terms: 0 }))
|
||||
expect(result.success).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects payment terms above 365 days', () => {
|
||||
const result = CreateCustomerSchema.safeParse(validCustomer({ default_payment_terms: 366 }))
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user