From 58dc35165a517be7dede2ea37e8c2128afdf9d51 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Wed, 11 Aug 2021 19:18:32 +0000
Subject: [PATCH] Bug 28454: (follow-up) Add schema version to link on reports
 home page

This patch makes the same changes to the script and template for the
reports home page.
---
 .../prog/en/modules/reports/reports-home.tt            |  2 +-
 reports/reports-home.pl                                | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt
index b3ee4d5ba8..30465784d1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt
@@ -93,7 +93,7 @@
             <li><a href="/cgi-bin/koha/reports/orders_by_fund.pl">Orders by fund</a></li>
             <li><a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by item type</a></li>
             <li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li>
-            <li><a href="http://schema.koha-community.org/" target="blank">Koha database schema</a></li>
+            <li><a href="http://schema.koha-community.org/[% schema_version | uri %]" target="blank">Koha database schema</a></li>
             <li><a href="http://wiki.koha-community.org/wiki/SQL_Reports_Library" target="blank">Koha reports library</a></li>
         </ul></div>
 </div>
diff --git a/reports/reports-home.pl b/reports/reports-home.pl
index 71aaa87e83..0511286634 100755
--- a/reports/reports-home.pl
+++ b/reports/reports-home.pl
@@ -32,8 +32,10 @@ my ($template, $loggedinuser, $cookie)
 				type => "intranet",
 				flagsrequired => {reports => '*'},
 				});
-$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
-		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
-		IntranetNav => C4::Context->preference("IntranetNav"),
-		);
+
+my $version_string = Koha::version();
+my ( $major, $minor, $maintenance, $development ) = split( '\.', $version_string );
+my $schema_version = ( $development ne '000' ) ? "" : $major . "_" . $minor;
+$template->param( 'schema_version' => $schema_version );
+
 output_html_with_http_headers $query, $cookie, $template->output;
-- 
2.20.1