From c485e792baa92911aa68bf84135b9fd5c5400c77 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 2 Mar 2018 16:15:28 +1300 Subject: [PATCH] CRM-20610 make it possible to enable the payment form --- CRM/Contribute/Form/Contribution.php | 5 ++++- CRM/Financial/Form/PaymentEdit.php | 2 +- templates/CRM/Contribute/Form/Contribution.tpl | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 535cfc4c4e..1a3ac14f9a 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -237,6 +237,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // Get the contribution id if update $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); if (!empty($this->_id)) { + $this->assignPaymentInfoBlock(); $this->assign('contribID', $this->_id); } @@ -627,11 +628,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $paymentInstrument = FALSE; if (!$this->_mode) { + // payment_instrument isn't required in edit and will not be present when payment block is enabled. + $required = $this->_id ? FALSE : TRUE; $checkPaymentID = array_search('Check', CRM_Contribute_PseudoConstant::paymentInstrument('name')); $paymentInstrument = $this->add('select', 'payment_instrument_id', ts('Payment Method'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), - TRUE, array('onChange' => "return showHideByValue('payment_instrument_id','{$checkPaymentID}','checkNumber','table-row','select',false);") + $required, array('onChange' => "return showHideByValue('payment_instrument_id','{$checkPaymentID}','checkNumber','table-row','select',false);") ); } diff --git a/CRM/Financial/Form/PaymentEdit.php b/CRM/Financial/Form/PaymentEdit.php index 84f0a0d0de..1a439aa03b 100644 --- a/CRM/Financial/Form/PaymentEdit.php +++ b/CRM/Financial/Form/PaymentEdit.php @@ -71,7 +71,7 @@ class CRM_Financial_Form_PaymentEdit extends CRM_Core_Form { $this->_values = civicrm_api3('FinancialTrxn', 'getsingle', array('id' => $this->_id)); if (!empty($this->_values['payment_processor_id'])) { - CRM_Core_Error::statusBounce(ts('You cannot update this payment')); + CRM_Core_Error::statusBounce(ts('You cannot update this payment as it is tied to a payment processor')); } } diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 78b55f37a6..9f47e46eae 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -161,7 +161,7 @@ {if $contribution_status_id eq 2}{if $is_pay_later }: {ts}Pay Later{/ts} {else}: {ts}Incomplete Transaction{/ts}{/if}{/if} - {if $contactId && $contribID && $contributionMode EQ null && $contribution_status_id eq 2} + {if !$isUsePaymentBlock && $contactId && $contribID && $contributionMode EQ null && $contribution_status_id eq 2} {capture assign=payNowLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=update&id=`$contribID`&cid=`$contactId`&context=`$context`&mode=live"}{/capture} » {ts}Pay with Credit Card{/ts} {/if} @@ -249,6 +249,9 @@ {ts}Payment Details{/ts} + {if $isUsePaymentBlock} + {include file="CRM/Contribute/Form/PaymentInfoBlock.tpl"} + {else} @@ -260,10 +263,13 @@
{$form.payment_instrument_id.label}{$form.trxn_id.html} {help id="id-trans_id"}
+ {/if} {/if} - {include file='CRM/Core/BillingBlockWrapper.tpl'} + {if !$isUsePaymentBlock} + {include file='CRM/Core/BillingBlockWrapper.tpl'} + {/if} {if !$payNow} -- 2.25.1