From b8786ad2c483a982f986abd2ee1805d501a2f661 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Thu, 14 Apr 2022 13:18:30 +0000
Subject: [PATCH] Bug 30543: Decouple DumpSearchQueryTemplate from other
 tempalte dump preferences

To test:
1 - Enable DumpSearchQueryTemplate
2 - Confirm you can find the search query in the HTML as a comment
3 - Enable other template dump preference
4 - Confirm they work as before
5 - Confirm new description of preference makes sense
---
 .../intranet-tmpl/prog/en/includes/doc-head-open.inc     | 9 ++++++++-
 .../prog/en/modules/admin/preferences/logs.pref          | 2 +-
 .../opac-tmpl/bootstrap/en/includes/doc-head-open.inc    | 9 ++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc
index 2c493a8881..a524bc683a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc
@@ -3,10 +3,17 @@
 
 [% USE Koha %]
 [% USE raw %]
+[% USE Dumper( Indent=1, SortKeys=1 ) %]
+
+[% IF Koha.Preference('DumpSearchQueryTemplate') %]
+    <!-- SearchQuery
+        [% Dumper.dump( search_query ) | $raw %]
+    -->
+[% END %]
+
 [% IF Koha.Preference('DumpTemplateVarsIntranet') %]
     [% TRY %]
         [% USE Stash %]
-        [% USE Dumper( Indent=1, SortKeys=1 ) %]
         <!--
         [% FILTER replace('<!--', '<!- -') %]
             [% FILTER replace('-->', '- ->') %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref
index ba4dcbed7e..ccb11bc5a8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref
@@ -133,4 +133,4 @@ Logging:
               choices:
                   1: Do
                   0: "Don't"
-            - dump search query as a template parameter, requires <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=DumpTemplateVars">DumpTemplateVars</a>[interface] to be visible.
+            - dump search query to a comment in the HTML source for the OPAC and staff interface.
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc
index 03d7cf1707..ee6282c828 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-open.inc
@@ -3,10 +3,17 @@
 
 [% USE raw %]
 [% USE Koha %]
+[% USE Dumper( Indent=1, SortKeys=1 ) %]
+
+[% IF Koha.Preference('DumpSearchQueryTemplate') %]
+    <!-- SearchQuery
+        [% Dumper.dump( search_query ) | $raw %]
+    -->
+[% END %]
+
 [% IF Koha.Preference('DumpTemplateVarsOpac') %]
     [% TRY %]
         [% USE Stash %]
-        [% USE Dumper ( Indent=1, SortKeys=1 ) %]
         <!--
         [% FILTER replace('<!--', '<!- -') %]
             [% FILTER replace('-->', '- ->') %]
-- 
2.30.2