CRM-734 CRM Contribute does not call drupal hooks when a contribution is "added" in the UI

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.4
    • Labels:
      None

      Description

      CivicContribute does not call the Drupal hook_civicrm_* hooks when generating a transaction via the civicrm/contribute/transact?reset=1&id=1 path in CivicSpace 0.8.3RC3.

      Set up:

      • CivicSpace 0.8.3RC3
      • Paypal Developer sandbox with "Merchant Pro" option.
      • CiviCRM 1.3 (final; as bundled in CS 0.8.3RC3 and later).

      Procedure:

      • Go to civicrm/contribute/transact?reset=1&id=1 (or whatever ID of contribution page you're debugging).
      • Fill in data for a contribution, and press "Continue...".
      • At this point, make sure your debugger is set up, and press "Make Contribution".
      • postProcess() will be called, and the SOAP transaction will run. Eventually, CRM_Contribute_BAO_Contribution::add() will get called, which creates the Contribution record. add() does not call the hooks (CRM_Contribute_BAO_Contribution::create() does, but it is never called). So the transaction completes successfully, the record is created, but Drupal never gets its hooks called.

      Solution likely is to either factor the code so that the we go down some bottleneck that calls the hooks, or to add the hook dispatch to add() as well.

        Attachments

          Activity

          [CRM-734] CRM Contribute does not call drupal hooks when a contribution is "added" in the UI
          Rob Thorne added a comment -

          It appears that create() calls add(), but CRM_Contribute_Form_Contribution_Confirm::postProcess is calling add() directly.

          I'm not sure if substituting create() will work, but I'm looking at it.

          Rob Thorne added a comment -

          I've gotten the hooks to be called. I'm enclosing the actual PHP4 deployed file rather than diff it against SVN, since apparently there's some kind of script that gets run on the PHP5 version to derive the PHP4 tarball.

          My fix works, but I suspect that someone should compare what postProcess() does before and after calling add() with with create() does when it calls add(). They appear to be substatially different.

          CRM-732 must also be fixed before the Drupal hook_civicrm_pre will work as well.

            People

            • Assignee:
              Donald A. Lobo
              Reporter:
              Rob Thorne

              Dates

              • Created:
                Updated:
                Resolved: