Ejegg has submitted this change and it was merged.

Change subject: Remove old email edit hook
......................................................................


Remove old email edit hook

No need for it if I37b1f5dbd660 works out and we can get 'em from
changelogs!

Bug: T122411
Change-Id: I706e6c6c21bc74d6630bb27e447f04f77db1a308
---
M sites/all/modules/wmf_communication/wmf_communication.module
1 file changed, 0 insertions(+), 53 deletions(-)

Approvals:
  Awight: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/wmf_communication/wmf_communication.module 
b/sites/all/modules/wmf_communication/wmf_communication.module
index bdfd6c4..9066755 100644
--- a/sites/all/modules/wmf_communication/wmf_communication.module
+++ b/sites/all/modules/wmf_communication/wmf_communication.module
@@ -107,56 +107,3 @@
        $importer = new SilverpopImporter($options);
        return $importer->import($days);
 }
-
-/**
- * Implements hook_civicrm_pre
- * When an active email address is edited or deleted, re-add it as 'On Hold'
- * to make sure it is exported on the suppression list.
- * If the email address being deleted is already 'On Hold', let it be deleted.
- * @param string $op operation just performed
- * @param string $type type of object on which operation was performed
- * @param int $id object identifier
- * @param CRM_Core_DAO_Email $email new email object.
- */
-function wmf_communication_civicrm_pre( $op, $type, $id, &$email ) {
-       // only work with Emails, and only when we have an object reference
-       if ( $type !== 'Email' || $email === null ) {
-               return;
-       }
-       // ignore on_hold status changes
-       if ( isset($email['on_hold']) && $email['on_hold'] !== 'null' ) {
-               return;
-       }
-       if ( $op !== 'edit' && $op !== 'delete' ) {
-               return;
-       }
-       // get the old values
-       $old_email_result = civicrm_api( "Email", "get",
-               array (
-                       'version' =>'3',
-                       'id' => $email['id'],
-                       'return' => 'email,on_hold'
-               )
-       );
-       // bail out if we can't find the old values
-       if ( !array_key_exists( $email['id'], $old_email_result['values'] ) ) {
-               return;
-       }
-       $old_email = $old_email_result['values'][$email['id']];
-       // if we're editing, but not the address, bail out
-       if ( $op === 'edit' && $old_email['email'] === $email['email'] ) {
-               return;
-       }
-       // if we're deleting an email that's already on hold, stop here
-       if ( $op === 'delete' && !empty( $old_email['on_hold'] ) ) {
-               return;
-       }
-       $params = array(
-               'version' => 3,
-               'email' => $old_email['email'],
-               'on_hold' => TRUE,
-               'hold_date' => date('YmdHis'),
-               'contact_id' => $email['contact_id'],
-       );
-       $new_email_result = civicrm_api( "Email", "create", $params );
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/289716
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I706e6c6c21bc74d6630bb27e447f04f77db1a308
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to