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

CIVICRM-233 CiviCRM API - Membership get with join on Contact, filtering on Primary Address returns incorrect results. Primary Address filter is ignored

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Important
    • Resolution: Unresolved
    • Affects Version/s: 4.7.14, 4.7.21, 4.7.22
    • Fix Version/s: None
    • Component/s: CiviCRM API
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      When using the CiviCRM API and Membership get with join on Contact, filtering on Primary Address returns incorrect results. Primary Address filter is ignored.

      This bug is similar to CRM-20870 which has a PR submitted.

      Example 1. Contact ID 3413 has a membership but no Primary Address. This contact is returned in the result set for a query where the Primary Address, Country is "Australia". However, since the Country is not set the Contact should not be returned at all.

      Example 2. Contact ID 3400 has a membership and a Primary Address, Country of "Australia". This contact is returned in the result set for a query where the Primary Address, Country is "United Kingdom". Contact is returned for the wrong Country.

      Example 3. Contact ID 3401 has a membership and a Primary Address, Country of "United Kingdom" and a State of "Bristol, City of". This contact is returned in the result set for a query where the Primary Address, Country is "Australia". Contact is returned for the wrong Country and State.

      Example API query for Membership and Contact's Primary Address, Country:

      $result = civicrm_api3('Membership', 'get', array(
        'sequential' => 1,
        'contact_id.country_id' => 1013,
      ));
      

      Example API query for Membership and Contact's Primary Address, State:

      $result = civicrm_api3('Membership', 'get', array(
        'sequential' => 1,
        'contact_id.state_province_id' => 2622,
      ));
      

      Agileware Ref CIVICRM-233

        Attachments

          Activity

            People

            • Assignee:
              agileware Agileware
              Reporter:
              agileware Agileware
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: