X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FAbstractEditPayment.php;h=0e1868a3ca9cc5767bf13db3ef3f3f726c417a50;hb=b15c60e15126832a4ac00df039a012f81c01dd97;hp=1a9573dd732657e085f4a239517f461b1735522f;hpb=84fcd999ffcace37fa989cece1847868173a7401;p=civicrm-core.git diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 1a9573dd73..0e1868a3ca 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -655,4 +655,36 @@ WHERE contribution_id = {$id} return key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1')); } + /** + * Add the payment processor select to the form. + * + * @param bool $isRequired + * Is it a mandatory field. + * @param bool $isBuildRecurBlock + * True if we want to build recur on change + * @param bool $isBuildAutoRenewBlock + * True if we want to build autorenew on change. + */ + protected function addPaymentProcessorSelect($isRequired, $isBuildRecurBlock = FALSE, $isBuildAutoRenewBlock = FALSE) { + if (!$this->_mode) { + return; + } + $js = ($isBuildRecurBlock ? array('onChange' => "buildRecurBlock( this.value ); return false;") : NULL); + if ($isBuildAutoRenewBlock) { + $js = array('onChange' => "buildAutoRenew( null, this.value, '{$this->_mode}');"); + } + $element = $this->add('select', + 'payment_processor_id', + ts('Payment Processor'), + array_diff_key($this->_processors, array(0 => 1)), + $isRequired, + $js + ); + // The concept of _online is not really explained & the code is old + // @todo figure out & document. + if ($this->_online) { + $element->freeze(); + } + } + }