Index: civicrm/trunk/sites/all/modules/wmf_owa/wmf_owa.module |
— | — | @@ -52,10 +52,11 @@ |
53 | 53 | */ |
54 | 54 | function wmf_owa_civicrm_post( $op, $objectName, $objectId, &$objectRef ) { |
55 | 55 | // only continue if we're handling an updated contribution |
56 | | - if ( $objectName != 'Contribution' && !in_array( $op, array( 'edit' )) ) { |
| 56 | + if ( $objectName != 'Contribution' || ( $objectName == 'Contribution' && $op != 'edit' ) ) { |
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
| 60 | + watchdog( 'wmf_owa', 'Inside wmf_owa_civicrm_post with op: %op, object name: %obj_name', array( '%op' => $op, '%obj_name' => $objectName ), WATCHDOG_DEBUG ); |
60 | 61 | // load the OWA-specific tracking data |
61 | 62 | $contrib_tracking_data = wmf_owa_get_contribution_tracking_data( $objectId ); |
62 | 63 | if ( !$contrib_tracking_data ) { |
— | — | @@ -80,7 +81,9 @@ |
81 | 82 | * @param $contribution_id |
82 | 83 | */ |
83 | 84 | function wmf_owa_queue2civicrm_import( $contribution_id ) { |
84 | | - // load the OWA-specific tracking data |
| 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 |
85 | 88 | $contrib_tracking_data = wmf_owa_get_contribution_tracking_data( $contribution_id ); |
86 | 89 | if ( !$contrib_tracking_data ) { |
87 | 90 | // log, don't post to OWA |
— | — | @@ -105,7 +108,7 @@ |
106 | 109 | $query_params = wmf_owa_prepare_owa_query( $contrib_tracking_data, (object) $contribution ); |
107 | 110 | |
108 | 111 | // send the query to OWA |
109 | | - wmf_owa_send_tracking( $query_params ); |
| 112 | + wmf_owa_send_tracking( $query_params );*/ |
110 | 113 | return; |
111 | 114 | } |
112 | 115 | |
— | — | @@ -155,7 +158,11 @@ |
156 | 159 | "owa_page_url" => $contrib_tracking_obj->url, |
157 | 160 | "owa_session_id"=> $contrib_tracking_obj->owa_session, |
158 | 161 | ); |
159 | | - |
| 162 | + |
| 163 | + foreach ( $query_params as $key => $value ) { |
| 164 | + if ( !strlen( (string) $value ) ) $query_params[ $key ] = 'none'; |
| 165 | + } |
| 166 | + |
160 | 167 | // log the query params |
161 | 168 | watchdog( 'wmf_owa', |
162 | 169 | 'OWA tracking params for contribution_id %objectId: %query_params', |
— | — | @@ -195,8 +202,10 @@ |
196 | 203 | */ |
197 | 204 | function wmf_owa_send_tracking( $query_params ) { |
198 | 205 | $owa_log_url = variable_get( 'wmf_owa_log', OWA_LOG_DEFAULT ); |
| 206 | + $url_with_request = $owa_log_url . "?" . http_build_query( $query_params, '', '&' ); |
| 207 | + watchdog( 'wmf_owa', 'Full url with request: %url', array( '%url' => $url_with_request ), WATCHDOG_DEBUG ); |
199 | 208 | $ch = curl_init(); |
200 | | - curl_setopt( $ch, CURLOPT_URL, $owa_log_url . "?". http_build_query( $query_params )); |
| 209 | + curl_setopt( $ch, CURLOPT_URL, $url_with_request ); |
201 | 210 | curl_setopt( $ch, CURLOPT_USERAGENT, "WMF Ecommerce web service 1.0" ); |
202 | 211 | curl_setopt( $ch, CURLINFO_HEADER_OUT, true ); // so we can track the request header |
203 | 212 | |
— | — | @@ -218,5 +227,6 @@ |
219 | 228 | WATCHDOG_DEBUG ); |
220 | 229 | |
221 | 230 | curl_close( $ch ); |
| 231 | +// system( "wget --user-agent='WMF Ecommerce web service 1.0' '$url_with_request'" ); |
222 | 232 | return; |
223 | 233 | } |