(dev/core#1065) Member in Edit mode needs to be shown consistently
authoryashodha <yashodha@cividesk.com>
Mon, 30 Sep 2019 11:23:58 +0000 (16:53 +0530)
committeryashodha <yashodha@cividesk.com>
Mon, 30 Sep 2019 11:23:58 +0000 (16:53 +0530)
CRM/Member/Form/Membership.php
templates/CRM/Member/Form/Membership.tpl

index bdc9c861101e8bcdd05d732aed3365902efd38a6..51df03851910787e4e50ee1d1843a67635acc3c6 100644 (file)
@@ -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 -');
index c8d2cd54394d9a66226380d0b065ac255c06d539..d16dbfa40665b8946da00b98b176058de12a1e04 100644 (file)
     </div>
     {else}
       <table class="form-layout-compressed">
-        {if $context neq 'standalone'}
-          <tr>
-            <td class="font-size12pt label"><strong>{ts}Member{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
-          </tr>
-        {else}
-          <td class="label">{$form.contact_id.label}</td>
-          <td>{$form.contact_id.html}</td>
-        {/if}
+        <tr class="crm-membership-form-contact-id">
+           <td class="label">{$form.contact_id.label}</td>
+           <td>{$form.contact_id.html}</td>
+        </tr>
         <tr class="crm-membership-form-block-membership_type_id">
           <td class="label">{$form.membership_type_id.label}</td>
           <td><span id='mem_type_id'>{$form.membership_type_id.html}</span>