Print/Merge Document - Incorrect handling of DOCX/ODT templates
Steps to reproduce:
- Create a
docx
orodt
file with basic contact (likeHello {contact.display_name}! This is from a DOCX.
) - Run a search for some contacts
- Select all the contacts on a page
- Choose the search action "Print/Merge Document"
- In the first row ("Use template"), upload the template in
docx
orodt
format - Enter a subject
- Press "Download Document. Observe:
- The response has the expected content and is in the expected format (
docx
/odt
). So it's mostly good... except that the reportedContent-Type
is wrong (HTML). Therefore, the browser (I used Firefox) can't recommend the right app for opening the file.
- The response has the expected content and is in the expected format (
- Press "Preview". Observe:
- The response is a PDF. (Not expected -- because we provided
docx
orodt
file.) - The response several pages long. (Expected -- because choose several contacts)
- The response is blank. (Not expected -- because the template had content.)
- The response is a PDF. (Not expected -- because we provided
Seen on 5.7
(local) and current master
(dmaster.demo.civicrm.org
; 5.14.alpha
).
What I would expect:
- The "Download Document" and "Preview" buttons should produce documents with the same content+headers.
- If the template is
docx
, then the result (either button) is alsodocx
format and has a corresponding MIME type and filename. - If the template is
odt
, then the result (either button) is alsoodt
format and has a corresponding MIME type and filename.