jenkins-bot has submitted this change and it was merged.
Change subject: Fix audit refund bug from parent patch, clean up
......................................................................
Fix audit refund bug from parent patch, clean up
One logic fix - quit using return value in wmf_audit.
Other cleanup from awight's comments on parent patch
Change-Id: Iab98d33b1835c3ba07563addab6d5ca6e9d188cc
---
M sites/all/modules/globalcollect_audit/globalcollect_audit.module
M sites/all/modules/wmf_audit/BaseAuditProcessor.php
M sites/all/modules/wmf_audit/wmf_audit.module
3 files changed, 14 insertions(+), 35 deletions(-)
Approvals:
Awight: Looks good to me, approved
jenkins-bot: Verified
diff --git a/sites/all/modules/globalcollect_audit/globalcollect_audit.module
b/sites/all/modules/globalcollect_audit/globalcollect_audit.module
index 95aeac9..e14d443 100644
--- a/sites/all/modules/globalcollect_audit/globalcollect_audit.module
+++ b/sites/all/modules/globalcollect_audit/globalcollect_audit.module
@@ -1,7 +1,5 @@
<?php
use SmashPig\Core\Configuration;
-use SmashPig\Core\ConfigurationKeyException;
-use SmashPig\Core\SmashPigException;
define( 'GC_AUDIT_WR1_PARSER_DIR', '/usr/local/src/Wr1Parser/' );
define( 'GC_AUDIT_WR1_FILES_DIR', '/usr/local/src/Wr1_files/' );
@@ -351,19 +349,12 @@
if ( $test_mode ){
$local_found_ids[] = $order_id;
- globalcollect_audit_echo('!');
} else {
- try {
- globalcollect_audit_send_queue_message(
'donations', $missing_txn_message );
- watchdog('globalcollect_audit',
__FUNCTION__ . ': Message sent to queue successfully: ' . print_r(
$missing_txn_message, true ), array(), WATCHDOG_INFO);
- $local_found_ids[] = $order_id;
- globalcollect_audit_echo('!');
- } catch( SmashPigException $ex ) {
- $wd_message = __FUNCTION__ . ': Sending
message to queue failed: ' . print_r( $missing_txn_message, true );
- globalcollect_audit_log_error(
$wd_message, "QUEUE_BAD_SEND", $ex->getMessage() );
- return;
- }
+ globalcollect_audit_send_queue_message(
'donations', $missing_txn_message );
+ watchdog('globalcollect_audit', __FUNCTION__ .
': Message sent to queue successfully: ' . print_r( $missing_txn_message, true
), array(), WATCHDOG_INFO);
+ $local_found_ids[] = $order_id;
}
+ globalcollect_audit_echo('!');
}
globalcollect_audit_echo("\n");
@@ -394,19 +385,12 @@
//but then we have to send the transaction...
if ( $test_mode ){
$local_built_ids[] = $order_id;
- globalcollect_audit_echo('!');
} else {
- try{
- globalcollect_audit_send_queue_message(
'donations', $missing_txn_message );
- watchdog('globalcollect_audit',
__FUNCTION__ . ': Message sent to queue successfully: ' . print_r(
$missing_txn_message, true ), array(), WATCHDOG_INFO);
- $local_built_ids[] = $order_id;
- globalcollect_audit_echo('!');
- } catch( SmashPigException $ex ) {
- $wd_message = __FUNCTION__ . ': Sending
message to queue failed: ' . print_r( $missing_txn_message, true );
- globalcollect_audit_log_error(
$wd_message, "QUEUE_BAD_SEND", $ex->getMessage() );
- return;
- }
+ globalcollect_audit_send_queue_message(
'donations', $missing_txn_message );
+ watchdog('globalcollect_audit', __FUNCTION__ .
': Message sent to queue successfully: ' . print_r( $missing_txn_message, true
), array(), WATCHDOG_INFO);
+ $local_built_ids[] = $order_id;
}
+ globalcollect_audit_echo('!');
}
}
@@ -1066,7 +1050,7 @@
* @staticvar string $available The groomed files that are currently available
* in the logs directory.
* @param array $missing Parsed missing transaction data form the wr1 files
- * @return string
+ * @return string file name, without full path
*/
function globalcollect_audit_get_next_log( $missing ){
static $tried = array();
diff --git a/sites/all/modules/wmf_audit/BaseAuditProcessor.php
b/sites/all/modules/wmf_audit/BaseAuditProcessor.php
index 637f268..2bfe1e7 100644
--- a/sites/all/modules/wmf_audit/BaseAuditProcessor.php
+++ b/sites/all/modules/wmf_audit/BaseAuditProcessor.php
@@ -418,11 +418,9 @@
//check to see if the parent exists. If it
does, normalize and send.
if ( $this->main_transaction_exists_in_civi(
$record ) ) {
$normal = $this->normalize_negative(
$record );
- if ( wmf_audit_send_transaction(
$normal, 'negative' ) ) {
- $neg_count += 1;
- wmf_audit_echo( '!' );
- }
- wmf_audit_echo( 'X' );
+ wmf_audit_send_transaction( $normal,
'negative' );
+ $neg_count += 1;
+ wmf_audit_echo( '!' );
} else {
// Ignore cancels with no parents
because they must have
// been cancelled before reaching Civi.
diff --git a/sites/all/modules/wmf_audit/wmf_audit.module
b/sites/all/modules/wmf_audit/wmf_audit.module
index b6313c4..c1dc9df 100644
--- a/sites/all/modules/wmf_audit/wmf_audit.module
+++ b/sites/all/modules/wmf_audit/wmf_audit.module
@@ -1,7 +1,6 @@
<?php
use SmashPig\Core\Configuration;
-use SmashPig\Core\ConfigurationKeyException;
use SmashPig\Core\Context;
define('WMF_AUDIT_PAYMENTS_LOGS_DIR', '/usr/local/src/logs/');
@@ -376,7 +375,6 @@
* @param array $record An array representing the complete data we want to save
* @param string $type The type of transaction we are. 'main', 'negative',
* 'recurring'... like that.
- * @return boolean true on success, otherwise false
*/
function wmf_audit_send_transaction($record, $type) {
if (wmf_audit_runtime_options('test')) {
@@ -385,10 +383,10 @@
$func = wmf_audit_runtime_options('test_callback');
$func($record, $type);
}
- return true;
+ return;
}
- return wmf_audit_send_queue_message($record, $type);
+ wmf_audit_send_queue_message($record, $type);
}
/**
@@ -396,7 +394,6 @@
* @param array $body An array representing the transaction we're trying to
* send.
* @param string $type The type of transaction. 'main'|'negative'|'recurring'.
- * @return boolean I think this one is always true, whether or not it worked.
* @throws Exception
*/
function wmf_audit_send_queue_message( $body, $type ) {
--
To view, visit https://gerrit.wikimedia.org/r/314421
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iab98d33b1835c3ba07563addab6d5ca6e9d188cc
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits