From 9e0c477b94be6dcd81567f833f50b8a446eef29b Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 7 Jul 2021 09:44:22 -0400 Subject: [PATCH] Fix undefined tpl vars in CiviReport --- templates/CRM/Report/Form.tpl | 2 +- templates/CRM/Report/Form/Actions.tpl | 10 +++++----- templates/CRM/Report/Form/Criteria.tpl | 4 ++-- templates/CRM/Report/Form/ErrorMessage.tpl | 2 +- templates/CRM/Report/Form/Fields.tpl | 10 +++++----- .../CRM/Report/Form/Grant/Statistics.tpl | 2 +- templates/CRM/Report/Form/Layout/Table.tpl | 6 +++--- templates/CRM/Report/Form/Statistics.tpl | 8 ++++---- .../CRM/Report/Form/Tabs/FieldSelection.tpl | 4 ++-- templates/CRM/Report/Form/Tabs/Filters.tpl | 19 +++++++++++-------- templates/CRM/Report/Form/Tabs/Instance.tpl | 6 +++++- templates/CRM/Report/Page/InstanceList.tpl | 12 ++++++------ templates/CRM/Report/Page/TemplateList.tpl | 2 +- 13 files changed, 47 insertions(+), 40 deletions(-) diff --git a/templates/CRM/Report/Form.tpl b/templates/CRM/Report/Form.tpl index 3ceffb9aa5..db27dbab83 100644 --- a/templates/CRM/Report/Form.tpl +++ b/templates/CRM/Report/Form.tpl @@ -49,7 +49,7 @@ {include file="CRM/Report/Form/ErrorMessage.tpl"} {/if} -{if $outputMode == 'print'} +{if !empty($outputMode) && $outputMode == 'print'} diff --git a/templates/CRM/Report/Form/Actions.tpl b/templates/CRM/Report/Form/Actions.tpl index 34690c1d91..b16ec62fcc 100644 --- a/templates/CRM/Report/Form/Actions.tpl +++ b/templates/CRM/Report/Form/Actions.tpl @@ -7,7 +7,7 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if !$printOnly} {* NO print section starts *} +{if empty($printOnly)} {* NO print section starts *} {* build the print pdf buttons *}
@@ -19,7 +19,7 @@ {include file="CRM/common/tasks.tpl" location="botton"} - {if $instanceUrl} + {if !empty($instanceUrl)} {/if} @@ -27,13 +27,13 @@ - - {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName=$fieldName hideRelativeLabel=1, from='_from' to='_to'} + + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName=$fieldName hideRelativeLabel=1 from='_from' to='_to'} {elseif $form.$fieldOp.html} - - + + {/if} {/foreach} - {if $filterGroups.$tableName.group_title} + {if !empty($filterGroups.$tableName.group_title)}
   {ts}Existing report(s) from this template{/ts}
- {if $chartSupported} + {if !empty($chartSupported)} {/if} - {if $form.groups} + {if !empty($form.groups)} {/foreach} diff --git a/templates/CRM/Report/Form/Statistics.tpl b/templates/CRM/Report/Form/Statistics.tpl index 001bf37035..f94e32db41 100644 --- a/templates/CRM/Report/Form/Statistics.tpl +++ b/templates/CRM/Report/Form/Statistics.tpl @@ -8,13 +8,13 @@ +--------------------------------------------------------------------+ *} {if !empty($top)} - {if $printOnly} + {if !empty($printOnly)}

{$reportTitle}

-
{$reportDate}
+
{if !empty($reportDate)}{$reportDate}{/if}
{/if} - {if $statistics} + {if !empty($statistics)}
{$form.charts.html|crmAddClass:big} {$form.$chart.html}
{$form.groups.html}{$form.$group.html} @@ -71,7 +71,7 @@ // Disable print/pdf output of charts $('select[name=charts]', 'form.crm-report-form').change(function() { var viewType = $(this).val(), - flashChartType = '{/literal}{if $chartType}{$chartType}{else}{/if}{literal}'; + flashChartType = '{/literal}{if !empty($chartType)}{$chartType}{else}{/if}{literal}'; $('#_qf_Summary_submit_pdf, #_qf_Summary_submit_print').prop('disabled', (viewType && flashChartType != viewType)); }); }); diff --git a/templates/CRM/Report/Form/Criteria.tpl b/templates/CRM/Report/Form/Criteria.tpl index b9bd520fa2..edea85861b 100644 --- a/templates/CRM/Report/Form/Criteria.tpl +++ b/templates/CRM/Report/Form/Criteria.tpl @@ -24,7 +24,7 @@ {foreach from=$table item=field key=fieldName} {literal}var val = "dnc";{/literal} {assign var=fieldOp value=$fieldName|cat:"_op"} - {if !($field.operatorType & 4) && !$field.no_display && $form.$fieldOp.html} + {if !(!empty($field.operatorType) && $field.operatorType & 4) && empty($field.no_display) && !empty($form.$fieldOp.html)} {literal}var val = document.getElementById("{/literal}{$fieldOp}{literal}").value;{/literal} {/if} {literal}showHideMaxMinVal( "{/literal}{$fieldName}{literal}", val );{/literal} @@ -52,7 +52,7 @@ $('.crm-report-criteria-groupby input:checkbox').click(function() { $('#fields_' + this.id.substr(10)).prop('checked', this.checked); }); - {/literal}{if $displayToggleGroupByFields}{literal} + {/literal}{if !empty($displayToggleGroupByFields)}{literal} $('.crm-report-criteria-field input:checkbox').click(function() { $('#group_bys_' + this.id.substr(7)).prop('checked', this.checked); }); diff --git a/templates/CRM/Report/Form/ErrorMessage.tpl b/templates/CRM/Report/Form/ErrorMessage.tpl index 800544e8ed..6d05a8caec 100644 --- a/templates/CRM/Report/Form/ErrorMessage.tpl +++ b/templates/CRM/Report/Form/ErrorMessage.tpl @@ -7,7 +7,7 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $outputMode eq 'html' && !$rows} +{if !empty($outputMode) && $outputMode eq 'html' && empty($rows)}
{icon icon="fa-info-circle"}{/icon} {ts}None found.{/ts}
diff --git a/templates/CRM/Report/Form/Fields.tpl b/templates/CRM/Report/Form/Fields.tpl index b19f550ea5..cbac1c0b3b 100644 --- a/templates/CRM/Report/Form/Fields.tpl +++ b/templates/CRM/Report/Form/Fields.tpl @@ -7,8 +7,8 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if !$printOnly} {* NO print section starts *} - {if $criteriaForm} +{if empty($printOnly)} {* NO print section starts *} + {if !empty($criteriaForm)}
{* criteria section starts *}
{*tab navigation bar*} @@ -18,7 +18,7 @@ {$tab.title} {/foreach} - {if $instanceForm OR $instanceFormError} + {if !empty($instanceForm) OR !empty($instanceFormError)}
  • {ts}Title and Format{/ts}
  • @@ -35,7 +35,7 @@ {include file="CRM/Report/Form/Criteria.tpl"} {*settings*} - {if $instanceForm OR $instanceFormError} + {if !empty($instanceForm) OR !empty($instanceFormError)} {include file="CRM/Report/Form/Tabs/Instance.tpl"} {/if}
    {* end mainTabContainer *} @@ -51,7 +51,7 @@ CRM.$(function($) { var tabSettings = { collapsible: true, - active: {/literal}{if $rows}false{else}0{/if}{literal} + active: {/literal}{if !empty($rows)}false{else}0{/if}{literal} }; // If a tab contains an error, open it if ($('.civireport-criteria .crm-error', '#mainTabContainer').length) { diff --git a/templates/CRM/Report/Form/Grant/Statistics.tpl b/templates/CRM/Report/Form/Grant/Statistics.tpl index 2ed51ff14e..e9d5851575 100644 --- a/templates/CRM/Report/Form/Grant/Statistics.tpl +++ b/templates/CRM/Report/Form/Grant/Statistics.tpl @@ -24,7 +24,7 @@ {*include the graph*} {include file="CRM/Report/Form/Layout/Graph.tpl"} - {if $printOnly} + {if !empty($printOnly)}

    {$reportTitle}

    {$reportDate}
    {/if} diff --git a/templates/CRM/Report/Form/Layout/Table.tpl b/templates/CRM/Report/Form/Layout/Table.tpl index 162d877c95..e90aa6259c 100644 --- a/templates/CRM/Report/Form/Layout/Table.tpl +++ b/templates/CRM/Report/Form/Layout/Table.tpl @@ -7,7 +7,7 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if !$rows} +{if empty($rows)}

    {ts}None found.{/ts}

    {else} {if !empty($pager) and $pager->_response and $pager->_response.numPages > 1} @@ -98,7 +98,7 @@ {assign var=fieldHover value=$field|cat:"_hover"} {assign var=fieldClass value=$field|cat:"_class"}
    - {if $row.$fieldLink} + {if !empty($row.$fieldLink)} {/if} @@ -130,7 +130,7 @@ {$row.$field} {/if} - {if $row.$fieldLink}{/if} + {if !empty($row.$fieldLink)}{/if}
    - {if !empty($statistics.groups)} + {if !empty($statistics.groups)} {foreach from=$statistics.groups item=row} diff --git a/templates/CRM/Report/Form/Tabs/FieldSelection.tpl b/templates/CRM/Report/Form/Tabs/FieldSelection.tpl index 31663201d2..48af99e39e 100644 --- a/templates/CRM/Report/Form/Tabs/FieldSelection.tpl +++ b/templates/CRM/Report/Form/Tabs/FieldSelection.tpl @@ -12,7 +12,7 @@ {foreach from=$colGroups item=grpFields key=dnc} {assign var="count" value="0"} {* Wrap custom field sets in collapsed accordion pane. *} - {if $grpFields.use_accordian_for_field_selection} + {if !empty($grpFields.use_accordian_for_field_selection)}
    {$row.title}
    - {if $grpFields.use_accordian_for_field_selection} + {if !empty($grpFields.use_accordian_for_field_selection)} {/if} diff --git a/templates/CRM/Report/Form/Tabs/Filters.tpl b/templates/CRM/Report/Form/Tabs/Filters.tpl index 04c6ca30e1..f32628a5a2 100644 --- a/templates/CRM/Report/Form/Tabs/Filters.tpl +++ b/templates/CRM/Report/Form/Tabs/Filters.tpl @@ -14,7 +14,7 @@ {foreach from=$filters item=table key=tableName} {assign var="filterCount" value=$table|@count} {* Wrap custom field sets in collapsed accordion pane. *} - {if $filterGroups.$tableName.group_title and $filterCount gte 1} + {if !empty($filterGroups.$tableName.group_title) and $filterCount gte 1} {* we should close table that contains other filter elements before we start building custom group accordion *} {if $counter eq 1} @@ -33,23 +33,26 @@ {assign var=filterVal value=$fieldName|cat:"_value"} {assign var=filterMin value=$fieldName|cat:"_min"} {assign var=filterMax value=$fieldName|cat:"_max"} - {if $field.operatorType & 4} + {if !empty($field.operatorType) && $field.operatorType & 4}
    {$field.title}{if !empty($field.title)}{$field.title}{/if}
    diff --git a/templates/CRM/Report/Form/Tabs/Instance.tpl b/templates/CRM/Report/Form/Tabs/Instance.tpl index 63ae83ebf7..7501debde0 100644 --- a/templates/CRM/Report/Form/Tabs/Instance.tpl +++ b/templates/CRM/Report/Form/Tabs/Instance.tpl @@ -58,19 +58,23 @@ {$form.parent_id.label} {help id="id-parent" file="CRM/Admin/Form/Navigation.hlp"} {$form.parent_id.html|crmAddClass:huge} + {if !empty($form.drilldown_id)} {$form.drilldown_id.label} {$form.drilldown_id.html} + {/if} {if $config->userFramework neq 'Joomla'} {$form.permission.label} {help id="id-report_perms" file="CRM/Report/Form/Tabs/Settings.hlp"} {$form.permission.html|crmAddClass:huge} + {if !empty($form.grouprole)} {$form.grouprole.label} {$form.grouprole.html|crmAddClass:huge} + {/if} {/if} {$form.add_to_my_reports.label} {help id="id-add_to_my_reports" file="CRM/Report/Form/Tabs/Settings.hlp"} @@ -119,7 +123,7 @@ }); {/literal} -{if $is_navigation} +{if !empty($is_navigation)}