CRM-13151 Activities automatically created from cases show no subject

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 4.3.5
    • Fix Version/s: 4.4.0
    • Component/s: CiviCase
    • Labels:
      None

      Description

      As discussed in - http://forum.civicrm.org/index.php/topic,23834.0.html

      For anyone else looking, I found a fix for this.

      It's to do with the XML processor for activities that get created, if it's not an open case task it doesn't add a subject. Which makes sense, but my client had a justification for this not being the case.

      So create a copy of CRM/Case/XMLProcessor/Process.php

      and at line 350, simply add

      'subject' => CRM_Utils_Array::value('subject', $params) ? $params['subject'] : $activityTypeName,

      Basically a straight copy and past from line 331 above.

      Patch attached

        Attachments

        1. changes.patch
          0.1 kB
          Chris Chinchilla
        2. Screen Shot 2013-08-07 at 9.50.11 AM.PNG
          131 kB
          David Greenberg

          Activity

          [CRM-13151] Activities automatically created from cases show no subject
          Coleman Watts added a comment -

          If I may interject a small pet peeve here. I think CRM_Utils_Array::value() is one of the most misused functions in CivICRM. In many if not most of the times I've seen it used, 'empty()' would have been a better choice, since it is shorter to write and much faster performance-wise. So your code could be simplified and made more efficient by changing it to
          'subject' => !empty($params['subject']) ? $params['subject'] : $activityTypeName,

          On the other hand, CRM_Utils_Array::value() is very handy when you want to get a value that may or may not exist, and you want to supply a default value if it's not there. This situation is a good example, actually, because that inline if-statement is kind of clunky and can be better written as:
          'subject' => CRM_Utils_Array::value('subject', $params, $activityTypeName),

          Ultimately the inline if-statement using empty might be a better choice in this specific situation since you want to test for empty rather than testing for array_key_exists which is what CRM_Utils_Array::value() does, but I thought I'd point out both alternatives.

          David Greenberg added a comment - - edited

          I'm not sure this is appropriate as a fix to core. Repeating the Activity Type as the Subject for case activities inserted into the timeline when a case is created seems like a redundancy. Chris's client wanted this for some reason, but if you look at this screenshot of current behavior on a newly created case - I don't see how it adds general value to replace '(no subject)' w/ duplication of activity type label. Coleman - please close if you agree, or get back to me w/ your thoughts.

          Coleman Watts added a comment -

          Agreed.

            People

            • Assignee:
              Coleman Watts
              Reporter:
              Chris Chinchilla

              Dates

              • Created:
                Updated:
                Resolved: