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

case export doesn't export all case activity custom fields

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.0.7
    • Fix Version/s: 4.5
    • Component/s: CiviCase
    • Labels:
      None

      Description

      the case export allows you to export case activity fields, including custom fields
      but the export file does not always have data for the custom fields

      the issue is that the case export does two joins with the _activity table –
      the first join is through the _activity_target table, and the second is through the _case_activity table

      for the first join, we retain the table name as civicrm_activity, and so our customQuery.php model work fine – it sees the custom fields as an extension of the activity table and the mapping works out fine.

      but for the second join, we alias it as case_activity – which means the customQuery code doesn't recognize the custom tables as an extension of this data.

      we see the results when a case activity does not have a target contact. it still gets exported because it joins the case through the case_activity table, but the custom field data is not included.

      i'm not sure the best place to attack it. i did an ugly hack to the customQuery.php file where the tables are joined with the following:

      if ( $joinTable == 'civicrm_activity' && CRM_Utils_Array::value('task', $_GET) == 'civicrm/case/search' )

      { $this->_tables[$name] .= " OR $name.entity_id = case_activity.id "; }

      that gets the job done and makes sure we don't screw up the normal activity export. but it's really not great to condition on the url param value. unfortunately, there's nothing in $this to effectively distinguish the context of the query.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: