From c1af62cabc7297bbdd3f9d2ce87a1a35f7a62d86 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 7 Nov 2019 11:42:44 +0530 Subject: [PATCH] (dev/core#1065) Contribution in Edit mode needs to be shown consistently --- CRM/Contribute/Form/Contribution.php | 11 ++++++----- templates/CRM/Contribute/Form/Contribution.tpl | 8 ++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 84edc6a874..ee7780936f 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -368,6 +368,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if ($this->_id) { $this->_contactID = $defaults['contact_id']; } + elseif ($this->_contactID) { + $defaults['contact_id'] = $this->_contactID; + } // Set $newCredit variable in template to control whether link to credit card mode is included. $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()); @@ -621,11 +624,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->assign('customDataSubType', $this->_contributionType); $this->assign('entityID', $this->_id); - if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), [ - 'create' => TRUE, - 'api' => ['extra' => ['email']], - ], TRUE); + $contactField = $this->addEntityRef('contact_id', ts('Contributor'), ['create' => TRUE], TRUE); + if ($this->_context != 'standalone') { + $contactField->freeze(); } $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution'); diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index e1da6b1a91..24ae9deef1 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -74,14 +74,10 @@ {if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if} - {if $context neq 'standalone'} - - - - {else} + - {/if} + {$form.financial_type_id.html}  {if $is_test} -- 2.25.1
{ts}Contributor{/ts}{$displayName}
{$form.contact_id.label} {$form.contact_id.html}
{$form.financial_type_id.label}