Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-14247

No view or edit links in activity search results for renamed activity types

    Details

      Description

      Steps to replicate:
      1. Create an activity type in UI.
      2. Rename this activity type in UI (edit, change label, save).
      3. Create an activity of this type.
      4. Do an activity search that retrieves this activity.
      Result: action links for the activity have only "delete", not "view" or "edit".

      Replicated on 4.3.8 and 4.4 demo site ("4.4.5").

      I've tracked the problem down to CRM_Activity_Selector_Search::getRows(), lines 287-288 in 4.3.8:

      $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name', TRUE);
      $activityTypeId = CRM_Utils_Array::key($row['activity_type'], $activityType);

      So $activityType has activity type names, however $row['activity_type'] has activity type labels. If the activity type has been renamed through the UI, the label is changed but not the name. So $row['activity_type'] is not found in $activityType, so $activityTypeId is empty. $activityType is passed as first parameter to $activityActions->actionLinks() at line 308.

      CRM_Activity_Selector_Activity::actionLinks() does this:

      $activityTypeName = CRM_Utils_Array::value($activityTypeId, $activeActTypes);

      then switches on $activityTypeName . So if $activityTypeId is empty, so is $activityTypeName, so the switch falls through to default and does this:

      //when type is not available lets hide view and update.
      if (empty($activityTypeName))

      { $showView = $showUpdate = FALSE; }

      The attached patch fixes the problem. A side-effect would I think be that if someone renamed the "Bulk Email" activity type, the appropriate processing for mailing report link etc would not be done, due to line 292:

      $bulkActivityTypeID = CRM_Utils_Array::key('Bulk Email', $activityType);

      which currently checks against name but with the patch, would check against label.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              davej Dave Jenkins
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: