r75814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75813‎ | r75814 | r75815 >
Date:18:56, 1 November 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
removed implementation of queue2civicrm_import as its not necessary with the post contribution hook; updated post contribution hook implementation to force-load a contribution object because civicrm doesnt always properly pass the full object when the hook is called
Modified paths:
  • /civicrm/trunk/sites/all/modules/wmf_owa/wmf_owa.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/wmf_owa/wmf_owa.module
@@ -65,51 +65,17 @@
6666 return;
6767 }
6868
69 - $query_params = wmf_owa_prepare_owa_query( $contrib_tracking_data, $objectRef );
70 -
71 - // send the query to OWA
72 - wmf_owa_send_tracking( $query_params );
73 - return;
74 -
75 -}
76 -
77 -/**
78 - * Hook implementation of queue2civicrm_import
79 - *
80 - * This gets called when queue2civicrm has completed importing a trxn
81 - * from the queueing service.
82 - * @param $contribution_id
83 - */
84 -function wmf_owa_queue2civicrm_import( $contribution_id ) {
85 -
86 -//commenting this out for now because the contribution gets 'edited' when the thank you is sent
87 -/* // load the OWA-specific tracking data
88 - $contrib_tracking_data = wmf_owa_get_contribution_tracking_data( $contribution_id );
89 - if ( !$contrib_tracking_data ) {
90 - // log, don't post to OWA
91 - watchdog( 'wmf_owa', 'Could not load tracking data for contribution_id %objectId ', array( '%objectId' => $objectId ), WATCHDOG_WARNING );
92 - return;
93 - }
94 -
95 - watchdog( 'wmf_owa', 'preparing toinitialize civicrm' );
96 -
97 - // load the contribution object
98 - civicrm_initialize(true);
99 - watchdog( 'wmf_owa', 'civicrm initialized' );
100 - require_once 'api/v2/Contribute.php';
101 - $params = array( 'contribution_id' => $contribution_id );
 69+ // we'll prepare the contribution object ourselves because for some reason sometimes $objectRef isn't fully populated...
 70+ $params = array( 'contribution_id' => $objectId );
10271 watchdog( 'wmf_owa', 'civi contribution_get params: %params', array( '%params' => print_r( $params, true )), WATCHDOG_DEBUG );
10372 $contribution =& civicrm_contribution_get( $params );
10473
105 - watchdog( 'wmf_owa', 'contribution array: %array', array( '%array' => print_r( $contribution, true )), WATCHDOG_DEBUG );
106 - watchdog( 'wmf_owa', 'contribution object: %object', array( '%object' => print_r( (object) $contribution, true )), WATCHDOG_DEBUG );
107 -
108 - // note that we cast the contribution as an object so wmf_owa_prepare_owa_query can work with it correctly
10974 $query_params = wmf_owa_prepare_owa_query( $contrib_tracking_data, (object) $contribution );
11075
11176 // send the query to OWA
112 - wmf_owa_send_tracking( $query_params );*/
 77+ wmf_owa_send_tracking( $query_params );
11378 return;
 79+
11480 }
11581
11682 /**
@@ -227,6 +193,5 @@
228194 WATCHDOG_DEBUG );
229195
230196 curl_close( $ch );
231 -// system( "wget --user-agent='WMF Ecommerce web service 1.0' '$url_with_request'" );
232197 return;
233198 }

Status & tagging log