feat(branding): implement dynamic branding in service worker and reports (#383)
* feat(branding): implement dynamic branding in service worker and reports * refactor(service-worker): remove push notification handling code * feat(service-worker): implement dynamic branding in service worker and related scripts
This commit is contained in:
@@ -118,7 +118,6 @@ export async function generateFullArchive(
|
||||
company_name: company.company_name || 'Unknown',
|
||||
trade_name: company.trade_name,
|
||||
org_number: company.org_number,
|
||||
program_name: 'ERPBase',
|
||||
})
|
||||
sieFolder.file(`${periodLabel(period)}.se`, sie)
|
||||
|
||||
@@ -135,7 +134,6 @@ export async function generateFullArchive(
|
||||
company_name: company.company_name || 'Unknown',
|
||||
trade_name: company.trade_name,
|
||||
org_number: company.org_number,
|
||||
program_name: 'ERPBase',
|
||||
})
|
||||
zip.file('bokforing.se', sie)
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { NEDeclaration, SRUFile, SRURecord } from '@/lib/reports/ne-bilaga/types'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
|
||||
function sanitizeString(str: string): string {
|
||||
return str.replace(/#/g, '').replace(/[\r\n]/g, ' ').substring(0, 250)
|
||||
}
|
||||
|
||||
/**
|
||||
* SRU File Generator
|
||||
@@ -54,7 +59,7 @@ export function generateSRUFile(declaration: NEDeclaration): SRUFile {
|
||||
// File header
|
||||
records.push({ fieldCode: 'PRODUKT', value: 'KONTROLLUPPGIFTER' })
|
||||
records.push({ fieldCode: 'SESSION', value: '1' })
|
||||
records.push({ fieldCode: 'PROGRAMNAMN', value: 'ERPBase' })
|
||||
records.push({ fieldCode: 'PROGRAMNAMN', value: sanitizeString(getBranding().appName) })
|
||||
records.push({ fieldCode: 'PROGRAMVERSION', value: '1.0' })
|
||||
records.push({
|
||||
fieldCode: 'SKAPAT',
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import type { SupabaseClient } from '@supabase/supabase-js'
|
||||
import { fetchAllRows } from '@/lib/supabase/fetch-all'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
import type { SIEExportOptions, JournalEntry, JournalEntryLine, BASAccount } from '@/types'
|
||||
|
||||
function sanitizeProgramName(str: string): string {
|
||||
return str.replace(/"/g, '').replace(/[\r\n]/g, ' ').substring(0, 60)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SIE4 export file
|
||||
*
|
||||
@@ -81,7 +86,8 @@ export async function generateSIEExport(
|
||||
lines.push('#FLAGGA 0')
|
||||
lines.push('#FORMAT PC8')
|
||||
lines.push('#SIETYP 4')
|
||||
lines.push(`#PROGRAM "${options.program_name || 'ERPBase'}" "1.0"`)
|
||||
const programName = sanitizeProgramName(options.program_name || getBranding().appName)
|
||||
lines.push(`#PROGRAM "${programName}" "1.0"`)
|
||||
lines.push(`#GEN ${formatSIEDate(now)}`)
|
||||
|
||||
if (options.org_number) {
|
||||
|
||||
Reference in New Issue
Block a user