r75023 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75022‎ | r75023 | r75024 >
Date:18:30, 19 October 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Added OWA insertion funtion for tracking
Modified paths:
  • /civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm.module
@@ -89,6 +89,13 @@
9090 '#required' => TRUE,
9191 '#default_value' => variable_get('queue2civicrm_subscription', '/queue/test'),
9292 );
 93+
 94+ $form['queue2civicrm_OWA_log'] = array(
 95+ '#type' => 'textfield',
 96+ '#title' => t('OWA log path'),
 97+ '#required' => TRUE,
 98+ '#default_value' => variable_get('queue2civicrm_OWA_log', 'http://analytics.tesla.usability.wikimedia.org/wiki/d/extensions/owa/log.php'),
 99+ );
93100
94101 $form['queue2civicrm_batch'] = array(
95102 '#type' => 'select',
@@ -248,8 +255,8 @@
249256 'contact_type' => 'Individual',
250257 'first_name' => $msg['first_name'],
251258 'middle_name' => $msg['middle_name'],
252 - 'last_name' => $msg['last_name'],
253 - 'do_not_trade' => ($msg['anonymous'] ? 1 : 0 ),
 259+ 'last_name' => $msg['last_name'],
 260+ 'do_not_trade' => ($msg['anonymous'] ? 1 : 0 ),
254261 'contact_source' => 'online donation'
255262 );
256263 // Honor the opt-out checkbox, if present
@@ -346,9 +353,45 @@
347354 'contact_id' => $contact['id']
348355 );
349356 $tag_result = &civicrm_entity_tag_add( $tag );
 357+ if(defined(OWA)){
 358+ queue2civicrm_record_OWA_contribution($msg);
 359+ }
 360+
350361 return TRUE;
 362+
351363 }
352364
 365+function queue2civicrm_record_OWA_contribution($msg){
 366+ //NEED:
 367+ //utm_campaign
 368+ //referer URL
 369+ //owa_session_id
 370+ //OWA log URL
 371+
 372+ $query_params = array(
 373+ "owa_event_type" => "ecommerce.transaction",
 374+ "owa_ct_order_id" => $msg[ 'contribution_tracking_id' ],
 375+ "owa_ct_order_source" => $data['utm_campaign'],
 376+ "owa_ct_total" => $msg['gross'],
 377+ "owa_ct_tax" => 0,
 378+ "owa_ct_shipping" => 0,
 379+ "owa_ct_gateway" => $msg['gateway'],
 380+ "owa_page_url" => $encodedReqURL,
 381+ //ct_line_items[li_product_name]=foo&
 382+ "owa_session_id"=> "some_id"
 383+ );
 384+
 385+ //$owa_log_url = "http://analytics.tesla.usability.wikimedia.org/wiki/d/extensions/owa/log.php";
 386+ $owa_log_url = variable_get('queue2civicrm_OWA_log', 'http://analytics.tesla.usability.wikimedia.org/wiki/d/extensions/owa/log.php');
 387+ $ch = curl_init();
 388+ curl_setopt($ch, CURLOPT_URL, $owa_log_url . "?". http_build_query($query_params));
 389+ curl_setopt($ch, CURLOPT_USERAGENT, "WMF Ecommerce web service 1.0");
 390+ curl_exec($ch);
 391+ curl_close($ch);
 392+}
 393+
 394+
 395+
353396 /**
354397 * Make the form to insert a test message into the queue
355398 */

Status & tagging log