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

CRM_Member_BAO_Membership::deleteMembership() pass complete membership to post hook

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.8
    • Fix Version/s: 4.3.0
    • Component/s: CiviMember
    • Labels:
      None

      Description

      CRM_Member_BAO_Membership::deleteMembership() constructs a sparse membership on line 596, which is later passed on to post hook implementations at line 601. deleteMembership should retrieve and pass the whole membership to the CRM_Utils_Hook::post() call because by the time the hook implementations are invoked the membership has already been deleted from the database and its components (e.g., contact_id) cannot be recovered by the V3 API.

      This bug is causing civicrm_member_roles_civicrm_post() to resync member roles for all contacts when a membership is deleted and the civicrm_member_roles_sync_method == 3. In this case, a missing contact_id field in the passed membership is interpreted as a request to sync all contacts.

      Patch attached.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lobo Donald A. Lobo
                Reporter:
                keith@wellebee.com Keith Morgan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: