CRM-12435 'Print PDF Letter' activity has no subject field

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 4.3.0, 4.3.1
    • Fix Version/s: 4.4.0
    • Component/s: Core CiviCRM
    • Labels:

      Description

      the 'Print PDF Letter' activity has no subject field, both on the create pdf page and on the activity log on the users. This results in 'Print PDF Letter' from not being able to be distinguished and searched for if multiple letters are being used in civicrm. Currently on cursory glance that this results in no way to identify unique letters and activity in search.

      The activity should have a subject line included. This problem was also discussed by Freya von Moltke-Foundation here: http://forum.civicrm.org/index.php/topic,27349.msg121824.html

      This may not be a bug per say but is missing functionality with no true workaround or part of the print pdf letter that was not properly implemented. The problem is duplicated on the most recent demo server.

        Attachments

        1. CRM-12435 (2).patch
          3 kB
          Dan Pastuf
        2. PDFLetterCommon.php
          15 kB
          Dan Pastuf
        3. PDFLetterCommon.tpl
          13 kB
          Dan Pastuf

          Activity

          [CRM-12435] 'Print PDF Letter' activity has no subject field
          Donald A. Lobo added a comment -


          can you work and submit a patch for this please

          Dan Pastuf added a comment -

          Hmm; that was easier than I thought it was going to be;
          sorry I don't know how to create patches per say; so ill try to do a quick explanation of what I did and attach the two files I changed. Its only 14 lines of code luckily. (the pluses are additions);

          in \civicrm\civicrm\templates\CRM\Contact\Form\Task\PDFLetterCommon.tpl @ line ~33:

          <table class="form-layout-compressed">
          <tr>
          <td class="label-left">{$form.template.label}</td>
          <td>{$form.template.html}</td>
          </tr>
          + <tr>
          + <td class="label-left">{$form.subject.label}</td>
          + <td>{$form.subject.html}</td>
          + </tr>
          </table>

          in \civicrm\civicrm\CRM\Contact\Form\Task\PDFLetterCommon.php at about line 138 (end of the build quick form first set):

          + $form->add(
          + 'text',
          + 'subject',
          + ts('Subject'),
          + array('size' => 36, 'maxlength' => 255, ),
          + TRUE
          + );

          in \civicrm\civicrm\CRM\Contact\Form\Task\PDFLetterCommon.php at about line 364

          function createActivities($form, $html_message, $contactIds) {
          + $formValues = $form->controller->exportValues($form->getName());

          $session = CRM_Core_Session::singleton();
          $userID = $session->get('userID');
          $activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
          'Print PDF Letter',
          'name'
          );
          + $subjectPara = CRM_Utils_Array::value('subject', $formValues);

          $activityParams = array(
          'source_contact_id' => $userID,
          'activity_type_id' => $activityTypeID,
          'activity_date_time' => date('YmdHis'),
          + 'subject' => $subjectPara,
          'details' => $html_message,
          );

          Basically it appears what the function that $activityParams can set 'subject' anyways for that activity, so its just a matter of having a form field and passing it down. I think right now its required in this code, but can turn that off.

          I think this fixes it handily?

          Dan Pastuf added a comment -

          Updated files for including subject in the Print PDF Function activity output

          Dan Pastuf added a comment -

          I think this will work to fix the issue. First patch so hopefully works, tested using wordpress civicrm

          Donald A. Lobo added a comment -

            People

            • Assignee:
              Ravish Nair
              Reporter:
              Dan Pastuf

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 6 hours
                6h
                Remaining:
                Remaining Estimate - 6 hours
                6h
                Logged:
                Time Spent - Not Specified
                Not Specified