[php8-compact] Add in guards into various templates to fix the CRM_Contact_Form_Indiv...
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 11 Jun 2021 11:54:21 +0000 (11:54 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 11 Jun 2021 21:18:58 +0000 (21:18 +0000)
templates/CRM/Contact/Form/Contact.tpl
templates/CRM/Contact/Form/Edit/Address.tpl
templates/CRM/Contact/Form/Edit/Individual.tpl
templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl
templates/CRM/Custom/Form/Edit/CustomData.tpl
templates/CRM/common/CMSPrint.tpl
templates/CRM/common/TabHeader.tpl
templates/CRM/common/additionalBlocks.tpl

index 2844d09e35a4d6fff615ab8af8534c0dd86eb6d5..336eb5190e258b5f272731a7f3d0c11597bccaef 100644 (file)
@@ -67,7 +67,7 @@
 
           {*add dupe buttons *}
           {$form._qf_Contact_refresh_dedupe.html}
-          {if $isDuplicate}
+          {if !empty($isDuplicate)}
             &nbsp;&nbsp;
             {$form._qf_Contact_upload_duplicate.html}
           {/if}
         subTypeValues = null;
       }
       else if (!subTypeValues) {
-        subTypeValues = {/literal}"{$paramSubType}"{literal};
+        subTypeValues = {/literal}{if isset($paramSubType)}"{$paramSubType}"{else}""{/if}{literal};
       }
       function loadNextRecord(i, groupValue, groupCount) {
         if (i < groupCount) {
index f83b4cb7bfb7a54a4416551e81a7c9b82b595e1e..3c4fc4df1c5d222b48a0773d90228a2cd0eb8975 100644 (file)
@@ -22,7 +22,7 @@
  <div id="Address_Block_{$blockId}" {if $className eq 'CRM_Contact_Form_Contact'} class="boxBlock crm-edit-address-block crm-address_{$blockId}"{/if}>
   {if $blockId gt 1}<fieldset><legend>{ts}Supplemental Address{/ts}</legend>{/if}
   <table class="form-layout-compressed crm-edit-address-form">
-     {if $masterAddress.$blockId gt 0 }
+     {if isset($masterAddress) && $masterAddress.$blockId gt 0 }
         <tr><td><div class="message status">{icon icon="fa-info-circle"}{/icon} {ts 1=$masterAddress.$blockId}This address is shared with %1 contact record(s). Modifying this address will automatically update the shared address for these contacts.{/ts}</div></td></tr>
      {/if}
 
index 06ff81636cab9d4d292bad9f7ea501056bedb173..5139e05ee1fec672d07c681c9bc4026840473300 100644 (file)
@@ -26,7 +26,7 @@ CRM.$(function($) {
       {$form.prefix_id.html}
     </td>
     {/if}
-    {if $form.formal_title}
+    {if !empty($form.formal_title)}
     <td>
       {$form.formal_title.label}<br/>
       {$form.formal_title.html}
@@ -50,7 +50,7 @@ CRM.$(function($) {
       {$form.last_name.html}
     </td>
     {/if}
-    {if $form.suffix_id}
+    {if !empty($form.suffix_id)}
     <td>
       {$form.suffix_id.label}<br/>
       {$form.suffix_id.html}
index 130277ac01d2e780a69a586325b787a9e67502ff..deb5e374c5ee3584d8b1e7417651cf91d9ae3ccd 100644 (file)
   <div class="crm-accordion-header">{$title}</div>
   <div class="crm-accordion-body" id="tagGroup">
 {/if}
-    <table class="form-layout-compressed{if $context EQ 'profile'} crm-profile-tagsandgroups{/if}">
+    <table class="form-layout-compressed{if isset($context) && $context EQ 'profile'} crm-profile-tagsandgroups{/if}">
       <tr>
-        {if !$type || $type eq 'tag'}
+        {if empty($type) || $type eq 'tag'}
           <td>
             <div class="crm-section tag-section">
-              {if $title}{$form.tag.label}<br>{/if}
+              {if !empty($title)}{$form.tag.label}<br>{/if}
               {$form.tag.html}
             </div>
-            {if $context NEQ 'profile'}
+            {if !isset($context) || $context NEQ 'profile'}
               {include file="CRM/common/Tagset.tpl"}
             {/if}
           </td>
         {/if}
-        {if !$type || $type eq 'group'}
+        {if empty($type) || $type eq 'group'}
           <td>
-            {if $groupElementType eq 'select'}
+            {if isset($groupElementType) && $groupElementType eq 'select'}
               <div class="crm-section group-section">
-              {if $title}{$form.group.label}<br>{/if}
+              {if !empty($title)}{$form.group.label}<br>{/if}
               {$form.group.html}
             </div>
             {else}
-              {foreach key=key item=item from=$tagGroup.group}
-                <div class="group-wrapper">
-                  {$form.group.$key.html}
-                  {if $item.description}
-                    <div class="description">{$item.description}</div>
-                  {/if}
-                </div>
-              {/foreach}
+              {if isset($form.group)} 
+                {foreach key=key item=item from=$tagGroup.group}
+                  <div class="group-wrapper">
+                    {$form.group.$key.html}
+                      {if $item.description}
+                      <div class="description">{$item.description}</div>
+                    {/if}
+                  </div>
+                {/foreach}
+              {/if}
             {/if}
           </td>
         {/if}
index 8228791b3cfef327dd804e1c0be0ef950f5d1f88..c73d98453e0815b851638f19343f2e7992d2c621 100644 (file)
@@ -1,4 +1,4 @@
-{if !$isSingleRecordEdit && $cd_edit.is_multiple eq 1 and $cd_edit.table_id and $contactId and !$skipTitle and $cd_edit.style eq 'Inline'}
+{if empty($isSingleRecordEdit) && $cd_edit.is_multiple eq 1 and $cd_edit.table_id and $contactId and !$skipTitle and $cd_edit.style eq 'Inline'}
   {assign var=tableID value=$cd_edit.table_id}
   <a href="#" class="crm-hover-button crm-custom-value-del" title="{ts 1=$cd_edit.title}Delete %1{/ts}"
      data-post='{ldelim}"valueID": "{$tableID}", "groupID": "{$group_id}", "contactId": "{$contactId}", "key": "{crmKey name='civicrm/ajax/customvalue'}"{rdelim}'>
@@ -9,7 +9,7 @@
 {if $cd_edit.help_pre}
   <div class="messages help">{$cd_edit.help_pre}</div>
 {/if}
-<table {if !$isSingleRecordEdit}class="form-layout-compressed"{/if}>
+<table {if empty($isSingleRecordEdit)}class="form-layout-compressed"{/if}>
   {foreach from=$cd_edit.fields item=element key=field_id}
     {if $customDataEntity && $blockId}
       {* custom data entity combined with blockId tells us we have an entity with mutliple blocks
@@ -25,7 +25,7 @@
 </table>
 <div class="spacer"></div>
 {if $cd_edit.help_post}<div class="messages help">{$cd_edit.help_post}</div>{/if}
-{if !$isSingleRecordEdit && $cd_edit.is_multiple and ( ( $cd_edit.max_multiple eq '' )  or ( $cd_edit.max_multiple > 0 and $cd_edit.max_multiple > $cgCount ) ) }
+{if empty($isSingleRecordEdit) && $cd_edit.is_multiple and ( ( $cd_edit.max_multiple eq '' )  or ( $cd_edit.max_multiple > 0 and $cd_edit.max_multiple > $cgCount ) ) }
   {if $skipTitle}
     {* We don't yet support adding new records in inline-edit forms *}
     <div class="messages help">
index 33e55d1636d03b9fde848b372c5c4abf219a083c..919869faf336f04a30e028d1ec05f0a4b57152ce 100644 (file)
@@ -26,7 +26,7 @@
 
 {if !empty($pageTitle)}
   <div class="crm-title">
-    <h1 class="title">{if $isDeleted}<del>{/if}{$pageTitle}{if $isDeleted}</del>{/if}</h1>
+    <h1 class="title">{if !empty($isDeleted)}<del>{/if}{$pageTitle}{if !empty($isDeleted)}</del>{/if}</h1>
   </div>
 {/if}
 
index c2e54d9b8aadd6256a875672004bc6e72f3da7d6..c969794196fe9b258c5c8c0d99df2c6871e6a844 100644 (file)
@@ -13,7 +13,7 @@
     <div id="mainTabContainer">
     <ul>
        {foreach from=$tabHeader key=tabName item=tabValue}
-          <li id="tab_{$tabName}" class="crm-tab-button ui-corner-all{if !$tabValue.valid} disabled{/if}{if isset($tabValue.class)} {$tabValue.class}{/if}" {$tabValue.extra}>
+          <li id="tab_{$tabName}" class="crm-tab-button ui-corner-all{if !$tabValue.valid} disabled{/if}{if isset($tabValue.class)} {$tabValue.class}{/if}" {if isset($tabValue.extra)}{$tabValue.extra}{/if}>
           {if $tabValue.active}
              <a href="{if !empty($tabValue.template)}#panel_{$tabName}{else}{$tabValue.link}{/if}" title="{$tabValue.title|escape}{if !$tabValue.valid} ({ts}disabled{/ts}){/if}">
                {if !empty($tabValue.icon)}<i class="{$tabValue.icon}"></i>{/if}
index 6bcec6e855d62cd1335d1ef35048c32857dc102f..54e5b667265df14d601516117a2be886e0f2a541 100644 (file)
@@ -19,7 +19,7 @@ CRM.$(function($) {
         {/foreach}
     {/if}
 
-    {if $loadShowHideAddressFields}
+    {if !empty($loadShowHideAddressFields)}
         {foreach from=$showHideAddressFields key="blockId" item="fieldName"}
            processAddressFields( '{$fieldName}', '{$blockId}', 0 );
         {/foreach}