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

Advanced search fails to show tagset criteria when editing saved search

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.7
    • Fix Version/s: 4.7.9
    • Component/s: Core CiviCRM
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      This is reproducible on the Drupal 7 demo.

      1. Create a tagset (Favourite marsupial)
      2. Tag a contact (Favourite marsupial = Kangaroo)
      3 Create a smart group using that tagset (Kangaroo appreciators have Kangaroo as their favourite marsupial)
      4, Try to edit the criteria for the smart group and the Favourite marsupial = Kangaroo criterion is lost

      The workaround is to manually add it again and then save, but that's easily forgotten.

      This occurs because while the tagsets are displayed separately to other tags, in the saved search they are all stored together. When retrieved from the saved search, the tagset tags need to be separated again.

      The function that 'normalises' the tags so they are all stored together in the saved search is CRM_Contact_Form_Search_Advanced::normalizeFormValues(). On the form, normal tags are stored in an element named 'contact_tags' while tagset tags are stored in elements named 'contact_taglist[23]' where '23' is the Id of the tagset. normalizeFormValues() converts them all to parameters with name 'contact_tags' (the queries use the IN operator on the tag Ids and don't care if they are tagset tags).

      What's needed is some code that reverses this. I will supply a patch to the function CRM_Contact_Form_Search_Advanced::normalizeDefaultValues() that ...

      1. Does no harm if the $defaults don't need this processing
      2. Looks at each 'contact_tags' default to see if it is a tagset tag
      3. If one if found, moves the 'contact_tags' element to an array like 'contact_taglist[23]'
      4. Cleans up the 'contact_tags' array

        Attachments

          Activity

            People

            • Assignee:
              jitendra.purohit Jitendra Purohit
              Reporter:
              ken Ken West
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h