CRM-9562 Fire pre and post hooks for trash and restore of contacts

    Details

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

      Description

      Problems:
      1. Currently no hook is fired when restoring a contact from trash.
      2. Also, the 'delete' operation is passed to pre and post hooks at two different times: when moving a contact to trash, AND when permanently deleting a trashed contact.

      Proposed solutions:
      1. This patch addresses item 1 by adding 'trash' and 'restore' operations for pre and post hooks.
      2. This doesn't attempt to address item 2; a more complete solution will be – I suggest – to stop firing the hooks with 'delete' operation when sending contact to trash, and only use that op when permanently deleting the contact; but this raises backwards-compatibility concerns, so I'm not trying to address it here. So with this patch, these hooks are still called with 'delete' op upon trashing a contact, but now they're also called with the 'trash' op at that time.

        Attachments

          Activity

          [CRM-9562] Fire pre and post hooks for trash and restore of contacts
          Allen Shaw added a comment -

          Previous patch was passing the Contact DAO object as 4th param in call to the pre hook, whereas the pre hook is expecting an array here. Now passing CRM_Core_DAO::$_nullArray

          Donald A. Lobo added a comment -

          Allen:

          Can you please update the wiki docs with these two new operations

          Allen Shaw added a comment -

          4.1 documentation has been updated.

          James Strain added a comment -

          Created a new issue to start to look at resolving the second issue raised here:
          https://issues.civicrm.org/jira/browse/CRM-15868

            People

            • Assignee:
              Donald A. Lobo
              Reporter:
              Allen Shaw

              Dates

              • Created:
                Updated:
                Resolved: