r43159 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43158‎ | r43159 | r43160 >
Date:22:11, 3 November 2008
Author:straussd
Status:old
Tags:
Comment:
Respect opt-out settings and map tracking data to CiviCRM contributions.
Modified paths:
  • /civicrm/trunk/sites/all/modules/civicrm_api/civicrm_api.module (modified) (history)
  • /civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_moneybookers.module (modified) (history)
  • /civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_paypal.module (modified) (history)
  • /civicrm/trunk/sites/all/modules/fundcore_civicrm/fundcore_civicrm.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/fundcore_civicrm/fundcore_civicrm.module
@@ -202,6 +202,11 @@
203203 $contact['last_name'] = $contribution['last_name'];
204204 $contact['do_not_trade'] = ($contribution['anonymous'] ? 1 : 0);
205205
 206+ // Honor the new opt-out checkbox, if present
 207+ if (array_key_exists('optout', $contribution)) {
 208+ $contact['is_opt_out'] = $contribution['optout'];
 209+ }
 210+
206211 $contact['id'] = civicrm_api_contact_set($contact);
207212
208213 //drupal_set_message('Contact ID: ' . $contact['id']);
@@ -248,7 +253,13 @@
249254 //drupal_set_message('Pre: <pre>' . check_plain(print_r($contribution, TRUE)) . '</pre>');
250255 //drupal_set_message('Post: <pre>' . check_plain(print_r($civicrm_contribution, TRUE)) . '</pre>');
251256
252 - civicrm_api_contribution_set($civicrm_contribution);
 257+ $civicrm_contribution = civicrm_api_contribution_set($civicrm_contribution);
 258+
 259+ // Map the tracking record to the CiviCRM contribution
 260+ if (array_key_exists('contribution_tracking_id', $contribution)) {
 261+ db_query('UPDATE {contribution_tracking} SET contribution_id = %d WHERE id = %d', $civicrm_contribution['id'], $contribution['contribution_tracking_id']);
 262+ $contact['is_opt_out'] = $contribution['optout'];
 263+ }
253264
254265 civicrm_api_tag_set($contact['id'], 'Review');
255266 }
Index: civicrm/trunk/sites/all/modules/civicrm_api/civicrm_api.module
@@ -91,6 +91,8 @@
9292 }
9393
9494 module_invoke_all('civicrm_api_contribution_set', $contribution);
 95+
 96+ return $contribution;
9597 }
9698
9799 function civicrm_api_contribution_thank($contribution_id) {
Index: civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_paypal.module
@@ -64,6 +64,8 @@
6565 // Detect if we're using the new-style
6666 if (is_numeric($post_data['option_selection1'])) {
6767 $tracking_data = db_fetch_array(db_query('SELECT * FROM {contribution_tracking} WHERE id = %d', $post_data['option_selection1']));
 68+ $contribution['contribution_tracking_id'] = $post_data['option_selection1'];
 69+ $contribution['optout'] = $tracking_data['optout'];
6870 $contribution['anonymous'] = $tracking_data['anonymous'];
6971 $contribution['comment'] = $tracking_data['note'];
7072 }
Index: civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_moneybookers.module
@@ -52,7 +52,9 @@
5353 // Detect if we're using the new-style
5454 if (is_numeric($post_data['os0'])) {
5555 $tracking_data = db_fetch_array(db_query('SELECT * FROM {contribution_tracking} WHERE id = %d', $post_data['os0']));
 56+ $contribution['contribution_tracking_id'] = $post_data['os0'];
5657 $contribution['anonymous'] = $tracking_data['anonymous'];
 58+ $contribution['optout'] = $tracking_data['optout'];
5759 $contribution['comment'] = $tracking_data['note'];
5860 }
5961 else {

Status & tagging log