Enhance worship export functionality: Add support for sacristan service and organ playing details in worshipController.js, improving the export format. Update filename generation logic in WorshipManagement.vue to handle potential server-side filename issues, ensuring accurate file naming during downloads.
All checks were successful
Deploy miriamgemeinde / deploy (push) Successful in 7s

This commit is contained in:
Torsten Schulz (local)
2026-04-30 10:41:44 +02:00
parent ae0bf3d478
commit 2377caea6d
2 changed files with 50 additions and 6 deletions

View File

@@ -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');

View File

@@ -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');
}
}