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

Smart groups involving activity type or status break on 4.6 upgrade

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Core Team Funds

      Description

      See https://issues.civicrm.org/jira/browse/CRM-17313?focusedCommentId=81459&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-81459

      I'm seeing an issue on a 4.4 to 4.6.10 upgrade, with smart groups that specify activity type or status.

      In the example I'm looking at, when checking the criteria for this smart group in the Civi UI, we get:

      in 4.4:
      "Activity Type IN Renew membership request" = activity_type_id 68 - correct;
      Activity Status: Scheduled or Completed - correct (though not shown in qill);

      in 4.6:
      "Activity Type ID In Meeting" = activity_type_id 1 - INCORRECT;
      "Activity Status In 1, 1" - INCORRECT.

      In the 4.4 database, the civicrm_saved_search.form_values field has this excerpt for activity_type_id:

      s:16:"activity_type_id";a:1:{i:68;s:1:"1";}
      

      which unserializes as:

          [activity_type_id] => Array
              (
                  [68] => 1
              )
      

      Nothing in form_values for activity_status.

      civicrm_saved_search.where_clause has this excerpt for activity_type_id:

        civicrm_activity.activity_type_id IN ('68')
      

      with nothing for activity_status.

      In the upgraded 4.6 db, the entries for activity_type_id are unchanged; a new entry has appeared in form_values for activity_status:

      s:15:"activity_status";a:2:{i:1;s:1:"1";i:2;s:1:"1";}
      

      which unserializes as:

          [activity_status] => Array
              (
                  [1] => 1
                  [2] => 1
              )
      

      along with a new entry in where_clause:

      civicrm_activity.status_id IN ('1','2')
      

      If I create a new saved search in 4.6 with criteria "Activity Type IN Renew membership request" and look at what gets created in civicrm_saved_search, the excerpt for activity_type_id in form_values is:

        s:16:"activity_type_id";a:1:{s:2:"IN";a:1:{i:0;s:2:"68";}}
      

      which unserializes as:

          [activity_type_id] => Array
              (
                  [IN] => Array
                      (
                          [0] => 68
                      )
              )
      

      and for activity_status:

      s:18:"activity_status_id";a:1:{s:2:"IN";a:2:{i:0;s:1:"1";i:1;s:1:"2";}}
      

      which unserializes as:

          [activity_status_id] => Array
              (
                  [IN] => Array
                      (
                          [0] => 1
                          [1] => 2
                      )
              )
      

      In terms of the data format change, these changes look similar to the participant_status_id issue described in CRM-16922. From my reading of that issue, the fix there doesn't migrate old smart group data, it works around the presence of old-format data. But it seems not to have helped in the present case.

        Attachments

        1. crm-17546-migrate-smart-groups.php
          2 kB
          Dave Jenkins
        2. fix.php
          2 kB
          Peter Davis

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                davej Dave Jenkins
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: