Fix ContributionRecur.payment_processor_id pseudoconstant
authorColeman Watts <coleman@civicrm.org>
Thu, 10 Feb 2022 19:40:06 +0000 (14:40 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 11 Feb 2022 00:36:05 +0000 (19:36 -0500)
Before: Pseudoconstant mistakenly uses 'name' instead of title
After: Name and title are treated correctly

CRM/Contribute/BAO/ContributionRecur.php
CRM/Contribute/DAO/ContributionRecur.php
tests/phpunit/CRM/Utils/TokenConsistencyTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
xml/schema/Contribute/ContributionRecur.xml

index 980782b6a071266c7728148df335abb49858c3ce..3ce962e062f912a92c1d3f0a33f000a93c34ad8b 100644 (file)
@@ -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);
index 9a2a9418eca13eebec5b612b3e1ee8d50c12ab32..830712e5f3e1d629722847ef001c13cd802a0462 100644 (file)
@@ -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',
         ],
index 495f27b96e8be6979b75c1f382ba4913ca1bc2a6..0f625f4dd7993d91b22d265bf033b52618291979 100644 (file)
@@ -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
index bf0ca8949bb2ed5b4df3c851e46c70ea998d2b62..b680aac7adebffce831df3d2c29c6c255caa9706 100644 (file)
@@ -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,
index 10ccc535920a9ecb613fd846e3db759e52c1add4..b19292e66a13245b1622262c415baff33b70f4ce 100644 (file)
     <pseudoconstant>
       <table>civicrm_payment_processor</table>
       <keyColumn>id</keyColumn>
-      <labelColumn>name</labelColumn>
+      <labelColumn>title</labelColumn>
     </pseudoconstant>
     <html>
       <type>Select</type>