From a5c8580c6e7fcfe810652373defce6e4f560e34d Mon Sep 17 00:00:00 2001
From: David Cook <dcook@prosentient.com.au>
Date: Thu, 21 Sep 2023 01:27:45 +0000
Subject: [PATCH] Bug 34859: Remove unnecessary params from reports-home.pl

This change removes unnecessary syspref template parameters
and tidies the code.

Test plan:
0. Apply the patch and koha-plack --reload kohadev
1. Go to
/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=IntranetNav
2. Add the following and save:
<li><a href="#">Awesome</a></li>
3. Go to
/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=intranetstylesheet
4. Add the following and save:
http://bad
5. Go to
/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=intranetcolorstylesheet
6. Add the following and save:
http://bad2
7. Go to /cgi-bin/koha/reports/reports-home.pl
8. Note the "Awesome" link in the top navbar
9. Note in the console that there are two errors where http://bad
and http://bad2 can't be resolved

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
---
 reports/reports-home.pl | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/reports/reports-home.pl b/reports/reports-home.pl
index 71aaa87e83..dfd36e5f23 100755
--- a/reports/reports-home.pl
+++ b/reports/reports-home.pl
@@ -17,23 +17,18 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-
 use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Auth qw( get_template_and_user );
 use C4::Output qw( output_html_with_http_headers );
-use C4::Context;
-
 
 my $query = CGI->new;
-my ($template, $loggedinuser, $cookie)
-= get_template_and_user({template_name => "reports/reports-home.tt",
-				query => $query,
-				type => "intranet",
-				flagsrequired => {reports => '*'},
-				});
-$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-		IntranetNav => C4::Context->preference("IntranetNav"),
-		);
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name => "reports/reports-home.tt",
+        query         => $query,
+        type          => "intranet",
+        flagsrequired => { reports => '*' },
+    }
+);
 output_html_with_http_headers $query, $cookie, $template->output;
-- 
2.30.2