Enotice fixes - ensure a couple more variables are consistently assigned
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 28 Nov 2021 06:41:14 +0000 (19:41 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 28 Nov 2021 21:18:46 +0000 (10:18 +1300)
CRM/Core/Form.php
CRM/Core/Invoke.php
templates/CRM/common/formButtons.tpl
templates/CRM/common/jsortable.tpl

index 9fdf2e86683d522bf8147618b959888e40997978..3b8da3e6fb48457429630e0378dc9ec0ba31733d 100644 (file)
@@ -279,6 +279,8 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     'infoOptions',
     // required for attachmentjs.tpl
     'context',
+    // FormButtons.tpl (adds buttons to forms).
+    'linkButtons',
   ];
 
   /**
index 12db074dc86f73a2d5b9de786a688b10218fe09c..48bf206c623fb367977bd655388a3e8b0fbae8a9 100644 (file)
@@ -220,6 +220,12 @@ class CRM_Core_Invoke {
     $template = CRM_Core_Smarty::singleton();
     $template->assign('activeComponent', 'CiviCRM');
     $template->assign('formTpl', 'default');
+    // Ensure template variables have 'something' assigned for e-notice
+    // prevention. These are ones that are included very often
+    // and not tied to a specific form.
+    // jsortable.tpl (datatables)
+    $template->assign('sourceUrl');
+    $template->assign('useAjax', 0);
 
     if ($item) {
 
index f00a9747839e6c324744a8c25eb8f387c7e1573a..0ef85e9845fe05ffba38045362d69b00dc8778e3 100644 (file)
@@ -10,7 +10,7 @@
 
 {crmRegion name='form-buttons'}
 {* Loops through $linkButtons and assigns html "a" (link) buttons to the template. Used for additional entity functions such as "Move to Case" or "Renew Membership" *}
-{if !empty($linkButtons)}
+{if $linkButtons}
   {foreach from=$linkButtons item=linkButton}
     {if $linkButton.accessKey}
       {capture assign=accessKey}accesskey="{$linkButton.accessKey}"{/capture}
index efd1d1d13dd88c74d1d25a0c43e5c215bfbb6dbb..e33c663f806a92fc0bc97230ef329a0715153e40 100644 (file)
     }
 
     // for date sorting see http://wiki.civicrm.org/confluence/display/CRMDOC/Sorting+Date+Fields+in+dataTables+Widget
-    var useAjax = {/literal}{if !empty($useAjax)}1{else}0{/if}{literal},
+    var useAjax = {$useAjax},
       sourceUrl = '',
       useClass  = 'display',
       tcount = 1,
       tableId = [];
 
     if ( useAjax ) {
-      {/literal}{if isset($sourceUrl)}sourceUrl = "{$sourceUrl}";{/if}{literal}
+      {/literal}{if $sourceUrl}sourceUrl = "{$sourceUrl}";{/if}{literal}
       useClass = 'pagerDisplay';
       tcount = 5;
     }