Ejegg has submitted this change and it was merged.
Change subject: Fix thank_you to not use ported 4.2 custom api
......................................................................
Fix thank_you to not use ported 4.2 custom api
T117143
Change-Id: I0b5df043ef99353ac60ea0f1a1401f698767ba87
---
M sites/all/modules/thank_you/thank_you.module
1 file changed, 23 insertions(+), 13 deletions(-)
Approvals:
Ejegg: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/sites/all/modules/thank_you/thank_you.module
b/sites/all/modules/thank_you/thank_you.module
index 0d42e19..428d352 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -28,7 +28,7 @@
function thank_you_menu() {
$items = array();
-
+
$items['admin/config/thank_you'] = array(
'title' => 'Thank you settings',
'access arguments' => array('administer thank you'),
@@ -314,17 +314,6 @@
$currency = $contribution['currency'];
}
- $tags = civicrm_api3( 'EntityTag', 'getdetails', array(
- 'entity_table' => 'civicrm_contribution',
- 'entity_id' => $contribution_id
- ));
- $tag_names = array_values(
- array_map(
- function( $el ) { return $el['tag_name']; },
- $tags['values']
- )
- );
-
$is_recurring = false;
try {
$transaction = WmfTransaction::from_unique_id(
$contribution['trxn_id'] );
@@ -354,7 +343,7 @@
'recurring' => $is_recurring,
'transaction_id' => "CNTCT-{$contact['id']}",
'unsubscribe_link' => build_unsub_link( $contribution['id'],
$contact['email'], $locale ),
- 'contribution_tags' => $tag_names,
+ 'contribution_tags' => wmf_thank_you_get_tag_names($contribution_id),
);
$success = thank_you_send_mail( $params );
@@ -368,6 +357,27 @@
}
}
+/**
+ * Get entity tag names.
+ *
+ * @param int $entity_id
+ * @return array
+ * @throws \CiviCRM_API3_Exception
+ */
+function wmf_thank_you_get_tag_names($entity_id) {
+ $entityTags = civicrm_api3('EntityTag', 'get', array(
+ // Hard code entity table for now.
+ 'entity_table' => 'civicrm_contribution',
+ 'entity_id' => $entity_id
+ ));
+ $tags = civicrm_api3('EntityTag', 'getoptions', array('field' => 'tag_id'));
+ $tag_names = array();
+ foreach ($entityTags['values'] as $id => $entityTag) {
+ $tag_names[] = $tags['values'][$entityTag['tag_id']];
+ }
+ return $tag_names;
+}
+
function thank_you_update_ty_date( $contribution ) {
$params = array(
--
To view, visit https://gerrit.wikimedia.org/r/250492
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0b5df043ef99353ac60ea0f1a1401f698767ba87
Gerrit-PatchSet: 1
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: Eileen <[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