Eileen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/328119 )
Change subject: Rename location_update functions to indicate they are insert. ...................................................................... Rename location_update functions to indicate they are insert. These functions create a duplicate address if called when they should be updating Bug: T152475 Change-Id: I74dc55d5aabb19dd41fb5c7faa3f10c7ca530025 --- M sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php M sites/all/modules/wmf_civicrm/wmf_civicrm.module 2 files changed, 20 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/19/328119/1 diff --git a/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php b/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php index fc28436..0d303a1 100644 --- a/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php +++ b/sites/all/modules/queue2civicrm/recurring/RecurringQueueConsumer.php @@ -525,7 +525,7 @@ $contact = wmf_civicrm_message_contact_update( $msg, $recur_record->contact_id ); // Insert the location record - wmf_civicrm_message_location_update( $msg, $contact ); + wmf_civicrm_message_location_insert( $msg, $contact ); // Tag contact for review wmf_civicrm_tag_contact_for_review( $contact ); diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module b/sites/all/modules/wmf_civicrm/wmf_civicrm.module index 2760412..824e783 100644 --- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module +++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module @@ -1361,24 +1361,20 @@ * @param array $contact */ function wmf_civicrm_message_location_insert( $msg, $contact ) { - wmf_civicrm_message_location_update( $msg, $contact ); + wmf_civicrm_message_email_insert( $msg, $contact[ 'id' ] ); + wmf_civicrm_message_address_insert( $msg, $contact[ 'id' ] ); } /** - * Update the location record + * Updates the email for a contact. * - * Serves as a standard way for message processors to handle location - * updates. + * If updating or unsure use the marginally slower update function. * - * @param array $msg - * @param array $contact + * @param string $msg + * @param int $contact_id + * @throws \WmfException */ -function wmf_civicrm_message_location_update( $msg, $contact ) { - wmf_civicrm_message_email_update( $msg, $contact[ 'id' ] ); - wmf_civicrm_message_address_update( $msg, $contact[ 'id' ] ); -} - -function wmf_civicrm_message_email_update( $msg, $contact_id ) { +function wmf_civicrm_message_email_insert($msg, $contact_id ) { // unset the email address if the default is used // this enables us to properly dedupe contacts later on if( empty( $msg['email'] ) or $msg[ 'email' ] === 'nob...@wikimedia.org' ){ @@ -1402,7 +1398,17 @@ } } -function wmf_civicrm_message_address_update( $msg, $contact_id ) { +/** + * Insert a new address for a contact. + * + * If updating or unsure use the marginally slower update function. + * + * @param array $msg + * @param int $contact_id + * + * @throws \WmfException + */ +function wmf_civicrm_message_address_insert($msg, $contact_id ) { $loc_type_id = wmf_civicrm_get_default_location_type_id(); // We can do these lookups a bit more efficiently than Civi -- To view, visit https://gerrit.wikimedia.org/r/328119 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I74dc55d5aabb19dd41fb5c7faa3f10c7ca530025 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: master Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits