Skip to content

Commit

Permalink
Merge pull request #15757 from yashodha/participant_edit
Browse files Browse the repository at this point in the history
(dev/core#1065) Contribution in Edit mode needs to be shown consistently
  • Loading branch information
yashodha authored Nov 8, 2019
2 parents a512cb1 + c1af62c commit 52c1f17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 6 additions & 5 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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');
Expand Down
8 changes: 2 additions & 6 deletions templates/CRM/Contribute/Form/Contribution.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,10 @@
</div>
{if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if}
<table class="form-layout-compressed">
{if $context neq 'standalone'}
<tr>
<td class="font-size12pt label"><strong><strong>{ts}Contributor{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
</tr>
{else}
<tr class="crm-contribution-form-block-contact_id">
<td class="label">{$form.contact_id.label}</td>
<td>{$form.contact_id.html}</td>
{/if}
</tr>
<tr class="crm-contribution-form-block-contribution_type_id crm-contribution-form-block-financial_type_id">
<td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html}&nbsp;
{if $is_test}
Expand Down

0 comments on commit 52c1f17

Please sign in to comment.