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

pre/post hooks not called when pending contribution updates membership

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.8, 4.1.1
    • Fix Version/s: 4.2.0
    • Component/s: CiviMember
    • Labels:
      None

      Description

      I ran into an issue where the pre/post hooks were not getting called for memberships during renewal. I traced the issue to how we handle the membership update tied to a pending/pay later contribution.

      If we use pending/pay later with a new membership, the membership is constructed (hooks are called) and then the start/end dates are assigned when the contribution status is changed from pending to completed. The same thing happens with renewal, but we don't actually save the membership record when the renewal takes place – we just store values in the membership_log table and then update when the contribution is updated – and consequently, pre/post are not called. But regardless, we really need to be able to access at the contribution update point as that is where the membership is getting saved.

      See attached patch. The weakness of this patch is that the pre hook passes the formattedParams, which is not the full membership record. Not sure if we want to handle that differently.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: