Skip to content

Commit

Permalink
Fix ContributionRecur.payment_processor_id pseudoconstant
Browse files Browse the repository at this point in the history
Before: Pseudoconstant mistakenly uses 'name' instead of title
After: Name and title are treated correctly
  • Loading branch information
colemanw committed Feb 11, 2022
1 parent 488a6ff commit 202723a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions CRM/Contribute/BAO/ContributionRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,8 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) {
$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";
Expand All @@ -1057,7 +1057,7 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) {
}
$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);
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/DAO/ContributionRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:fd697cd9f74b697ebc373d3a62526be0)
* (GenCodeChecksum:6d77881ddf63ce2b56752b87c0d37ee8)
*/

/**
Expand Down Expand Up @@ -782,7 +782,7 @@ public static function &fields() {
'pseudoconstant' => [
'table' => 'civicrm_payment_processor',
'keyColumn' => 'id',
'labelColumn' => 'name',
'labelColumn' => 'title',
],
'add' => '3.3',
],
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Utils/TokenConsistencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ protected function getExpectedContributionRecurTokenOutPut(): string {
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
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ public function processorCreate($params = []) {
$processorParams = [
'domain_id' => 1,
'name' => 'Dummy',
'title' => 'Dummy',
'payment_processor_type_id' => 'Dummy',
'financial_account_id' => 12,
'is_test' => TRUE,
Expand Down
2 changes: 1 addition & 1 deletion xml/schema/Contribute/ContributionRecur.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
<pseudoconstant>
<table>civicrm_payment_processor</table>
<keyColumn>id</keyColumn>
<labelColumn>name</labelColumn>
<labelColumn>title</labelColumn>
</pseudoconstant>
<html>
<type>Select</type>
Expand Down

0 comments on commit 202723a

Please sign in to comment.