diff --git a/controllers/worshipController.js b/controllers/worshipController.js index ce4ab2d..e05e17f 100644 --- a/controllers/worshipController.js +++ b/controllers/worshipController.js @@ -2683,6 +2683,8 @@ exports.exportWorships = async (req, res) => { const titleStr = worship.title || 'Gottesdienst'; const organizerStr = worship.organizer || ''; const collectionStr = worship.collection || ''; + const sacristanServiceStr = worship.sacristanService || ''; + const organPlayingStr = worship.organPlaying || ''; const secondCellChildren = []; @@ -2717,19 +2719,39 @@ exports.exportWorships = async (req, res) => { })); } - // Kollekte (nicht bold, schwarz, Arial 11pt) - if (collectionStr) { + // Dienst (nicht bold, schwarz, Arial 11pt) + if (sacristanServiceStr) { secondCellChildren.push(new TextRun({ text: '', break: 1 // Zeilenumbruch })); secondCellChildren.push(new TextRun({ - text: 'Kollekte: ', + text: 'Dienst: ', color: '000000', font: 'Arial', size: 22 })); secondCellChildren.push(new TextRun({ + text: sacristanServiceStr, + color: '000000', + font: 'Arial', + size: 22 + })); + } + + // Kollekte (nicht bold, schwarz, Arial 11pt) + if (collectionStr) { + secondCellChildren.push(new TextRun({ + text: '', + break: 1 + })); + secondCellChildren.push(new TextRun({ + text: 'Kollekte: ', + color: '000000', + font: 'Arial', + size: 22 + })); + secondCellChildren.push(new TextRun({ text: collectionStr, color: '000000', font: 'Arial', @@ -2737,6 +2759,26 @@ exports.exportWorships = async (req, res) => { })); } + // Orgelspiel (nicht bold, schwarz, Arial 11pt) + if (organPlayingStr) { + secondCellChildren.push(new TextRun({ + text: '', + break: 1 + })); + secondCellChildren.push(new TextRun({ + text: 'Orgel: ', + color: '000000', + font: 'Arial', + size: 22 + })); + secondCellChildren.push(new TextRun({ + text: organPlayingStr, + color: '000000', + font: 'Arial', + size: 22 + })); + } + const secondCell = new TableCell({ children: [new Paragraph({ children: secondCellChildren, @@ -2802,7 +2844,7 @@ exports.exportWorships = async (req, res) => { const buffer = await Packer.toBuffer(doc); // Dateiname generieren - const filename = `gottesdienste_${from}_${to}_${format}.docx`; + const filename = `gottesdienste_${from}_${to}.docx`; // Response senden res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'); diff --git a/src/content/admin/WorshipManagement.vue b/src/content/admin/WorshipManagement.vue index 22b5579..e6635a1 100644 --- a/src/content/admin/WorshipManagement.vue +++ b/src/content/admin/WorshipManagement.vue @@ -1156,9 +1156,11 @@ export default { const contentDisposition = response.headers['content-disposition']; let filename = `gottesdienste_${this.exportDateFrom}_${this.exportDateTo}.docx`; if (contentDisposition) { - const filenameMatch = contentDisposition.match(/filename="?(.+)"?/i); + const filenameMatch = contentDisposition.match(/filename\*?=(?:UTF-8''|")?([^";\n]+)/i); if (filenameMatch) { - filename = filenameMatch[1]; + filename = decodeURIComponent(filenameMatch[1]).trim(); + // Manche Server/Proxy-Ketten hängen versehentlich "_" hinter die Endung. + filename = filename.replace(/(\.docx)_+$/i, '$1'); } }