u
This commit is contained in:
@@ -2,6 +2,7 @@ import PDFDocument from 'pdfkit';
|
||||
import { getStore } from '../db/store.js';
|
||||
import * as dbOrder from '../db/order.js';
|
||||
import { emit } from '../api/sse.js';
|
||||
import { formatAttachment } from '../util/manifestAttachment.js';
|
||||
|
||||
/**
|
||||
* Formats a Date or date string to German format DD.MM.YYYY.
|
||||
@@ -786,13 +787,15 @@ export async function createAndAttachManifestPdf(googleAuthId, companyId, manife
|
||||
const safeNumber = String(manifest.number || manifest.id).replace(/[^a-zA-Z0-9._-]/g, '_');
|
||||
const filename = `${config.filenamePrefix}-${safeNumber}.pdf`;
|
||||
|
||||
const attachment = await store.manifestattachment.add(googleAuthId, manifest.id, {
|
||||
const rawAttachment = await store.manifestattachment.add(googleAuthId, manifest.id, {
|
||||
mimetype: 'application/pdf',
|
||||
name: filename,
|
||||
content: pdfBuffer,
|
||||
meta: { type: `${type}_pdf` },
|
||||
});
|
||||
|
||||
const attachment = await formatAttachment(rawAttachment);
|
||||
|
||||
emit(type, { companyId });
|
||||
|
||||
return { manifest, attachment, pdfBuffer, filename };
|
||||
|
||||
Reference in New Issue
Block a user