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

Search Builder "IN" operator does not allow space in Membership Type names

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2.3
    • Fix Version/s: 3.3.alpha
    • Component/s: CiviCRM Search
    • Labels:
      None

      Description

      In 3.2.3 Search Builder expects a name not an ID number for Membership Type searches. If you use the "IN" operator the form returns an error if there is a space in the Membership Type name, ie searching for "IN ('Major Donor','Student')" does not validate. Adding a space to the preg_match fixes the problem. Simple patch below.

      CRM/Contact/Form/Search/Builder.php

      — orig 2010-10-26 11:32:31.000000000 -0600
      +++ new 2010-10-26 11:32:31.000000000 -0600
      @@ -228,7 +228,7 @@ class CRM_Contact_Form_Search_Builder ex
      if ( $v[1] == 'IN' ) {
      $inVal = trim( $v[2] );
      //checking for format to avoid db errors

      • if (!preg_match( '/^[(]([A-Za-z0-9\'\,]+)[)]$/', $inVal) ) {
        + if (!preg_match( '/^[(]([A-Za-z0-9\'\, ]+)[)]$/', $inVal) ) { $errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data ( in valid format )."); }

        // Validate each value in parenthesis to avoid db errors

        Attachments

          Activity

            People

            • Assignee:
              ashwini Ashwini Poharkar
              Reporter:
              jbertolacci jason bertolacci
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: