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
All checks were successful
Deploy miriamgemeinde / deploy (push) Successful in 7s
This commit is contained in:
@@ -2683,6 +2683,8 @@ exports.exportWorships = async (req, res) => {
|
|||||||
const titleStr = worship.title || 'Gottesdienst';
|
const titleStr = worship.title || 'Gottesdienst';
|
||||||
const organizerStr = worship.organizer || '';
|
const organizerStr = worship.organizer || '';
|
||||||
const collectionStr = worship.collection || '';
|
const collectionStr = worship.collection || '';
|
||||||
|
const sacristanServiceStr = worship.sacristanService || '';
|
||||||
|
const organPlayingStr = worship.organPlaying || '';
|
||||||
|
|
||||||
const secondCellChildren = [];
|
const secondCellChildren = [];
|
||||||
|
|
||||||
@@ -2717,19 +2719,39 @@ exports.exportWorships = async (req, res) => {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kollekte (nicht bold, schwarz, Arial 11pt)
|
// Dienst (nicht bold, schwarz, Arial 11pt)
|
||||||
if (collectionStr) {
|
if (sacristanServiceStr) {
|
||||||
secondCellChildren.push(new TextRun({
|
secondCellChildren.push(new TextRun({
|
||||||
text: '',
|
text: '',
|
||||||
break: 1 // Zeilenumbruch
|
break: 1 // Zeilenumbruch
|
||||||
}));
|
}));
|
||||||
secondCellChildren.push(new TextRun({
|
secondCellChildren.push(new TextRun({
|
||||||
text: 'Kollekte: ',
|
text: 'Dienst: ',
|
||||||
color: '000000',
|
color: '000000',
|
||||||
font: 'Arial',
|
font: 'Arial',
|
||||||
size: 22
|
size: 22
|
||||||
}));
|
}));
|
||||||
secondCellChildren.push(new TextRun({
|
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,
|
text: collectionStr,
|
||||||
color: '000000',
|
color: '000000',
|
||||||
font: 'Arial',
|
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({
|
const secondCell = new TableCell({
|
||||||
children: [new Paragraph({
|
children: [new Paragraph({
|
||||||
children: secondCellChildren,
|
children: secondCellChildren,
|
||||||
@@ -2802,7 +2844,7 @@ exports.exportWorships = async (req, res) => {
|
|||||||
const buffer = await Packer.toBuffer(doc);
|
const buffer = await Packer.toBuffer(doc);
|
||||||
|
|
||||||
// Dateiname generieren
|
// Dateiname generieren
|
||||||
const filename = `gottesdienste_${from}_${to}_${format}.docx`;
|
const filename = `gottesdienste_${from}_${to}.docx`;
|
||||||
|
|
||||||
// Response senden
|
// Response senden
|
||||||
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
|
||||||
|
|||||||
@@ -1156,9 +1156,11 @@ export default {
|
|||||||
const contentDisposition = response.headers['content-disposition'];
|
const contentDisposition = response.headers['content-disposition'];
|
||||||
let filename = `gottesdienste_${this.exportDateFrom}_${this.exportDateTo}.docx`;
|
let filename = `gottesdienste_${this.exportDateFrom}_${this.exportDateTo}.docx`;
|
||||||
if (contentDisposition) {
|
if (contentDisposition) {
|
||||||
const filenameMatch = contentDisposition.match(/filename="?(.+)"?/i);
|
const filenameMatch = contentDisposition.match(/filename\*?=(?:UTF-8''|")?([^";\n]+)/i);
|
||||||
if (filenameMatch) {
|
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user