CRM-9422 support pre/post hooks for line items

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.0.8
    • Fix Version/s: 4.1.0
    • Component/s: CiviContribute
    • Labels:
      None

      Description

      currently there's no way to interact with line item records when a contribution is saved via pre/post hooks.
      this is because the contribution post hook is called before the line item is saved.

        Attachments

          Activity

          [CRM-9422] support pre/post hooks for line items
          Brian Shaughnessy added a comment -

          see attached patch.

          two notes about this:

          • pre/post are only triggered on create as we don't support editing line items currently. there are other implementations of this hook with that limitation, so i don't think it's a problem
          • we pass the line item array – as there is no line item object. functionally it achieves the same/similar purpose, but we'll need to footnote the docs to indicate it's not actually an object being passed in this case.
          Brian Shaughnessy added a comment -

          Dave, can you apply the patch and QA

          David Greenberg added a comment -

          Patch applied and tested normal flows ok.

          Brian Shaughnessy added a comment -

          tested, confirmed, and sent you a hook example via email

            People

            • Assignee:
              David Greenberg
              Reporter:
              Brian Shaughnessy

              Dates

              • Created:
                Updated:
                Resolved: