diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 84edc6a874e4..ee7780936fec 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -368,6 +368,9 @@ public function setDefaultValues() { 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 @@ public function buildQuickForm() { $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 e1da6b1a9138..24ae9deef1a1 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}
{ts}Contributor{/ts}{$displayName}
{$form.contact_id.label} {$form.contact_id.html}
{$form.financial_type_id.label}