fix(salary): surface missing sender bankgiro/IBAN before betalfil download (#1640)
* fix(salary): surface missing sender bankgiro/IBAN before betalfil download Users see a bankgiro under BANKUPPGIFTER in settings (Bolagsverket snapshot, display only) while the payment-file routes read company_settings.bankgiro, so the LB download failed with an error that pointed at a page that looked correct. 153 companies have a registry bankgiro but an empty settings field. - PaymentFilePanel warns up front when the sender bankgiro (bg_lb) or IBAN (pain001) is missing, linking to Installningar -> Fakturering - betalkonton form offers a one-click prefill of the bankgiro from companies.tic_snapshot (Luhn-validated, user still saves) - bg-lb and skattekonto payment-file error copy now names the exact place to fix instead of 'foretagsinstallningar' Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(salary): harden bankgiro prefill and warning per skeptic review - bankgiroFromTicSnapshot now requires the snapshot's orgNumber to match companies.org_number before suggesting anything: stale fuzzy-matched snapshots can hold another entity's profile, and this field becomes the payee account on invoices and Peppol e-invoices - salary run page refetches settings when the URL returns from the intercepting settings modal, so a bankgiro/IBAN saved there clears the missing-sender warning instead of leaving it stale Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
25524e1df4
commit
1bb423b2b3
@@ -22,6 +22,15 @@ interface PaymentFilePanelProps {
|
||||
defaultFormat: PaymentFormat
|
||||
/** company_settings.salary_default_bank: sorts and auto-expands the matching bank's instructions. */
|
||||
defaultBank?: string | null
|
||||
/**
|
||||
* company_settings.bankgiro / iban: the sender account each format requires.
|
||||
* null means missing as of the latest settings fetch (warn up front, the
|
||||
* download would 400); undefined means unknown (settings not loaded), so no
|
||||
* warning is shown. The caller must refetch after detours that can fix the
|
||||
* setting (the warning links into the settings modal over this page).
|
||||
*/
|
||||
senderBankgiro?: string | null
|
||||
senderIban?: string | null
|
||||
readOnly?: boolean
|
||||
onDownloaded?: () => void
|
||||
}
|
||||
@@ -49,6 +58,8 @@ export function PaymentFilePanel({
|
||||
paymentFileGeneratedAt,
|
||||
defaultFormat,
|
||||
defaultBank,
|
||||
senderBankgiro,
|
||||
senderIban,
|
||||
readOnly,
|
||||
onDownloaded,
|
||||
}: PaymentFilePanelProps) {
|
||||
@@ -175,6 +186,26 @@ export function PaymentFilePanel({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* The sender account lives in company_settings, not in the
|
||||
Bolagsverket snapshot shown on the settings overview: users see
|
||||
a bankgiro there and reasonably believe it is configured. Say
|
||||
the precondition here, before the download 400s on it. */}
|
||||
{((format === 'bg_lb' && senderBankgiro === null) ||
|
||||
(format === 'pain001' && senderIban === null)) && (
|
||||
<div className="flex items-start gap-2 rounded-lg border border-border p-3 text-xs">
|
||||
<AlertTriangle className="h-3.5 w-3.5 mt-0.5 shrink-0" />
|
||||
<span className="text-muted-foreground">
|
||||
{format === 'bg_lb' ? t('missing_bankgiro_warning') : t('missing_iban_warning')}{' '}
|
||||
<Link
|
||||
href="/settings/invoicing"
|
||||
className="underline underline-offset-2 hover:text-foreground"
|
||||
>
|
||||
{t('missing_sender_link')}
|
||||
</Link>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end">
|
||||
<Button onClick={handleDownload} disabled={downloading}>
|
||||
{downloading ? (
|
||||
|
||||
Reference in New Issue
Block a user