From 71a2efc681abe71949b30974ecc366fb0849eabf Mon Sep 17 00:00:00 2001 From: Jeff Turner Date: Wed, 13 Nov 2024 21:55:32 +1100 Subject: [PATCH] Fix #1054 - our tempfile must have a .docx extension for later filetype inferral. --- views/view_2_families__4_contact_list.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/views/view_2_families__4_contact_list.class.php b/views/view_2_families__4_contact_list.class.php index 09c6b20b..c95ea856 100644 --- a/views/view_2_families__4_contact_list.class.php +++ b/views/view_2_families__4_contact_list.class.php @@ -500,7 +500,9 @@ public function printDOCX() } if (file_exists($templateFilename)) { require_once 'include/odf_tools.class.php'; - $outname = tempnam(sys_get_temp_dir(), 'contactlist-docx-'); + $outname = tempnam(sys_get_temp_dir(), 'contactlist'); + rename($outname, $outname.".docx"); // replaceKeywords() relies on the extension to know the filetype. + $outname = $outname.".docx"; copy($templateFilename, $outname); ODF_Tools::insertFileIntoFile($tempname, $outname, '%CONTACT_LIST%'); $replacements = Array('SYSTEM_NAME' => SYSTEM_NAME, 'MONTH' => date('F Y'));