[php8-compact] Add in guards into various templates to fix issues in test runs on...
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 8 Jun 2021 01:02:08 +0000 (01:02 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 11 Jun 2021 03:46:59 +0000 (03:46 +0000)
templates/CRM/Group/Form/Edit.tpl
templates/CRM/Group/Form/GroupsCommon.tpl
templates/CRM/Group/Form/Search.tpl
templates/CRM/Mailing/Form/InsertTokens.tpl
templates/CRM/Member/Page/MembershipStatus.tpl
templates/CRM/Pledge/Page/UserDashboard.tpl
templates/CRM/Report/Page/Options.tpl

index 8c9a85bb1c2dad7a8299ba0be692ae5d9f139421..d0fe28bf3986ed67643d8c62faa70e1fd97007b8 100644 (file)
@@ -22,7 +22,7 @@
     <tr class="crm-group-form-block-title">
       <td class="label">{$form.title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_group' field='title' id=$group.id}{/if}</td>
       <td>{$form.title.html|crmAddClass:huge}
-        {if $group.saved_search_id}&nbsp;({ts}Smart Group{/ts}){/if}
+        {if !empty($group.saved_search_id)}&nbsp;({ts}Smart Group{/ts}){/if}
       </td>
     </tr>
 
@@ -36,7 +36,7 @@
     <tr class="crm-group-form-block-frontend-title">
       <td class="label">{$form.frontend_title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_group' field='frontend_title' id=$group.id}{/if}</td>
       <td>{$form.frontend_title.html|crmAddClass:huge}
-        {if $group.saved_search_id}&nbsp;({ts}Smart Group{/ts}){/if}
+        {if !empty($group.saved_search_id)}&nbsp;({ts}Smart Group{/ts}){/if}
       </td>
     </tr>
 
       <td>{$form.is_active.html}</td>
     </tr>
 
-   {if $group.created_by}
+   {if !empty($group.created_by)}
       <tr class="crm-group-form-block-created">
         <td class="label">{ts}Created By{/ts}</td>
         <td>{$group.created_by}</td>
       </tr>
     {/if}
 
-    {if $group.modified_by}
+    {if !empty($group.modified_by)}
       <tr class="crm-group-form-block-modified">
         <td class="label">{ts}Modified By{/ts}</td>
         <td>{$group.modified_by}</td>
 
   {literal}
   <script type="text/javascript">
-    {/literal}{if $freezeMailingList}{literal}
+    {/literal}{if !empty($freezeMailingList)}{literal}
     cj('input[type=checkbox][name="group_type[{/literal}{$freezeMailingList}{literal}]"]').prop('disabled',true);
     {/literal}{/if}{literal}
-    {/literal}{if $hideMailingList}{literal}
+    {/literal}{if !empty($hideMailingList)}{literal}
     cj('input[type=checkbox][name="group_type[{/literal}{$hideMailingList}{literal}]"]').hide();
     cj('label[for="group_type[{/literal}{$hideMailingList}{literal}]"]').hide();
     {/literal}{/if}{literal}
index 33678db66a6d35ba0cfeb10eaf41db60950d89c5..2be8d82ccdab14c6e2bf62d39b28c292bce9740f 100644 (file)
@@ -8,9 +8,9 @@
  +--------------------------------------------------------------------+
 *}
 {*CRM-14190*}
-{if $parent_groups|@count > 0 or $form.parents.html}
+{if (isset($parent_groups) and $parent_groups|@count > 0) or !empty($form.parents.html)}
   <h3>{ts}Parent Groups{/ts} {help id="id-group-parent" file="CRM/Group/Page/Group.hlp"}</h3>
-  {if $parent_groups|@count > 0}
+  {if isset($parent_groups) and $parent_groups|@count > 0}
     <table class="form-layout-compressed">
       <tr>
         <td><label>{ts}Remove Parent?{/ts}</label></td>
@@ -31,7 +31,7 @@
     </tr>
   </table>
 {/if}
-{if $form.organization_id}
+{if !empty($form.organization_id)}
   <h3>{ts}Associated Organization{/ts} {help id="id-group-organization" file="CRM/Group/Page/Group.hlp"}</h3>
   <table class="form-layout-compressed">
     <tr class="crm-group-form-block-organization">
index e01ece5d192bc00b9c6940a3c5b49022824856bb..6363fba591a09cd270f12925f50fd78d93402733 100644 (file)
@@ -8,7 +8,7 @@
  +--------------------------------------------------------------------+
 *}
 <div class="crm-block crm-form-block crm-group-search-form-block">
-  <div class="crm-accordion-wrapper crm-search_builder-accordion {if $rows and !$showSearchForm}collapsed{/if}">
+  <div class="crm-accordion-wrapper crm-search_builder-accordion {if $rows and empty($showSearchForm)}collapsed{/if}">
     <div class="crm-accordion-header crm-master-accordion-header">
       {ts}Find Groups{/ts}
     </div>
               {$form.title.label}<br />
               {$form.title.html}<br />
               <span class="description font-italic">
-          {ts}Complete OR partial group name.{/ts}
-      </span>
-            </td>
-            <td>
-              {$form.created_by.label}<br />
-              {$form.created_by.html}<br />
-              <span class="description font-italic">
-          {ts}Complete OR partial creator name.{/ts}
-      </span>
+                {ts}Complete OR partial group name.{/ts}
+              </span>
             </td>
+            {if !empty($form.created_by)}
+              <td>
+                {$form.created_by.label}<br />
+                {$form.created_by.html}<br />
+                <span class="description font-italic">
+                  {ts}Complete OR partial creator name.{/ts}
+                </span>
+              </td>
+            {/if}
             <td>
               {$form.visibility.label}<br />
               {$form.visibility.html}<br />
               <span class="description font-italic">
-          {ts}Filter search by visibility.{/ts}
-      </span>
-            </td>
-          </tr>
-          <tr>
-            <td id="group_type-block">
-              {$form.group_type_search.label}<br />
-              {$form.group_type_search.html}<br />
-              <span class="description font-italic">
-          {ts}Filter search by group type(s).{/ts}
-      </span>
-            </td>
-            <td>
-              {$form.group_status.label}<br />
-              {$form.group_status.html}
-            </td>
-            <td>
-              {$form.component_mode.label}<br />
-              {$form.component_mode.html}
+               {ts}Filter search by visibility.{/ts}
+              </span>
             </td>
           </tr>
           <tr>
-            <td>
-              {$form.saved_search.label} <br/>{$form.saved_search.html}
-            </td>
-            <td colspan="2">
-            </td>
+            {if !empty($form.group_type_search)}
+              <td id="group_type-block">
+                {$form.group_type_search.label}<br />
+                {$form.group_type_search.html}<br />
+                <span class="description font-italic">
+                  {ts}Filter search by group type(s).{/ts}
+                </span>
+              </td>
+            {/if}
+            {if !empty($form.group_status)}
+              <td>
+                {$form.group_status.label}<br />
+                {$form.group_status.html}
+              </td>
+            {/if}
+            {if !empty($form.component_mode)}
+              <td>
+                {$form.component_mode.label}<br />
+                {$form.component_mode.html}
+              </td>
+            {/if}
           </tr>
+          {if !empty($form.saved_search)}
+            <tr>
+              <td>
+                {$form.saved_search.label} <br/>{$form.saved_search.html}
+              </td>
+              <td colspan="2">
+              </td>
+            </tr>
+          {/if}
         </table>
       </div>
     </div>
@@ -81,7 +91,7 @@
       <th data-data="description" data-orderable="false" cell-class="crm-group-description crmf-description {$editableClass}" class='crm-group-description'>{ts}Description{/ts}</th>
       <th data-data="group_type" cell-class="crm-group-group_type" class='crm-group-group_type'>{ts}Group Type{/ts}</th>
       <th data-data="visibility" cell-class="crm-group-visibility crmf-visibility {$editableClass}" cell-data-type="select" class='crm-group-visibility'>{ts}Visibility{/ts}</th>
-      {if $showOrgInfo}
+      {if !empty($showOrgInfo)}
         <th data-data="org_info" data-orderable="false" cell-class="crm-group-org_info" class='crm-group-org_info'>{ts}Organization{/ts}</th>
       {/if}
       <th data-data="links" data-orderable="false" cell-class="crm-group-group_links" class='crm-group-group_links'>&nbsp;</th>
           d.status = groupStatus,
           d.savedSearch = $('.crm-group-search-form-block select#saved_search').val(),
           d.component_mode = $(".crm-group-search-form-block select#component_mode").val(),
-          d.showOrgInfo = {/literal}"{$showOrgInfo}"{literal},
+          d.showOrgInfo = {/literal}{if isset($showOrgInfo)}"{$showOrgInfo}"{else}"0"{/if}{literal},
           d.parentsOnly = parentsOnly
         }
       },
     // show hide children
     var context = $('#crm-main-content-wrapper');
     $('table.crm-group-selector', context).on( 'click', 'span.show-children', function(){
-      var showOrgInfo = {/literal}"{$showOrgInfo}"{literal};
+      var showOrgInfo = {/literal}{if isset($showOrgInfo)}"{$showOrgInfo}"{else}"0"{/if}{literal};
       var rowID = $(this).parents('tr').prop('id');
       var parentRow = rowID.split('_');
       var parent_id = parentRow[1];
index 06634d7c978eba292679c6cdc02a762ab8f9194c..b59f586744062f05465ee20feaf356287b9c581c 100644 (file)
@@ -45,7 +45,7 @@ var isMailing    = false;
   {/literal}
 {/if}
 
-{if $templateSelected}
+{if !empty($templateSelected)}
   {literal}
   if ( document.getElementsByName(prefix + "saveTemplate")[0].checked ) {
     document.getElementById(prefix + "template").selectedIndex = {/literal}{$templateSelected}{literal};
index c8c976fdbbee9b78de6025bacda0eb897c69016a..c09e892462978fa4178dbef38555e633db0d7f7a 100644 (file)
             <th></th>
         </thead>
         {foreach from=$rows item=row}
-        <tr id="membership_status-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class} {if NOT $row.is_active} disabled{/if} crmf">
+        <tr id="membership_status-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {if !empty($row.class)}{$row.class}{/if} {if NOT $row.is_active} disabled{/if} crmf">
           <td class="crmf-label crm-editable" >{$row.label}</td>
-          <td class="nowrap crmf-start_event crm-editable" data-type="select" data-empty-option="{ts}- none -{/ts}">{$row.start_event}</td>
-          <td class="nowrap crmf-start_event_adjust_unit_interval">{$row.start_event_adjust_unit_interval}</td>
-          <td class="nowrap crmf-end_event crm-editable" data-type="select" data-empty-option="{ts}- none -{/ts}">{$row.end_event}</td>
-          <td class="nowrap crmf-end_event_adjust_interval">{$row.end_event_adjust_interval}</td>
+          <td class="nowrap crmf-start_event crm-editable" data-type="select" data-empty-option="{ts}- none -{/ts}">{if !empty($row.start_event)}{$row.start_event}{/if}</td>
+          <td class="nowrap crmf-start_event_adjust_unit_interval">{if !empty($row.start_event_adjust_unit_interval)}{$row.start_event_adjust_unit_interval}{/if}</td>
+          <td class="nowrap crmf-end_event crm-editable" data-type="select" data-empty-option="{ts}- none -{/ts}">{if !empty($row.end_event)}{$row.end_event}{/if}</td>
+          <td class="nowrap crmf-end_event_adjust_interval">{if !empty($row.end_event_adjust_unit_interval)}{$row.end_event_adjust_interval}{/if}</td>
           <td class="crmf-is_current_member crm-editable" data-type="boolean">{if $row.is_current_member eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
           <td class="crmf-is_admin crm-editable" data-type="boolean">{if $row.is_admin eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
           <td class="nowrap crmf-weight">{$row.weight}</td>
           <td class="crmf-is_reserved">{if $row.is_reserved eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
-          <td>{$row.action|replace:'xx':$row.id}</td>
+          <td>{if !empty($row.action)}{$row.action|replace:'xx':$row.id}{/if}</td>
         </tr>
         {/foreach}
         </table>
index 97ff8596d2d9f2f463a23d81fc3af3788db4e99d..0fe60894ba6670189a226e45a2dfff53ec7b2c4d 100644 (file)
@@ -52,7 +52,7 @@
 {*pledge row if*}
 
 {*Display honor block*}
-{if $pledgeHonor && $pledgeHonorRows}
+{if !empty($pledgeHonor) && !empty($pledgeHonorRows)}
 {strip}
 <div class="help">
     <p>{ts}Pledges made in your honor.{/ts}</p>
index 6cb81d5e180069c8c337d07e5bc33f690b3684dc..03c9e5050b452b7be2c763d7fde4331843cd48f0 100644 (file)
@@ -28,7 +28,7 @@
           <th>{ts}URL{/ts}</th>
           <th>{ts}Description{/ts}</th>
           <th>{ts}Order{/ts}</th>
-          {if $showIsDefault}
+          {if !empty($showIsDefault)}
             <th>{ts}Default{/ts}</th>
           {/if}
           <th>{ts}Reserved{/ts}</th>
         </tr>
         </thead>
         {foreach from=$rows item=row}
-          <tr id="option_value-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}{$row.class}{if NOT $row.is_active} crm-report-optionList crm-report-optionList-status_disable disabled{else} crm-report-optionList crm-report-optionList-status_enable{/if}">
+          <tr id="option_value-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}{if !empty($row.class)}{$row.class}{/if}{if NOT $row.is_active} crm-report-optionList crm-report-optionList-status_disable disabled{else} crm-report-optionList crm-report-optionList-status_enable{/if}">
             <td class="crm-report-optionList-label crm-editable" data-field="label">{$row.label}</td>
             <td class="crm-report-optionList-value">{$row.value}</td>
             <td class="crm-report-optionList-description">{$row.description}</td>
             <td class="nowrap crm-report-optionList-order">{$row.weight}</td>
-            {if $showIsDefault}
+            {if !empty($showIsDefault)}
               <td class="crm-report-optionList-default_value">{$row.default_value}</td>
             {/if}
             <td class="crm-report-optionList-is_reserved">{if $row.is_reserved eq 1}{ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>