r80602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80601‎ | r80602 | r80603 >
Date:00:07, 20 January 2011
Author:awjrichards
Status:deferred
Tags:
Comment:
Updated trxn id handling to prepend 'recurring' to the internal id for recurring payments; Updated 'next_sched_payment' handling to only happen on payment/eot trxns, using interval/unit values from subscription record
Modified paths:
  • /civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc (modified) (history)
  • /civicrm/trunk/sites/all/modules/queue2civicrm/recurring/recurring.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -263,7 +263,7 @@
264264 $queue2civicrm_dbs = _queue2civicrm_get_dbs();
265265 $queue2civicrm_dbs->use_civicrm();
266266 $query = "UPDATE {civicrm_contribution_recur} SET next_sched_contribution='%s'";
267 - db_query( $query, date('Y-m-d H:i:s', strtotime( "+" . $msg[ 'frequency_interval' ] . " " . $msg[ 'frequency_unit' ], $msg[ 'payment_date' ] )));
 267+ db_query( $query, date('Y-m-d H:i:s', strtotime( "+" . $recur_record->frequency_interval . " " . $recur_record->frequency_unit, $msg[ 'payment_date' ] )));
268268 $queue2civicrm_dbs->use_default();
269269
270270 // construct an array of useful info to invocations of queue2civicrm_import
@@ -350,9 +350,8 @@
351351 installments,
352352 start_date,
353353 create_date,
354 - trxn_id,
355 - next_sched_contribution )
356 - VALUES ( %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s' )";
 354+ trxn_id )
 355+ VALUES ( %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )";
357356
358357 $queue2civicrm_dbs = _queue2civicrm_get_dbs();
359358 $queue2civicrm_dbs->use_civicrm();
@@ -365,7 +364,6 @@
366365 date( 'Y-m-d H:i:s', $msg[ 'start_date' ] ),
367366 date( 'Y-m-d H:i:s', $msg[ 'create_date' ] ),
368367 $msg[ 'subscr_id' ],
369 - date( 'Y-m-d H:i:s', strtotime( "+" . $msg[ 'frequency_interval' ] . " " . $msg[ 'frequency_unit' ], $msg[ 'start_date' ] ))
370368 );
371369 $queue2civicrm_dbs->use_default();
372370
@@ -474,7 +472,7 @@
475473 $msg[ 'frequency_unit' ],
476474 $msg[ 'frequency_interval' ],
477475 date( 'Y-m-d H:i:s', $msg[ 'modified_date' ] ),
478 - date( 'Y-m-d H:i:s', strtotime( "+" . $msg[ 'frequency_interval' ] . " " . $msg[ 'frequency_unit' ], $msg[ 'start_date' ] )),
 476+ date( 'Y-m-d H:i:s', strtotime( "+" . $recur_record->frequency_interval . " " . $recur_record->frequency_unit, $msg[ 'start_date' ] )),
479477 $msg[ 'subscr_id' ]
480478 );
481479 $queue2civicrm_dbs->use_default();
Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm_common.inc
@@ -250,6 +250,11 @@
251251 function _queue2civicrm_contribution_insert( $msg, $contact, $recur_id=NULL ) {
252252 require_once 'api/v2/Contribute.php';
253253
 254+ $trxn_id = strtoupper( $msg[ 'gateway' ] . ' ' . $msg[ 'gateway_txn_id' ] );
 255+ if ( $recur_id ) {
 256+ $trxn_id = 'RECURRING ' . $trxn_id;
 257+ }
 258+
254259 // Insert the contribution record
255260 $contribution = array(
256261 'contact_id' => $contact[ 'contact_id' ],
@@ -258,7 +263,7 @@
259264 'payment_instrument_id' => 6, // contribution @fixme see above
260265 'fee_amount' => $msg['fee'],
261266 'net_amount' => $msg['net'],
262 - 'trxn_id' => strtoupper($msg['gateway']) . ' ' . $msg['gateway_txn_id'],
 267+ 'trxn_id' => $trxn_id,
263268 'receive_date' => date('Y-m-d H:i:s', $msg['date']),
264269 'currency' => 'USD',
265270 'source' => $msg['original_currency'] . ' ' . $msg['original_gross'],

Status & tagging log