Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374915 )

Change subject: TY mailer: skip extra queries to look up custom fields
......................................................................

TY mailer: skip extra queries to look up custom fields

Turns out we already have them from the civicrm_api call at the
top. We just need to map the names over.

Change-Id: Idf77f9cdf7022c8e2faaf5d1eb318026f32e6205
---
M sites/all/modules/thank_you/thank_you.module
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/15/374915/1

diff --git a/sites/all/modules/thank_you/thank_you.module 
b/sites/all/modules/thank_you/thank_you.module
index 9ee8255..5051b68 100644
--- a/sites/all/modules/thank_you/thank_you.module
+++ b/sites/all/modules/thank_you/thank_you.module
@@ -234,7 +234,7 @@
  * TODO: rewrite the civi api stuff to work like other code
  */
 function thank_you_for_contribution( $contribution_id ) {
-       civicrm_initialize( true );
+       civicrm_initialize();
        $contribution = civicrm_api("Contribution","get",
                array (
                          'version' =>'3',
@@ -298,11 +298,16 @@
         return false;
     }
 
-    $custom_values = wmf_civicrm_get_custom_values( $contribution_id, array(
+    $custom_fields = array(
         'no_thank_you',
         'original_amount',
-        'original_currency',
-    ) );
+        'original_currency'
+    );
+    $custom_values = array();
+    foreach ( $custom_fields as $field ) {
+        $mapped = wmf_civicrm_get_custom_field_name( $field );
+        $custom_values[$field] = $contribution[$mapped];
+    }
 
     if ( $custom_values['no_thank_you'] ) {
         watchdog('thank_you', "Contribution has been marked 
no_thank_you={$custom_values['no_thank_you']}, skipping.", array(), 
WATCHDOG_INFO);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf77f9cdf7022c8e2faaf5d1eb318026f32e6205
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <ej...@ejegg.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to