Ensure gender_display is always set
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 10 Nov 2021 20:46:11 +0000 (09:46 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 12 Nov 2021 01:37:33 +0000 (14:37 +1300)
Always add it, rather than checking if it is assiged in the template

CRM/Contact/Page/View/Summary.php
templates/CRM/Contact/Page/Inline/Demographics.tpl

index b28cfcfa4604be09c56ca7250795495b0fcd5c6b..a59de8a3a224e14dccbded430e021b74a1c4ecfa 100644 (file)
@@ -183,9 +183,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
       }
     }
 
-    if (!empty($defaults['gender_id'])) {
-      $defaults['gender_display'] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'gender_id', $defaults['gender_id']);
-    }
+    $defaults['gender_display'] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'gender_id', $defaults['gender_id'] ?? NULL);
 
     $communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id');
     if (!empty($communicationStyle)) {
index e7e2ce5526b39eaf5c12a0fb88f46b021f6edb3c..7951f284cfd295059a94396cdc98ece0df28713e 100644 (file)
@@ -16,7 +16,7 @@
     {/if}
     <div class="crm-summary-row">
       <div class="crm-label">{ts}Gender{/ts}</div>
-      <div class="crm-content crm-contact-gender_display">{if !empty($gender_display)}{$gender_display}{/if}</div>
+      <div class="crm-content crm-contact-gender_display">$gender_display}</div>
     </div>
 
     <div class="crm-summary-row">