CRM-18155 Membership type smart group stops working in 4.6.13/4.6.14

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.13, 4.6.14
    • Fix Version/s: None
    • Component/s: CiviCRM Search
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      After upgrading from 4.6.12 to 4.6.14 I found that a smart group contained no contacts. I tracked it down to legacyConvertFormValues() in CRM/Contact/BAO/Query.php and commenting out the call of this function from convertFormValues() fixed it.

      Editing the smart group search group criteria finds the right contacts but they are lost when the smart group is updated. One of the membership type ids was 1 which meant that it was reformatted/selected in the call to formatArrayKeys().

      When editing, the $values array looked like this and was untouched:
      Array ( [IN] => Array ( [0] => 5 [1] => 3 [2] => 1 [3] => 4 ) )

      When saving the smart group, $values looked like this:
      Array ( [0] => 5 [1] => 3 [2] => 1 [3] => 4 )
      and so was converted to:
      Array ( [0] => 2 )

      Sorry, I don't know enough to be able to handle the pre-4.6 case properly while not knackering the valid 4.6 case.

      This issue may well affect 4.7 as well.

        Attachments

          Issue Links

            Activity

            [CRM-18155] Membership type smart group stops working in 4.6.13/4.6.14
            Seamus Lee added a comment -

            Looks like it was added in CRM-17313 i think membership types and status were already fixed up tagging in @eileen

            Monish Deb added a comment -

            Tested and merged

            Chris Cant added a comment -

            Thanks very much - that fix works for me.

            Agileware added a comment -

            Fix for this broke a bunch of Pre-4.6 smart groups on at least one site. Not sure this is the correct solution.

            Gunnar Mathisen added a comment -

            This fix broke all my smart groups that made searched based on membership status. I think the problem is that membership_type_id and membership_status_id has only been removed from legacyConvertFormValues in CRM/Contact/BAO/Query.php, but has been left in place in CRM/Contact/BAO/SavedSearch.php (lines 11-112). If I remove those two lines, my smart groups start working again.

            The same might be the case for contact_type, group, contact_tags which was removed from Query.php earlier, but left in place in SavedSearch.php, although I haven't noticed any problems on my site because of this.

            Dave Jenkins added a comment -

            See CRM-18435: Membership type smart group (from < 4.6) stops working in 4.6.15 .

              People

              • Assignee:
                Monish Deb
                Reporter:
                Chris Cant

                Dates

                • Created:
                  Updated:
                  Resolved: