From 202723aea7b41be780928920c7e7786a48768895 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 10 Feb 2022 14:40:06 -0500 Subject: [PATCH] Fix ContributionRecur.payment_processor_id pseudoconstant Before: Pseudoconstant mistakenly uses 'name' instead of title After: Name and title are treated correctly --- CRM/Contribute/BAO/ContributionRecur.php | 6 +++--- CRM/Contribute/DAO/ContributionRecur.php | 4 ++-- tests/phpunit/CRM/Utils/TokenConsistencyTest.php | 2 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 1 + xml/schema/Contribute/ContributionRecur.xml | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 980782b6a0..3ce962e062 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -1037,8 +1037,8 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) $params = []; switch ($fieldName) { case 'payment_processor_id': - if (isset(\Civi::$statics[__CLASS__]['buildoptions_payment_processor_id'])) { - return \Civi::$statics[__CLASS__]['buildoptions_payment_processor_id']; + if (isset(\Civi::$statics[__CLASS__]['buildoptions_payment_processor_id'][$context])) { + return \Civi::$statics[__CLASS__]['buildoptions_payment_processor_id'][$context]; } $baoName = 'CRM_Contribute_BAO_ContributionRecur'; $params['condition']['test'] = "is_test = 0"; @@ -1057,7 +1057,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) } $allProcessors = $liveProcessors + $testProcessors; ksort($allProcessors); - \Civi::$statics[__CLASS__]['buildoptions_payment_processor_id'] = $allProcessors; + \Civi::$statics[__CLASS__]['buildoptions_payment_processor_id'][$context] = $allProcessors; return $allProcessors; } return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context); diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 9a2a9418ec..830712e5f3 100644 --- a/CRM/Contribute/DAO/ContributionRecur.php +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:fd697cd9f74b697ebc373d3a62526be0) + * (GenCodeChecksum:6d77881ddf63ce2b56752b87c0d37ee8) */ /** @@ -782,7 +782,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'pseudoconstant' => [ 'table' => 'civicrm_payment_processor', 'keyColumn' => 'id', - 'labelColumn' => 'name', + 'labelColumn' => 'title', ], 'add' => '3.3', ], diff --git a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php index 495f27b96e..0f625f4dd7 100644 --- a/tests/phpunit/CRM/Utils/TokenConsistencyTest.php +++ b/tests/phpunit/CRM/Utils/TokenConsistencyTest.php @@ -458,7 +458,7 @@ contribution_recur.frequency_unit:name :year contribution_recur.contribution_status_id:label :Pending Label** contribution_recur.contribution_status_id:name :Pending contribution_recur.payment_processor_id:label :Dummy (test) -contribution_recur.payment_processor_id:name :Dummy (test) +contribution_recur.payment_processor_id:name :Dummy_test contribution_recur.financial_type_id:label :Member Dues contribution_recur.financial_type_id:name :Member Dues contribution_recur.payment_instrument_id:label :Check diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index bf0ca8949b..b680aac7ad 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -891,6 +891,7 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase { $processorParams = [ 'domain_id' => 1, 'name' => 'Dummy', + 'title' => 'Dummy', 'payment_processor_type_id' => 'Dummy', 'financial_account_id' => 12, 'is_test' => TRUE, diff --git a/xml/schema/Contribute/ContributionRecur.xml b/xml/schema/Contribute/ContributionRecur.xml index 10ccc53592..b19292e66a 100644 --- a/xml/schema/Contribute/ContributionRecur.xml +++ b/xml/schema/Contribute/ContributionRecur.xml @@ -359,7 +359,7 @@ civicrm_payment_processor
id - name + title
Select -- 2.25.1