php8.x Fix notices on displaying FieldSet
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 18 Sep 2023 05:37:31 +0000 (17:37 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 21 Sep 2023 03:21:16 +0000 (15:21 +1200)
13 files changed:
CRM/Profile/Form.php
ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/Participant.tpl
templates/CRM/Contribute/Form/Contribution/Confirm.tpl
templates/CRM/Contribute/Form/Contribution/Main.tpl
templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl
templates/CRM/Contribute/Form/Contribution/ThankYou.tpl
templates/CRM/Contribute/Form/PCP/PCPAccount.tpl
templates/CRM/Event/Form/Registration/AdditionalParticipant.tpl
templates/CRM/Event/Form/Registration/Register.tpl
templates/CRM/PCP/Form/PCPAccount.tpl
templates/CRM/Profile/Form/Dynamic.tpl
templates/CRM/UF/Form/Block.tpl
templates/CRM/UF/Form/Fields.tpl

index 247f41705b738eb360d1bd435c05c292af3015f5..80605866ecbc072de78080edf25f1a66c51df704 100644 (file)
@@ -795,6 +795,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
 
     $this->assign('id', $this->_id);
     $this->assign('mode', $this->_mode);
+    $this->assign('isHideFieldSet', ($this->_mode === self::MODE_CREATE || $this->_mode === self::MODE_EDIT));
     $this->assign('action', $this->_action);
     $this->assign('fields', $this->_fields);
     $this->assign('fieldset', (isset($this->_fieldset)) ? $this->_fieldset : "");
index 7f6ef84078f49cdb8453d97518ca62ed1488b5f3..28cf5eb1676014ee56777cc763cb5ea14c2aa266 100644 (file)
@@ -8,7 +8,7 @@
   <div class="clearfix">
           {assign var=pre value="event[`$event_id`][participant][`$participant_id`][customPre]"}
           <div class="profile-group">
-          {include file="CRM/UF/Form/Block.tpl" fields=$custom.$pre form=$form.field.$participant_id}
+          {include file="CRM/UF/Form/Block.tpl" fields=$custom.$pre form=$form.field.$participant_id hideFieldset=false}
           </div>
 
     <div class="participant-info crm-section form-item">
@@ -23,7 +23,7 @@
           {assign var=post value="event[`$event_id`][participant][`$participant_id`][customPost]"}
           <div style="clear:left"></div>
           <div class="profile-group">
-          {include file="CRM/UF/Form/Block.tpl" fields=$custom.$post form=$form.field.$participant_id}
+          {include file="CRM/UF/Form/Block.tpl" fields=$custom.$post form=$form.field.$participant_id hideFieldset=false}
           </div>
   </div>
     <!--if $form_participant->participant_index > 0-->
index a9972e56d9d5f1702affb6667537721d2479e9eb..5b13d71471a4c1cc881bda09337e2846023a881a 100644 (file)
 
   {if $onbehalfProfile && $onbehalfProfile|@count}
     <div class="crm-group onBehalf_display-group label-left crm-profile-view">
-      {include file="CRM/UF/Form/Block.tpl" fields=$onbehalfProfile prefix='onbehalf'}
+      {include file="CRM/UF/Form/Block.tpl" fields=$onbehalfProfile prefix='onbehalf' hideFieldset=false}
     </div>
   {/if}
 
       <div class="display-block">
         <div class="label-left crm-section honoree_profile-section">
           <strong>{$honorName}</strong><br/>
-          {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor'}
+          {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor' hideFieldset=false}
         </div>
       </div>
     </div>
 
   {if $customPre}
     <fieldset class="label-left crm-profile-view">
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false hideFieldset=false}
     </fieldset>
   {/if}
 
 
   {if $customPost}
     <fieldset class="label-left crm-profile-view">
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false hideFieldset=false}
     </fieldset>
   {/if}
 
index 3eb4ea74412ee5205fae1f3e65d0ca12dbb83c7a..312aade9cd1221edcc20e8aee5ce5cbab713b4cb 100644 (file)
           {/if}
           {/crmRegion}
           <div id="honorType" class="honoree-name-email-section">
-            {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor'}
+            {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor' hideFieldset=false}
           </div>
         </fieldset>
       {/if}
 
       <div class="crm-public-form-item crm-group custom_pre_profile-group">
-        {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false}
+        {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false hideFieldset=false}
       </div>
 
       {if array_key_exists('pcp_display_in_roll', $form)}
     {include file="CRM/Core/BillingBlockWrapper.tpl"}
 
     <div class="crm-public-form-item crm-group custom_post_profile-group">
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false hideFieldset=false}
     </div>
 
     <div id="crm-submit-buttons" class="crm-submit-buttons">
index 73e8d98b03ec68d928a73d6976873e3b5568e6bb..61bb569467bd8122a966f60e343857172c1eb996 100644 (file)
@@ -35,7 +35,7 @@
           </div>
         </div>
       {/if}
-      {include file="CRM/UF/Form/Block.tpl" fields=$onBehalfOfFields mode=8 prefix='onbehalf'}
+      {include file="CRM/UF/Form/Block.tpl" fields=$onBehalfOfFields mode=8 prefix='onbehalf' hideFieldset=true}
     </fieldset>
   {/if}
   {/crmRegion}
index 0a547a589642f01d6a94fabdb437f753ca520583..7f4b6bd0366760187cfc55323bd4ac505e8e00a7 100644 (file)
 
   {if $onbehalfProfile && $onbehalfProfile|@count}
     <div class="crm-group onBehalf_display-group label-left crm-profile-view">
-      {include file="CRM/UF/Form/Block.tpl" fields=$onbehalfProfile prefix='onbehalf'}
+      {include file="CRM/UF/Form/Block.tpl" fields=$onbehalfProfile prefix='onbehalf' hideFieldset=false}
      </div>
   {/if}
 
       <div class="display-block">
        <div class="label-left crm-section honoree_profile-section">
           <strong>{$honorName}</strong><br/>
-          {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields prefix='honor'}
+          {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields prefix='honor' hideFieldset=false}
         </div>
       </div>
    </div>
 
   {if $customPre}
     <fieldset class="label-left crm-profile-view">
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false hideFieldset=false}
     </fieldset>
   {/if}
 
 
   {if $customPost}
     <fieldset class="label-left crm-profile-view">
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false hideFieldset=false}
     </fieldset>
   {/if}
 
index a9c661352425d1b83c80038cea3213c9457a8de5..66af240594e41e2d12457c8a2ef82493127d06f0 100644 (file)
@@ -22,7 +22,7 @@
 {else}
 <div class="form-item">
 {include file="CRM/common/CMSUser.tpl"}
-{include file="CRM/UF/Form/Block.tpl" fields=$fields prefix=false}
+{include file="CRM/UF/Form/Block.tpl" fields=$fields prefix=false hideFieldset=false}
 </div>
 <div class="crm-submit-buttons">
 {include file="CRM/common/formButtons.tpl" location="bottom"}
index afa1cc2568713f7725a8b7fcfbddd4b02759569a..b9c9ca0306fd7c944bdd0ff31580907c269676f9 100644 (file)
@@ -22,7 +22,7 @@
 {/if}
 
 <div class="crm-public-form-item crm-section custom_pre-section">
-  {include file="CRM/UF/Form/Block.tpl" fields=$additionalCustomPre prefix=false}
+  {include file="CRM/UF/Form/Block.tpl" fields=$additionalCustomPre prefix=false hideFieldset=false}
 </div>
 
 {if $priceSet && $allowGroupOnWaitlist}
@@ -49,7 +49,7 @@
 {/if}
 
 <div class="crm-public-form-item crm-section custom_post-section">
-  {include file="CRM/UF/Form/Block.tpl" fields=$additionalCustomPost prefix=false}
+  {include file="CRM/UF/Form/Block.tpl" fields=$additionalCustomPost prefix=false hideFieldset=false}
 </div>
 
 <div id="crm-submit-buttons" class="crm-submit-buttons">
index 12688006ace9e06a2299683a3d6fba9a40578930..496581b3eb526baf36c0c68383666998c3f7e998 100644 (file)
@@ -73,7 +73,7 @@
 
     <div class="crm-public-form-item crm-section custom_pre-section">
       {* Display "Top of page" profile immediately after the introductory text *}
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPre prefix=false hideFieldset=false}
     </div>
 
     {if $priceSet}
     {/if}
 
     <div class="crm-public-form-item crm-section custom_post-section">
-      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false}
+      {include file="CRM/UF/Form/Block.tpl" fields=$customPost prefix=false hideFieldset=false}
     </div>
 
     <div id="crm-submit-buttons" class="crm-submit-buttons">
index 645cb781cf96df09b1a2425551ac07b016f6a001..1a5ee7d9eb0aa4e719f5963ec38757a202d60998 100644 (file)
@@ -26,7 +26,7 @@
 {else}
 <div class="form-item crm-block crm-form-block">
 {include file="CRM/common/CMSUser.tpl"}
