From af4ec16610338b7c36dc811154b4c51afc0f45f8 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Wed, 18 Jan 2023 15:41:51 +0000
Subject: [PATCH] Bug 32672: Incorrect CSS path to jquery-ui

This patch removes links to jQueryUI assets which are not required in
the self-checkout and self-checkin pages.

The patch also adds missing JS to the self-checkin page related to
internationalization. This prevents a JS error related to an undefined
function, "__".

To test, apply the patch and view the main pages in self-checkout and
self-checkin, and the help page in self checkout. There should be no
errors in the browser console related to missing files.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt | 8 ++++++--
 koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt     | 1 -
 koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 2 --
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt
index da60d2d0ce6..ea3a4aecf6e 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt
@@ -35,17 +35,21 @@
     <link rel="shortcut icon" href="[% interface | html %]/[% theme | html %]/images/favicon.ico" type="image/x-icon" />
 [% END %]
 [% IF ( bidi ) %]
-    [% Asset.css("lib/jquery/jquery-ui-rtl-1.13.1.min.css") | $raw %]
     [% Asset.css("css/sco-rtl.css") | $raw %]
 [% ELSE %]
-    [% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]
     [% Asset.css("css/sco.css") | $raw %]
 [% END %]
 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
 [% IF ( Koha.Preference('SelfCheckInUserCSS') ) %]<style>[% Koha.Preference('SelfCheckInUserCSS') | $raw %]</style>[% END %]
 <script>
+    var Koha = {};
     function _(s) { return s } // dummy function for gettext
 </script>
+[% IF lang && lang != 'en' %]
+    [% Asset.js(lang _ '/js/locale_data.js') | $raw %]
+[% END %]
+[% Asset.js('js/Gettext.js') | $raw %]
+[% Asset.js('js/i18n.js') | $raw %]
 </head>
 <body id="sci_main" class="sci" onload="dofocus();" onunload="mungeHistory();">
     [% INCLUDE 'masthead-sci.inc' %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt
index 2f2417fc5d2..c47149f702c 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt
@@ -7,7 +7,6 @@
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta name="generator" content="Koha [% Version | html %]" /> <!-- leave this for stats -->
 <link rel="shortcut icon" href="[% IF ( Koha.Preference('OpacFavicon')  ) %][% Koha.Preference('OpacFavicon') | url %][% ELSE %][% interface | html %]/[% theme | html %]/images/favicon.ico[% END %]" type="image/x-icon" />
-[% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]
 [% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
 [% Asset.css("css/sco.css") | $raw %]
 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
index b5d3d6c900c..6afd709a784 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt
@@ -16,10 +16,8 @@
 [% END %]
 [% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
 [% IF ( bidi ) %]
-    [% Asset.css("lib/jquery/jquery-ui-rtl-1.13.1.min.css") | $raw %]
     [% Asset.css("css/sco-rtl.css") | $raw %]
 [% ELSE %]
-    [% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]
     [% Asset.css("css/sco.css") | $raw %]
 [% END %]
 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
-- 
2.39.1