3e42fc6f32
* feat: implement inbox document picker and linking functionality * feat: implement self-billing invoice functionality - Added support for registering self-billed invoices received from customers. - Updated the invoice schema to include fields for self-billing metadata such as `is_self_billed`, `external_invoice_number`, `self_billing_agreement_ref`, and `received_date`. - Created API route for handling self-billed invoice submissions, including validation and error handling. - Implemented database migrations to add necessary columns and constraints for self-billing invoices. - Developed tests to ensure correct behavior of self-billing invoice creation and validation rules. - Updated Swedish localization files to include new terms related to self-billing. * feat: enforce SIE import requirement for non-Fortnox providers in migration process * feat: streamline invoice processing and enhance error logging across APIs
19 lines
657 B
TypeScript
19 lines
657 B
TypeScript
export const INVOICE_NUMBER_DRAFT_LABEL = '(Utkast)'
|
|
|
|
export function invoiceNumberDisplay(value: string | null | undefined): string {
|
|
return value ?? INVOICE_NUMBER_DRAFT_LABEL
|
|
}
|
|
|
|
/**
|
|
* The number to show for an invoice. Self-billing invoices we received carry
|
|
* the counterparty's number in `external_invoice_number` (our own
|
|
* `invoice_number` is null by design), so fall back to it before the draft
|
|
* label.
|
|
*/
|
|
export function invoiceDisplayNumber(invoice: {
|
|
invoice_number?: string | null
|
|
external_invoice_number?: string | null
|
|
}): string {
|
|
return invoice.invoice_number ?? invoice.external_invoice_number ?? INVOICE_NUMBER_DRAFT_LABEL
|
|
}
|