Skip to content

Commit

Permalink
CIWEMB-538:
Browse files Browse the repository at this point in the history
Support creating payment methods that can be hidden from user


Applying PR civicrm#28876
  • Loading branch information
olayiwola-compucorp committed Mar 8, 2024
1 parent 40ccbbb commit b501c1b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/AdditionalPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);"]
);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);"]
);
}
Expand Down

0 comments on commit b501c1b

Please sign in to comment.