-{include file="CRM/UF/Form/Block.tpl" fields=$fields prefix=false}
+{include file="CRM/UF/Form/Block.tpl" fields=$fields prefix=false hideFieldset=false}
 
 <div class="crm-submit-buttons">
 {include file="CRM/common/formButtons.tpl" location="bottom"}
index 48b749cb2d21dacb831bba3518944fd135c2f0ad..ee21345a4effd047704c6ce348be89093638d0be 100644 (file)
     {/if}
 
     {if ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192)}
+      {assign var=floatStyle value=''}
       {if $action eq 2 and $multiRecordFieldListing}
         <div class="crm-multi-record-custom-field-listing">
           {include file="CRM/Profile/Page/MultipleRecordFieldsListing.tpl" showListing=true}
index d180968dc967b153d35445ae145808c3f40d3b4a..95fb25c7b3a27b1ffd81d4b0ed11ed824f9d97ee 100644 (file)
   {strip}
     {assign var=zeroField value="Initial Non Existent Fieldset"}
     {assign var=fieldset  value=$zeroField}
-    {include file="CRM/UF/Form/Fields.tpl"}
+    {* Unfortunately uF group information is munged into the uf fields array. We have ot iterate throug
+    to extract it. I n future we could migrate to a version of Block.tpl that expects the UFGroup
+    to be assigned by itself & remove this *}
+    {foreach from=$fields item=field key=fieldName}
+      {assign var=groupHelpPost  value=$field.groupHelpPost}
+      {assign var=groupHelpPre  value=$field.groupHelpPre}
+      {assign var=fieldset  value=$field.groupTitle}
+      {assign var=groupDisplayTitle value=$field.groupDisplayTitle}
+      {assign var=group_id value=$field.group_id}
+      {assign var=groupName value=$field.groupName}
+    {/foreach}
 
-    {if $field.groupHelpPost && $action neq 4}
-      <div class="messages help">{$field.groupHelpPost}</div>
+    {if $groupHelpPre && $action neq 4}
+      <div class="messages help">{$groupHelpPre|smarty:nodefaults|purify}</div>
     {/if}
 
-    {if $mode eq 4}
-      <div class="crm-submit-buttons">
-        {$form.buttons.html}
-      </div>
+    {if !$hideFieldset}
+      <fieldset class="crm-profile crm-profile-id-{$group_id} crm-profile-name-{$groupName}"><legend>{$groupDisplayTitle}</legend>
     {/if}
 
-    {if $mode ne 8 && !$hideFieldset}
-    </fieldset>
+    {if ($form.formName eq 'Confirm' OR $form.formName eq 'ThankYou') AND $prefix neq 'honor'}
+      <div class="header-dark">{$groupDisplayTitle} </div>
+    {/if}
+    {include file="CRM/UF/Form/Fields.tpl"}
+
+    {if $groupHelpPost && $action neq 4}
+      <div class="messages help">{$groupHelpPost|smarty:nodefaults|purify}</div>
+    {/if}
+    {if !$hideFieldset}
+      </fieldset>
     {/if}
 
   {/strip}
index 5937321bd4f0ca8c3d0c5a0bcdf7de220f3c8f0d..b67e61f686948c5d3078fa7e413af0f08db03672 100644 (file)
     {assign var="rowIdentifier" value=$field.name}
   {/if}
 
-  {if $field.groupTitle != $fieldset}
-    {if $fieldset != $zeroField}
-      {if $groupHelpPost && $action neq 4}
-        <div class="messages help">{$groupHelpPost|smarty:nodefaults|purify}</div>
-      {/if}
-      {if $mode ne 8}
-        </fieldset>
-      {/if}
-    {/if}
-
-    {if !$hideFieldset}
-      <fieldset class="crm-profile crm-profile-id-{$field.group_id} crm-profile-name-{$field.groupName}"><legend>{$field.groupDisplayTitle}</legend>
-    {/if}
-
-    {if ($form.formName eq 'Confirm' OR $form.formName eq 'ThankYou') AND $prefix neq 'honor'}
-      <div class="header-dark">{$field.groupDisplayTitle} </div>
-    {/if}
-    {assign var=fieldset  value=`$field.groupTitle`}
-    {assign var=groupHelpPost  value=`$field.groupHelpPost`}
-    {if $field.groupHelpPre && $action neq 4}
-      <div class="messages help">{$field.groupHelpPre|smarty:nodefaults|purify}</div>
-    {/if}
-  {/if}
-
   {if $field.field_type eq "Formatting"}
     {if $action neq 4}
       {$field.help_pre}