Added code to display check number on edit payment form

This commit is contained in:
CiviWare Solutions 2018-12-13 13:23:03 +00:00
parent 88c0b0e9a8
commit f71e682614
2 changed files with 29 additions and 0 deletions

View File

@ -209,4 +209,15 @@ function checknumberpaymentmethod_civicrm_buildForm($formName, &$form) {
$form->assign('paymentTypeLabel', ts('Check Information'));
}
}
if ('CRM_Financial_Form_PaymentEdit' == $formName) {
$paymentInstrumentsFromSettings = civicrm_api3('Setting', 'getvalue', [
'name' => 'check_payment_instrument_ids',
]);
$paymentInstrumentsFromSettings[] = (string) CRM_Core_PseudoConstant::getKey(
'CRM_Contribute_BAO_Contribution',
'payment_instrument_id',
'Check'
);
$form->assign('paymentInstrumentsFromSettings', json_encode($paymentInstrumentsFromSettings));
}
}

View File

@ -0,0 +1,18 @@
{literal}
<script type="text/javascript">
CRM.$(function ($) {
var $paymentInstrumentsFromSettings = {/literal}{$paymentInstrumentsFromSettings}{literal};
$('#payment_instrument_id').change(showHidePI);
showHidePI();
function showHidePI() {
var $paymentInstrumentID = $('#payment_instrument_id').val();
if ($.inArray($paymentInstrumentID, $paymentInstrumentsFromSettings) > -1) {
$('div.check_number-section').show();
}
else {
$('div.check_number-section').hide();
}
}
});
</script>
{/literal}