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

"IN" operator fails on states in Search Builder

    Details

    • Type: Bug
    • Status: Won't Do
    • Priority: Minor
    • Resolution: Won't Do
    • Affects Version/s: 4.6.11
    • Fix Version/s: lts-possible
    • Component/s: CiviCRM Search
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      To replicate on demo server:

      • Go to Search Builder.
      • Search term is: Contacts - State - Home - IN - <whatever>.

      Get an error that " is not of the type Postive"

      ```
      wu/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(360): CRM_Core_Error::backtrace()
      #1 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Utils/Type.php(271): CRM_Core_Error::fatal(" is not of the type Positive")
      #2 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(5172): CRM_Utils_Type::escape(NULL, "Positive")
      #3 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(1981): CRM_Contact_BAO_Query::buildClause("`Home-address`.state_province_id", "IN", NULL, "Positive")
      #4 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(1847): CRM_Contact_BAO_Query->restWhere((Array:5))
      #5 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(1873): CRM_Contact_BAO_Query->whereClauseSingle((Array:5))
      #6 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(499): CRM_Contact_BAO_Query->whereClause()
      #7 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(461): CRM_Contact_BAO_Query->initialize()
      #8 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/Selector.php(224): CRM_Contact_BAO_Query->__construct((Array:1), (Array:4), NULL, FALSE, FALSE, 1, FALSE, FALSE, FALSE, NULL, (Array:3))
      #9 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/Form/Search.php(833): CRM_Contact_Selector->__construct(NULL, (Array:7), (Array:1), (Array:4), 8192, FALSE, FALSE, "builder", (Array:10))
      #10 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Contact/Form/Search/Builder.php(419): CRM_Contact_Form_Search->postProcess()
      #11 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(345): CRM_Contact_Form_Search_Builder->postProcess()
      #12 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Refresh.php(75): CRM_Core_Form->mainProcess()
      #13 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh->perform(Object(CRM_Contact_Form_Search_Builder), "refresh")
      #14 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Search_Builder), "refresh")
      #15 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("refresh")
      #16 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:4), (Array:0))
      #17 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
      #18 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:4))
      #19 /home/jon/local/nwu/wp-content/plugins/civicrm/civicrm.php(1189): CRM_Core_Invoke::invoke((Array:4))
      #20 [internal function](): CiviCRM_For_WordPress->invoke("")
      #21 /home/jon/local/nwu/wp-includes/plugin.php(496): call_user_func_array((Array:2), (Array:1))
      #22 /home/jon/local/nwu/wp-admin/admin.php(226): do_action("toplevel_page_CiviCRM")
      ```

      Note that there's a different error/backtrace (with a SQL syntax error) if the address type is "Primary" rather than "Home".

      This seems related to CRM-16288 and CRM-16858. To a lesser extent, CRM-17313, but this affects new searches. This does NOT happen on master, which means it might be a lower priority.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              palantejon Jon K Goldberg
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: