From ac0ef1dc0e997cfbd9817f2b3fd0c95f492b7bd2 Mon Sep 17 00:00:00 2001 From: yashodha Date: Mon, 30 Sep 2019 16:53:58 +0530 Subject: [PATCH] (dev/core#1065) Member in Edit mode needs to be shown consistently --- CRM/Member/Form/Membership.php | 13 ++++++++----- templates/CRM/Member/Form/Membership.tpl | 12 ++++-------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index bdc9c86110..51df038519 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -337,6 +337,11 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } } } + else { + if ($this->_contactID) { + $defaults['contact_id'] = $this->_contactID; + } + } //set Soft Credit Type to Gift by default $scTypes = CRM_Core_OptionGroup::values("soft_credit_type"); @@ -493,11 +498,9 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { return; } - if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), [ - 'create' => TRUE, - 'api' => ['extra' => ['email']], - ], TRUE); + $contactField = $this->addEntityRef('contact_id', ts('Contact'), ['create' => TRUE, 'api' => ['extra' => ['email']]], TRUE); + if ($this->_context != 'standalone') { + $contactField->freeze(); } $selOrgMemType[0][0] = $selMemTypeOrg[0] = ts('- select -'); diff --git a/templates/CRM/Member/Form/Membership.tpl b/templates/CRM/Member/Form/Membership.tpl index c8d2cd5439..d16dbfa406 100644 --- a/templates/CRM/Member/Form/Membership.tpl +++ b/templates/CRM/Member/Form/Membership.tpl @@ -83,14 +83,10 @@ {else} - {if $context neq 'standalone'} - - - - {else} - - - {/if} + + + +
{ts}Member{/ts}{$displayName}
{$form.contact_id.label}{$form.contact_id.html}
{$form.contact_id.label}{$form.contact_id.html}
{$form.membership_type_id.label} {$form.membership_type_id.html} -- 2.25.1