diff --git a/paperless-backend/src/paperless/paperless-task-processor.service.ts b/paperless-backend/src/paperless/paperless-task-processor.service.ts index d54257d..8646e28 100644 --- a/paperless-backend/src/paperless/paperless-task-processor.service.ts +++ b/paperless-backend/src/paperless/paperless-task-processor.service.ts @@ -299,6 +299,19 @@ export class PaperlessTaskProcessorService { // Add Notes this.logger.log(`[Postprocessing] Task ${t.TaskId} - Füge Notizen hinzu`); await this.paperlessService.addNote(document.id, `Task bearbeitet: ${new Date().toLocaleString('de-DE')}`); + + if (t.SourceAttachmentID) { + const attachment = await this.attachmentRepo.findOne({ where: { Id: t.SourceAttachmentID }, relations: ['EmailMessage'] }); + if (attachment) { + const rangePart = t.SourceAttachmentRange && t.SourceAttachmentRange !== 'full' + ? ` | Seiten: ${t.SourceAttachmentRange}` + : ''; + const messageId = attachment.EmailMessage?.MessageId ?? String(attachment.EmailMessageId); + await this.paperlessService.addNote(document.id, `E-Mail-ID: ${messageId} | Datei: ${attachment.FileName}${rangePart}`); + this.logger.log(`[Postprocessing] Task ${t.TaskId} - Herkunfts-Notiz hinzugefügt`); + } + } + if (t.BarcodeJson) { await this.paperlessService.addNote(document.id, t.BarcodeJson); this.logger.log(`[Postprocessing] Task ${t.TaskId} - BarcodeJson-Notiz hinzugefügt`);