Fix undefined tpl vars in CiviReport
authorColeman Watts <coleman@civicrm.org>
Wed, 7 Jul 2021 13:44:22 +0000 (09:44 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 7 Jul 2021 15:38:24 +0000 (11:38 -0400)
13 files changed:
templates/CRM/Report/Form.tpl
templates/CRM/Report/Form/Actions.tpl
templates/CRM/Report/Form/Criteria.tpl
templates/CRM/Report/Form/ErrorMessage.tpl
templates/CRM/Report/Form/Fields.tpl
templates/CRM/Report/Form/Grant/Statistics.tpl
templates/CRM/Report/Form/Layout/Table.tpl
templates/CRM/Report/Form/Statistics.tpl
templates/CRM/Report/Form/Tabs/FieldSelection.tpl
templates/CRM/Report/Form/Tabs/Filters.tpl
templates/CRM/Report/Form/Tabs/Instance.tpl
templates/CRM/Report/Page/InstanceList.tpl
templates/CRM/Report/Page/TemplateList.tpl

index 3ceffb9aa5da55f8b0a94931f6c03f10dc9c16d3..db27dbab83acb3aec2a1deb08b53809f55f9d0fa 100644 (file)
@@ -49,7 +49,7 @@
     {include file="CRM/Report/Form/ErrorMessage.tpl"}
   </div>
 {/if}
-{if $outputMode == 'print'}
+{if !empty($outputMode) && $outputMode == 'print'}
   <script type="text/javascript">
     window.print();
   </script>
index 34690c1d916d416587aa5a160b1df58d91d2302f..b16ec62fcc319a05c05b84f22f5b85b4fa56174f 100644 (file)
@@ -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 *}
     <div class="crm-tasks">
@@ -19,7 +19,7 @@
             <table class="form-layout-compressed">
               <tr>
                 {include file="CRM/common/tasks.tpl" location="botton"}
-                {if $instanceUrl}
+                {if !empty($instanceUrl)}
                   <td>&nbsp;&nbsp;<i class="crm-i fa-chevron-right" aria-hidden="true"></i> <a href="{$instanceUrl}">{ts}Existing report(s) from this template{/ts}</a></td>
                 {/if}
               </tr>
           </td>
           <td>
             <table class="form-layout-compressed" align="right">
-              {if $chartSupported}
+              {if !empty($chartSupported)}
                 <tr>
                   <td>{$form.charts.html|crmAddClass:big}</td>
                   <td align="right">{$form.$chart.html}</td>
                 </tr>
               {/if}
-              {if $form.groups}
+              {if !empty($form.groups)}
                 <tr>
                   <td>
                     {$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));
       });
     });
index b9bd520fa249aa0a28be84caf8b3f01bb672ba59..edea85861b4b3aeec06cc6166fb500df093247a3 100644 (file)
@@ -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);
       });
index 800544e8edfda7b91ba9ecd5c9886280d225a48c..6d05a8caec53bfb1ac3628e322edb04811f6ac47 100644 (file)
@@ -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)}
   <div class="messages status no-popup">
     {icon icon="fa-info-circle"}{/icon} {ts}None found.{/ts}
   </div>
index b19f550ea503d90519a8fbb289a48fe5b48be4ab..cbac1c0b3bef345c29e33c2d9f7f222218abd668 100644 (file)
@@ -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)}
     <div class="crm-report-criteria"> {* criteria section starts *}
       <div id="mainTabContainer">
         {*tab navigation bar*}
@@ -18,7 +18,7 @@
               <a title="{$tab.title|escape}" href="#report-tab-{$tab.div_label}">{$tab.title}</a>
             </li>
           {/foreach}
-          {if $instanceForm OR $instanceFormError}
+          {if !empty($instanceForm) OR !empty($instanceFormError)}
             <li id="tab_settings" class="ui-corner-all">
               <a title="{ts}Title and Format{/ts}" href="#report-tab-format">{ts}Title and Format{/ts}</a>
             </li>
@@ -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}
       </div> {* 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) {
index 2ed51ff14e62782ba1aabc17e04c96edf870b139..e9d58515750543f166554163d9335efec3b013c4 100644 (file)
@@ -24,7 +24,7 @@
         {*include the graph*}
         {include file="CRM/Report/Form/Layout/Graph.tpl"}
 
-    {if $printOnly}
+    {if !empty($printOnly)}
         <h1>{$reportTitle}</h1>
         <div id="report-date">{$reportDate}</div>
     {/if}
index 162d877c9576f4c2ace5303ac3bf0ab91c767087..e90aa6259c966a8304af99c03e7dd879928c5a54 100644 (file)
@@ -7,7 +7,7 @@
  | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
 *}
-{if !$rows}
+{if empty($rows)}
   <p>{ts}None found.{/ts}</p>
 {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"}
                     <td class="crm-report-{$field}{if $header.type eq 1024 OR $header.type eq 1 OR $header.type eq 512} report-contents-right{elseif $row.$field eq 'Subtotal'} report-label{/if}">
-                        {if $row.$fieldLink}
+                        {if !empty($row.$fieldLink)}
                             <a title="{$row.$fieldHover|escape}" href="{$row.$fieldLink}"  {if !empty($row.$fieldClass)} class="{$row.$fieldClass}"{/if}>
                         {/if}
 
                             {$row.$field}
                         {/if}
 
-                        {if $row.$fieldLink}</a>{/if}
+                        {if !empty($row.$fieldLink)}</a>{/if}
                     </td>
                 {/foreach}
             </tr>
index 001bf370356bf2d66ba96adc377eb9281c2fa7b2..f94e32db417d38e09dd1741536b94941121bf45d 100644 (file)
@@ -8,13 +8,13 @@
  +--------------------------------------------------------------------+
 *}
 {if !empty($top)}
-  {if $printOnly}
+  {if !empty($printOnly)}
     <h1>{$reportTitle}</h1>
-    <div id="report-date">{$reportDate}</div>
+    <div id="report-date">{if !empty($reportDate)}{$reportDate}{/if}</div>
   {/if}
-  {if $statistics}
+  {if !empty($statistics)}
     <table class="report-layout statistics-table">
-      {if !empty($statistics.groups)} 
+      {if !empty($statistics.groups)}
         {foreach from=$statistics.groups item=row}
           <tr>
             <th class="statistics" scope="row">{$row.title}</th>
index 31663201d233f0eba45bcf339db59069b01f210d..48af99e39eb5773cd6af09e330aee6eae50e8843 100644 (file)
@@ -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)}
         <div class="crm-accordion-wrapper crm-accordion collapsed">
         <div class="crm-accordion-header">
           {$grpFields.group_title}
@@ -33,7 +33,7 @@
           {/if}
         </tr>
       </table>
-      {if $grpFields.use_accordian_for_field_selection}
+      {if !empty($grpFields.use_accordian_for_field_selection)}
         </div><!-- /.crm-accordion-body -->
         </div><!-- /.crm-accordion-wrapper -->
       {/if}
index 04c6ca30e15478df67e1c4c4562825fd3205fb61..f32628a5a23af21db2194cfe8cea5ed0136bcbf2 100644 (file)
@@ -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}
                 {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}
                   <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}">
-                    <td class="label report-contents">{$field.title}</td>
-                      {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName=$fieldName hideRelativeLabel=1, from='_from' to='_to'}
+                    <td class="label report-contents">{if !empty($field.title)}{$field.title}{/if}</td>
+                      {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName=$fieldName hideRelativeLabel=1 from='_from' to='_to'}
                   </tr>
                 {elseif $form.$fieldOp.html}
-                  <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}" {if $field.no_display} style="display: none;"{/if}>
-                    <td class="label report-contents">{$field.title}</td>
+                  <tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}" {if !empty($field.no_display)} style="display: none;"{/if}>
+                    <td class="label report-contents">{if !empty($field.title)}{$field.title}{/if}</td>
                     <td class="report-contents">{$form.$fieldOp.html}</td>
                     <td>
                       <span id="{$filterVal}_cell">{$form.$filterVal.label}&nbsp;{$form.$filterVal.html}</span>
-                      <span id="{$filterMin}_max_cell">{$form.$filterMin.label}&nbsp;{$form.$filterMin.html}&nbsp;&nbsp;{$form.$filterMax.label}&nbsp;{$form.$filterMax.html}</span>
+                      <span id="{$filterMin}_max_cell">
+                        {if !empty($form.$filterMin)}{$form.$filterMin.label}&nbsp;{$form.$filterMin.html}&nbsp;&nbsp;{/if}
+                        {if !empty($form.$filterMax)}{$form.$filterMax.label}&nbsp;{$form.$filterMax.html}{/if}
+                      </span>
                     </td>
                   </tr>
                 {/if}
         {/foreach}
