I've already reported this as a bug but would love to help solve this - am hoping you guys can help point me in the right direction. (https://lab.civicrm.org/dev/core/issues/893)
When 'Record generated letters' is set to "Multiple activities (one per contact)" and you print/merge documents, they don't file on the correct contact.
With a list of cases, select all and then choose Print/merge document. The letters are generated in case ID order but they are filed in the order your search screen was last sorted.
For example, the letters are issued in this order:
- Case 1 - Lawrence Ivanov
- Case 2 - Carlos Jacobs
- Case 3 - Sanford Blackwell
But, the default sort if alpha by contact last name:
- Sanford Blackwell (gets Lawrence Ivanov's - case 1 activity)
- Lawrence Ivanov (gets Carlos Jacob's - case 2 activity)
- Carlos Jacobs (gets Sanford Blackwell's - case 3 activity)
I think it can be tracked to the Contact > Form > Task > PDFLetterCommon.php file but I'm having a little trouble wrapping my brain around what's happening in the for each statement in the 'multiple' case.
Thoughts?