From 9ff0c7a14c08d62bcec9bfe39b4dd970186804eb Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 16 Feb 2015 16:46:24 +1300 Subject: [PATCH] CRM-15978 remove redundant test_mode check --- CRM/Core/Payment.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 8b211b4e42..004e26ab24 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -541,16 +541,11 @@ abstract class CRM_Core_Payment { } self::logPaymentNotification($params); - // Query db for processor .. - $mode = @$params['mode']; - $sql = "SELECT ppt.class_name, ppt.name as processor_name, pp.id AS processor_id FROM civicrm_payment_processor_type ppt INNER JOIN civicrm_payment_processor pp ON pp.payment_processor_type_id = ppt.id - AND pp.is_active - AND pp.is_test = %1"; - $args[1] = array($mode == 'test' ? 1 : 0, 'Integer'); + AND pp.is_active"; if (isset($params['processor_id'])) { $sql .= " WHERE pp.id = %2"; @@ -558,7 +553,9 @@ abstract class CRM_Core_Payment { $notFound = "No active instances of payment processor ID#'{$params['processor_id']}' were found."; } else { - $sql .= " WHERE ppt.name = %2"; + // This is called when processor_name is passed - passing processor_id instead is recommended. + $sql .= " WHERE ppt.name = %2 AND pp.is_test = %1"; + $args[1] = array((CRM_Utils_Array::value('mode', $params) == 'test') ? 1 : 0, 'Integer'); $args[2] = array($params['processor_name'], 'String'); $notFound = "No active instances of the '{$params['processor_name']}' payment processor were found."; } -- 2.25.1