Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -355,6 +355,9 @@ |
356 | 356 | private function fnPayflowProcessTransaction( $data, $payflow_data ) { |
357 | 357 | global $wgOut, $wgDonationTestingMode, $wgPayflowGatewayUseHTTPProxy, $wgPayflowGatewayHTTPProxy; |
358 | 358 | |
| 359 | + // update contribution tracking |
| 360 | + $this->updateContributionTracking( $data ); |
| 361 | + |
359 | 362 | // create payflow query string, include string lengths |
360 | 363 | $queryArray = array( |
361 | 364 | 'TRXTYPE' => $payflow_data['trxtype'], |
— | — | @@ -892,7 +895,7 @@ |
893 | 896 | 'language' => $wgRequest->getText( 'language' ), |
894 | 897 | 'comment' => $wgRequest->getText( 'comment' ), |
895 | 898 | 'anonymous' => $wgRequest->getText( 'comment-option' ), |
896 | | - 'optout' => $wgRequest->getText( 'email' ), |
| 899 | + 'optout' => $wgRequest->getText( 'email-opt' ), |
897 | 900 | 'test_string' => $wgRequest->getText( 'process' ), //for showing payflow string during testing |
898 | 901 | 'token' => $token, |
899 | 902 | 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ), |
— | — | @@ -961,4 +964,52 @@ |
962 | 965 | |
963 | 966 | return implode( ".", $source_parts ); |
964 | 967 | } |
| 968 | + |
| 969 | + public function updateContributionTracking( $data ) { |
| 970 | + /** |
| 971 | + * if we're not coming from the regular cc form, fix optout/anonymous |
| 972 | + * |
| 973 | + * @fixme This is a bad hack being pushed out for a time-sensitive update |
| 974 | + * and this will only work as expected for a particular configuartion/usecase |
| 975 | + * Overall this is fine, but the $data['optout'] and $data['anonymous'] |
| 976 | + * handling is... bad. |
| 977 | + */ |
| 978 | + $fix_optouts = false; |
| 979 | + $source_parts = explode(".", $data[ 'utm_source' ] ); |
| 980 | + foreach ( $source_parts as $value ) { |
| 981 | + if ( preg_match( "/cc[0-9]/", $value )) { |
| 982 | + $fix_optouts = true; |
| 983 | + } |
| 984 | + } |
| 985 | + if ( !$fix_optouts ) { |
| 986 | + return; |
| 987 | + } |
| 988 | + |
| 989 | + $data['optout'] = ($data['optout'] == "1") ? '0' : '1'; |
| 990 | + $data['anonymous'] = ($data['anonymous'] == "1") ? '0' : '1'; |
| 991 | + |
| 992 | + $db = payflowGatewayConnection(); |
| 993 | + |
| 994 | + if (!$db) { return true ; } |
| 995 | + |
| 996 | + $tracked_contribution = array( |
| 997 | + 'note' => $data['comment'], |
| 998 | + 'referrer' => $data['referrer'], |
| 999 | + 'anonymous' => $data['anonymous'], |
| 1000 | + 'utm_source' => $data['utm_source'], |
| 1001 | + 'utm_medium' => $data['utm_medium'], |
| 1002 | + 'utm_campaign' => $data['utm_campaign'], |
| 1003 | + 'optout' => $data['optout'], |
| 1004 | + 'language' => $data['language'], |
| 1005 | + ); |
| 1006 | + |
| 1007 | + // Make all empty strings NULL |
| 1008 | + foreach ($tracked_contribution as $key => $value) { |
| 1009 | + if ($value === '') { |
| 1010 | + $tracked_contribution[$key] = null; |
| 1011 | + } |
| 1012 | + } |
| 1013 | + |
| 1014 | + $db->update( 'contribution_tracking', $tracked_contribution, array( 'id' => $data[ 'contribution_tracking_id' ] )); |
| 1015 | + } |
965 | 1016 | } // end class |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php |
— | — | @@ -69,8 +69,8 @@ |
70 | 70 | |
71 | 71 | // email agreement |
72 | 72 | $form .= '<tr>'; |
73 | | - $form .= '<td>' . Xml::check( 'opt', TRUE ) . '</td>'; |
74 | | - $form .= '<td>' . Xml::label( wfMsg( 'donate_interface-email-agreement' ), 'opt' ) . '</td>'; |
| 73 | + $form .= '<td>' . Xml::check( 'email-opt', TRUE ) . '</td>'; |
| 74 | + $form .= '<td>' . Xml::label( wfMsg( 'donate_interface-email-agreement' ), 'email-opt' ) . '</td>'; |
75 | 75 | $form .= '</tr>'; |
76 | 76 | |
77 | 77 | $form .= Xml::closeElement( 'table' ); |
Index: trunk/extensions/DonationInterface/donate_interface/donate_interface.php |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | Xml::checkLabel( wfMsg( 'donate_interface-anon-message' ), 'comment-option', 'input_comment-option', TRUE ) . |
194 | 194 | Xml::closeElement( 'div' ) . |
195 | 195 | Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' )) . |
196 | | - Xml::check( 'email', TRUE ) . |
| 196 | + Xml::check( 'email-opt', TRUE ) . |
197 | 197 | Xml::tags( 'span', array( 'class' => 'mw-email-agreement' ), wfMsg( 'donate_interface-email-agreement' )) . |
198 | 198 | Xml::closeElement( 'div' ); |
199 | 199 | |