diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 3f2bcbabdf4c..a6a4ef74b43a 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3510,6 +3510,13 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) { if ($context !== 'validate') { $params['condition'] = "v.name <> 'Template'"; } + break; + + case 'payment_instrument_id': + if (isset($props['filter'])) { + $params['condition'] = "v.filter = " . $props['filter']; + } + break; } return CRM_Core_PseudoConstant::get($className, $fieldName, $params, $context); } diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 314bfaf54040..056f36b5e8f1 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -228,7 +228,7 @@ public function buildQuickForm() { $this->add('select', 'payment_instrument_id', ts('Payment Method'), - ['' => ts('- select -')] + CRM_Contribute_PseudoConstant::paymentInstrument(), + ['' => ts('- select -')] + CRM_Contribute_BAO_Contribution::buildOptions('payment_instrument_id', 'create', ['filter' => 0]), TRUE, ['onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);"] ); diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index b8ef62d7fcbf..b5b584ba4223 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -655,7 +655,7 @@ public function buildQuickForm() { $checkPaymentID = array_search('Check', CRM_Contribute_BAO_Contribution::buildOptions('payment_instrument_id', 'validate')); $paymentInstrument = $this->add('select', 'payment_instrument_id', ts('Payment Method'), - ['' => ts('- select -')] + CRM_Contribute_BAO_Contribution::buildOptions('payment_instrument_id', 'create'), + ['' => ts('- select -')] + CRM_Contribute_BAO_Contribution::buildOptions('payment_instrument_id', 'create', ['filter' => 0]), $required, ['onChange' => "return showHideByValue('payment_instrument_id','{$checkPaymentID}','checkNumber','table-row','select',false);"] ); }