From e2e6000201c834aeeb9ce2bd1c69c9123a4ac670 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 11 Jun 2021 11:54:21 +0000 Subject: [PATCH] [php8-compact] Add in guards into various templates to fix the CRM_Contact_Form_IndividualTest suite --- templates/CRM/Contact/Form/Contact.tpl | 4 +-- templates/CRM/Contact/Form/Edit/Address.tpl | 2 +- .../CRM/Contact/Form/Edit/Individual.tpl | 4 +-- .../CRM/Contact/Form/Edit/TagsAndGroups.tpl | 32 ++++++++++--------- templates/CRM/Custom/Form/Edit/CustomData.tpl | 6 ++-- templates/CRM/common/CMSPrint.tpl | 2 +- templates/CRM/common/TabHeader.tpl | 2 +- templates/CRM/common/additionalBlocks.tpl | 2 +- 8 files changed, 28 insertions(+), 26 deletions(-) diff --git a/templates/CRM/Contact/Form/Contact.tpl b/templates/CRM/Contact/Form/Contact.tpl index 2844d09e35..336eb5190e 100644 --- a/templates/CRM/Contact/Form/Contact.tpl +++ b/templates/CRM/Contact/Form/Contact.tpl @@ -67,7 +67,7 @@ {*add dupe buttons *} {$form._qf_Contact_refresh_dedupe.html} - {if $isDuplicate} + {if !empty($isDuplicate)}    {$form._qf_Contact_upload_duplicate.html} {/if} @@ -185,7 +185,7 @@ 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) { diff --git a/templates/CRM/Contact/Form/Edit/Address.tpl b/templates/CRM/Contact/Form/Edit/Address.tpl index f83b4cb7bf..3c4fc4df1c 100644 --- a/templates/CRM/Contact/Form/Edit/Address.tpl +++ b/templates/CRM/Contact/Form/Edit/Address.tpl @@ -22,7 +22,7 @@
{if $blockId gt 1}
{ts}Supplemental Address{/ts}{/if} - {if $masterAddress.$blockId gt 0 } + {if isset($masterAddress) && $masterAddress.$blockId gt 0 } {/if} diff --git a/templates/CRM/Contact/Form/Edit/Individual.tpl b/templates/CRM/Contact/Form/Edit/Individual.tpl index 06ff81636c..5139e05ee1 100644 --- a/templates/CRM/Contact/Form/Edit/Individual.tpl +++ b/templates/CRM/Contact/Form/Edit/Individual.tpl @@ -26,7 +26,7 @@ CRM.$(function($) { {$form.prefix_id.html} {/if} - {if $form.formal_title} + {if !empty($form.formal_title)} {/if} - {if $form.suffix_id} + {if !empty($form.suffix_id)}
{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}
{$form.formal_title.label}
{$form.formal_title.html} @@ -50,7 +50,7 @@ CRM.$(function($) { {$form.last_name.html}
{$form.suffix_id.label}
{$form.suffix_id.html} diff --git a/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl b/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl index 130277ac01..deb5e374c5 100644 --- a/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl +++ b/templates/CRM/Contact/Form/Edit/TagsAndGroups.tpl @@ -12,35 +12,37 @@
{$title}
{/if} - +
- {if !$type || $type eq 'tag'} + {if empty($type) || $type eq 'tag'} {/if} - {if !$type || $type eq 'group'} + {if empty($type) || $type eq 'group'} {/if} diff --git a/templates/CRM/Custom/Form/Edit/CustomData.tpl b/templates/CRM/Custom/Form/Edit/CustomData.tpl index 8228791b3c..c73d98453e 100644 --- a/templates/CRM/Custom/Form/Edit/CustomData.tpl +++ b/templates/CRM/Custom/Form/Edit/CustomData.tpl @@ -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} @@ -9,7 +9,7 @@ {if $cd_edit.help_pre}
{$cd_edit.help_pre}
{/if} -
- {if $title}{$form.tag.label}
{/if} + {if !empty($title)}{$form.tag.label}
{/if} {$form.tag.html}
- {if $context NEQ 'profile'} + {if !isset($context) || $context NEQ 'profile'} {include file="CRM/common/Tagset.tpl"} {/if}
- {if $groupElementType eq 'select'} + {if isset($groupElementType) && $groupElementType eq 'select'}
- {if $title}{$form.group.label}
{/if} + {if !empty($title)}{$form.group.label}
{/if} {$form.group.html}
{else} - {foreach key=key item=item from=$tagGroup.group} -
- {$form.group.$key.html} - {if $item.description} -
{$item.description}
- {/if} -
- {/foreach} + {if isset($form.group)} + {foreach key=key item=item from=$tagGroup.group} +
+ {$form.group.$key.html} + {if $item.description} +
{$item.description}
+ {/if} +
+ {/foreach} + {/if} {/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 @@
{if $cd_edit.help_post}
{$cd_edit.help_post}
{/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 *}