Option to rename the file before downloading
Overview
CiviCRM has functionality to allow you to generate PDF letters.
The files that are being created throughout the system has a specific name depending on the nature of the file and does not provide any option to rename the file.
As such the file downloaded and the file recorded on an activity record against a contact record is always called "CiviLetter.pdf".
This makes it difficult for users to know what the letter was for.
Problem statement
The key point is not the name of the file that is downloaded to your Computer, a user can obviously always change this after it is downloaded. The problem is that CiviCRM creates an activity with the file in the activity listing and the filename of the file that is created automatically by CiviCRM is also named "CiviLetter.pdf". This makes it impossible for a user to know what the file was once it was created. There is no way for the user to change this.
Example use-case
- Go to activities tab in contact detail page.
- Choose Print/Merge Document from New Activity menu.
- Fill the form and Proceed to download or preview the document.
- The name of the file will be CiviLetter.pdf
- CiviCRM will create an activity with the new CiviLetter.pdf attached
- Users will not know what the CiviLetter.pdf was about after it was created and there is no way to change the name of that file as a user.
Current behaviour
The downloaded file has always the same specific name and the PDF attached to the activity always has that name.
Proposed behaviour
The postProcess
method in class CRM/Contact/Form/Task/PDFLetterCommon.php
can be changed such that it looks for the filename field being posted and if it does find that field then it uses the field value for naming the downloading file otherwise it uses the activity subject and even that is empty then it falls back to default 'CiviLetter'. This way the processing for the filename will be added as a work in progress and the ui for it can be added later.