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

          [CRM-6994] Search Builder "IN" operator does not allow space in Membership Type names
          Ashwini Poharkar added a comment -

          Checked in r30361

            People

            • Assignee:
              Ashwini Poharkar
              Reporter:
              jason bertolacci

              Dates

              • Created:
                Updated:
                Resolved: