From 9019f75a25f2c4da9f44875979f56528bf1bc765 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 7 Jun 2021 04:35:52 +0000 Subject: [PATCH] [php8-compat][REF] Fix Case and Custom data tests by adding guards into templates --- templates/CRM/Activity/Form/Activity.tpl | 12 ++++++------ .../CRM/Campaign/Form/addCampaignToComponent.tpl | 2 +- templates/CRM/Custom/Form/CustomData.tpl | 8 ++++++-- templates/CRM/Custom/Form/Edit/CustomField.tpl | 8 ++++---- .../CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl | 2 +- templates/CRM/Form/attachmentjs.tpl | 2 +- templates/CRM/common/formButtons.tpl | 2 +- .../message_templates/case_activity_html.tpl | 4 ++-- .../message_templates/case_activity_subject.tpl | 2 +- .../message_templates/case_activity_text.tpl | 6 +++--- 10 files changed, 26 insertions(+), 22 deletions(-) diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index a6f20a3450..9814055fcd 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -63,7 +63,7 @@ - {if $form.separation} + {if !empty($form.separation)} {$form.separation.label} {$form.separation.html} {help id="separation"} @@ -91,7 +91,7 @@ - {if $activityTypeFile} + {if !empty($activityTypeFile)} {include file="CRM/$crmDir/Form/Activity/$activityTypeFile.tpl"} {/if} @@ -104,7 +104,7 @@ campaignTrClass="crm-activity-form-block-campaign_id"} {* build engagement level CRM-7775 *} - {if $buildEngagementLevel} + {if !empty($buildEngagementLevel)} {$form.engagement_level.label} {$form.engagement_level.html} @@ -151,12 +151,12 @@ {$form.priority_id.label}{$form.priority_id.html} - {if $surveyActivity } + {if !empty($surveyActivity) } {$form.result.label}{$form.result.html} {/if} - {if $form.tag.html} + {if !empty($form.tag.html)} {$form.tag.label} @@ -165,7 +165,7 @@ {/if} - {if $tagsetInfo.activity} + {if !empty($tagsetInfo.activity)} {include file="CRM/common/Tagset.tpl" tagsetType='activity' tableLayout=true} diff --git a/templates/CRM/Campaign/Form/addCampaignToComponent.tpl b/templates/CRM/Campaign/Form/addCampaignToComponent.tpl index 90f7b88172..791817b462 100644 --- a/templates/CRM/Campaign/Form/addCampaignToComponent.tpl +++ b/templates/CRM/Campaign/Form/addCampaignToComponent.tpl @@ -1,6 +1,6 @@ {* add campaigns to various components CRM-7362 *} -{if $campaignContext eq 'componentSearch'} +{if isset($campaignContext) and $campaignContext eq 'componentSearch'} {* add campaign in component search *} diff --git a/templates/CRM/Custom/Form/CustomData.tpl b/templates/CRM/Custom/Form/CustomData.tpl index 8737f0b767..1a624a31a8 100644 --- a/templates/CRM/Custom/Form/CustomData.tpl +++ b/templates/CRM/Custom/Form/CustomData.tpl @@ -8,7 +8,7 @@ +--------------------------------------------------------------------+ *} {* Custom Data form*} -{if $formEdit} +{if !empty($formEdit)} {include file="CRM/Custom/Form/Edit/CustomData.tpl" customDataEntity=''} {else} {foreach from=$groupTree item=cd_edit key=group_id name=custom_sets} @@ -34,7 +34,11 @@ {/if} -
+ {if isset($cgCount)} +
+ {else} +
+ {/if} {/foreach} {/if} diff --git a/templates/CRM/Custom/Form/Edit/CustomField.tpl b/templates/CRM/Custom/Form/Edit/CustomField.tpl index 7d04c4da0a..7acd1de052 100644 --- a/templates/CRM/Custom/Form/Edit/CustomField.tpl +++ b/templates/CRM/Custom/Form/Edit/CustomField.tpl @@ -8,16 +8,16 @@ +--------------------------------------------------------------------+ *} -{if $element.help_pre} +{if !empty($element.help_pre)}   {$element.help_pre} {/if} -{if $element.options_per_line != 0 } +{if isset($element.options_per_line) and $element.options_per_line != 0 } {$formElement.label}{if $element.help_post}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$element.label}{/if} + class="label">{$formElement.label}{if !empty($element.help_post)}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$element.label}{/if} {assign var="count" value="1"} @@ -45,7 +45,7 @@ {else}
{$formElement.label} - {if $element.help_post}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$element.label}{/if} + {if !empty($element.help_post)}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$element.label}{/if} {$formElement.html}  diff --git a/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl b/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl index 8d48983cc5..4c71289d8b 100644 --- a/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl +++ b/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl @@ -7,7 +7,7 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $hasParent || $isRepeatingEntity || $scheduleReminderId} +{if !empty($hasParent) || !empty($isRepeatingEntity) || !empty($scheduleReminderId)} {capture assign='entity_type'}{$recurringEntityType|lower}{/capture}