-        {if $filterGroups.$tableName.group_title}
+        {if !empty($filterGroups.$tableName.group_title)}
               </table>
             </div><!-- /.crm-accordion-body -->
           </div><!-- /.crm-accordion-wrapper -->
index 63ae83ebf783ac3e3b4d6eb9c6a9334dd7ade3db..7501debde04195e5fbd35c6e9434deb04b921d1b 100644 (file)
       <td class="report-label">{$form.parent_id.label} {help id="id-parent" file="CRM/Admin/Form/Navigation.hlp"}</td>
       <td>{$form.parent_id.html|crmAddClass:huge}</td>
     </tr>
+    {if !empty($form.drilldown_id)}
     <tr class="crm-report-instanceForm-form-block-drilldown">
       <td class="report-label">{$form.drilldown_id.label}</td>
       <td>{$form.drilldown_id.html}</td>
     </tr>
+    {/if}
     {if $config->userFramework neq 'Joomla'}
       <tr class="crm-report-instanceForm-form-block-permission">
         <td class="report-label" width="20%">{$form.permission.label} {help id="id-report_perms" file="CRM/Report/Form/Tabs/Settings.hlp"}</td>
         <td>{$form.permission.html|crmAddClass:huge}</td>
       </tr>
+      {if !empty($form.grouprole)}
       <tr class="crm-report-instanceForm-form-block-role">
         <td class="report-label" width="20%">{$form.grouprole.label}</td>
         <td>{$form.grouprole.html|crmAddClass:huge}</td>
       </tr>
+      {/if}
     {/if}
     <tr class="crm-report-instanceForm-form-block-add-to-my-reports">
       <td class="report-label">{$form.add_to_my_reports.label} {help id="id-add_to_my_reports" file="CRM/Report/Form/Tabs/Settings.hlp"}</td>
   });
 </script>
 {/literal}
-{if $is_navigation}
+{if !empty($is_navigation)}
   <script type="text/javascript">
     document.getElementById('is_navigation').checked = true;
     showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);
index f81a89c935146d47c4e4b8f0097ef222320714f4..3618df6e0a6eb7b20c1199e279cd9244c8c1fbfa 100644 (file)
@@ -9,10 +9,10 @@
 *}
 {strip}
   <div class="action-link">
-    {if $templateUrl}
+    {if !empty($templateUrl)}
       <a href="{$templateUrl}" class="button"><span><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {$newButton}</span></a>
     {/if}
-    {if $reportUrl}
+    {if !empty($reportUrl)}
       <a href="{$reportUrl}" class="button"><span>{ts}View All Reports{/ts}</span></a>
     {/if}
   </div>
     </div>
 
     <div class="action-link">
-      {if $templateUrl}
+      {if !empty($templateUrl)}
         <a href="{$templateUrl}" class="button"><span><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {$newButton}</span></a>
       {/if}
-      {if $reportUrl}
+      {if !empty($reportUrl)}
         <a href="{$reportUrl}" class="button"><span>{ts}View All Reports{/ts}</span></a>
       {/if}
     </div>
     <div class="crm-content-block">
       <div class="messages status no-popup">
         {icon icon="fa-info-circle"}{/icon}
-        {if $myReports}
+        {if !empty($myReports)}
           {ts}You do not have any private reports. To add a report to this section, edit the Report Settings for a report and set 'Add to My Reports' to Yes.{/ts} &nbsp;
         {else}
           {ts 1=$compName}No %1 reports have been created.{/ts} &nbsp;
-          {if $templateUrl}
+          {if !empty($templateUrl)}
             {ts 1=$templateUrl}You can create reports by selecting from the <a href="%1">list of report templates here.</a>{/ts}
           {else}
             {ts}Contact your site administrator for help creating reports.{/ts}
index 7464c88611a402d137df1be53003e63837648364..c19163479af144b866978f098bc11334b40b2718 100644 (file)
@@ -28,7 +28,7 @@
                   <tr id="row_{counter}" class="crm-report-templateList">
                     <td class="crm-report-templateList-title" style="width:35%;">
                       <a href="{$row.url}" title="{ts}Create report from this template{/ts}"><i class="crm-i fa-chevron-right" aria-hidden="true"></i> <strong>{$row.title}</strong></a>
-                      {if $row.instanceUrl}
+                      {if !empty($row.instanceUrl)}
                         <div style="font-size:10px;text-align:right;margin-top:3px;">
                           <a href="{$row.instanceUrl}">{ts}Existing Report(s){/ts}</a>
                         </div>