r70439 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70438‎ | r70439 | r70440 >
Date:23:37, 3 August 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Updated code to pull correct value for currency conversion and to round amounts with more than 2 decimal places
Modified paths:
  • /civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm.module
@@ -222,11 +222,12 @@
223223 }
224224
225225 watchdog('queue2civicrm', 'Contribution (pre-conversion):<pre>' . check_plain(print_r($msg, TRUE)) . '</pre>');
 226+
 227+ // round the amounts and do exchange rate conversion
 228+ $msg['fee'] = round( exchange_rate_convert($msg['original_currency'], $msg['fee'], $msg['date']), 2 );
 229+ $msg['gross'] = round( exchange_rate_convert($msg['original_currency'], $msg['gross'], $msg['date']), 2 );
 230+ $msg['net'] = round( exchange_rate_convert($msg['original_currency'], $msg['net'], $msg['date']), 2 );
226231
227 - $msg['fee'] = exchange_rate_convert($msg['currency'], $msg['fee'], $msg['date']);
228 - $msg['gross'] = exchange_rate_convert($msg['currency'], $msg['gross'], $msg['date']);
229 - $msg['net'] = exchange_rate_convert($msg['currency'], $msg['net'], $msg['date']);
230 -
231232 $msg['gateway_txn_id'] .= ' ' . time();
232233
233234 //dsm($contribution);
@@ -284,7 +285,7 @@
285286
286287 watchdog( 'queue2civicrm', 'Contribution array for civicrm_contribution_add(): ' . print_r($contribution, TRUE));
287288
288 - $contribution_result = &civicrm_contribution_add( $contribution );
 289+ $contribution_result = civicrm_contribution_add( $contribution );
289290
290291 watchdog( 'queue2civicrm', 'Contribution result from civicrm_contribution_add(): ' . print_r($contribution_result, TRUE));
291292
@@ -322,7 +323,7 @@
323324 $form['queue'] = array(
324325 '#type' => 'textfield',
325326 '#title' => 'Queue to submit to',
326 - '#default_value' => '/queue/test_pending_pfp',
 327+ '#default_value' => '/queue/test_donations',
327328 '#required' => TRUE
328329 );
329330

Status & tagging log