Index: civicrm/trunk/sites/all/modules/fundcore_civicrm/fundcore_civicrm.module |
— | — | @@ -202,6 +202,11 @@ |
203 | 203 | $contact['last_name'] = $contribution['last_name']; |
204 | 204 | $contact['do_not_trade'] = ($contribution['anonymous'] ? 1 : 0); |
205 | 205 | |
| 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 | + |
206 | 211 | $contact['id'] = civicrm_api_contact_set($contact); |
207 | 212 | |
208 | 213 | //drupal_set_message('Contact ID: ' . $contact['id']); |
— | — | @@ -248,7 +253,13 @@ |
249 | 254 | //drupal_set_message('Pre: <pre>' . check_plain(print_r($contribution, TRUE)) . '</pre>'); |
250 | 255 | //drupal_set_message('Post: <pre>' . check_plain(print_r($civicrm_contribution, TRUE)) . '</pre>'); |
251 | 256 | |
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 | + } |
253 | 264 | |
254 | 265 | civicrm_api_tag_set($contact['id'], 'Review'); |
255 | 266 | } |
Index: civicrm/trunk/sites/all/modules/civicrm_api/civicrm_api.module |
— | — | @@ -91,6 +91,8 @@ |
92 | 92 | } |
93 | 93 | |
94 | 94 | module_invoke_all('civicrm_api_contribution_set', $contribution); |
| 95 | + |
| 96 | + return $contribution; |
95 | 97 | } |
96 | 98 | |
97 | 99 | function civicrm_api_contribution_thank($contribution_id) { |
Index: civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_paypal.module |
— | — | @@ -64,6 +64,8 @@ |
65 | 65 | // Detect if we're using the new-style |
66 | 66 | if (is_numeric($post_data['option_selection1'])) { |
67 | 67 | $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']; |
68 | 70 | $contribution['anonymous'] = $tracking_data['anonymous']; |
69 | 71 | $contribution['comment'] = $tracking_data['note']; |
70 | 72 | } |
Index: civicrm/trunk/sites/all/modules/fundcore/gateways/fundcore_moneybookers.module |
— | — | @@ -52,7 +52,9 @@ |
53 | 53 | // Detect if we're using the new-style |
54 | 54 | if (is_numeric($post_data['os0'])) { |
55 | 55 | $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']; |
56 | 57 | $contribution['anonymous'] = $tracking_data['anonymous']; |
| 58 | + $contribution['optout'] = $tracking_data['optout']; |
57 | 59 | $contribution['comment'] = $tracking_data['note']; |
58 | 60 | } |
59 | 61 | else { |