Bug 32672

Summary: Incorrect CSS path to jquery-ui
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: ajestin, arthur.suzuki, david, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32701
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.03,22.05.10
Bug Depends on: 30011    
Bug Blocks:    
Attachments: Bug 32672: Incorrect CSS path to jquery-ui
Bug 32672: Incorrect CSS path to jquery-ui
Bug 32672: Incorrect CSS path to jquery-ui

Description Jonathan Druart 2023-01-18 12:17:34 UTC
Not sure how bad this is, but we are pointing to a non-existing css file:

koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt:    [% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt:[% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]
koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt:    [% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]

From 
  commit de2d8ba3e4f611aadc29165a7748cc1797d87ce3    
  Bug 30011: Update links to jQueryUI assets, remove datepicker references, etc.

-    [% Asset.css("lib/jquery/jquery-ui-1.12.1.css") | $raw %]
+    [% Asset.css("lib/jquery/jquery-ui-1.13.1.css") | $raw %]

We only have the min version for 1.13.1.css
Comment 1 Owen Leonard 2023-01-18 16:00:31 UTC
Created attachment 145400 [details] [review]
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.
Comment 2 David Nind 2023-01-20 19:55:53 UTC
There were no browser messages related to missing files after applying the patch.

However, I had these warning and error messages when accessing the help page from the self-checkout system (http://127.0.0.1:8080/cgi-bin/koha/sco/sco-main.pl):

Warning
------- 

jQuery.Deferred exception: __ is not defined @http://127.0.0.1:8080/opac-tmpl/bootstrap/js/global_22.1200001.js:248:6
e@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:30038
Deferred/then/l/</t<@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:30340
setTimeout handler*Deferred/then/l/<@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:30549
c@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:28327
fireWith@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:29072
fire@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:29108
c@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:28327
fireWith@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:29072
ready@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:32045
B@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:31824
EventListener.handleEvent*@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:32193
@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:220
@http://127.0.0.1:8080/opac-tmpl/bootstrap/lib/jquery/jquery-3.6.0.min_22.1200001.js:2:225
 undefined jquery-3.6.0.min_22.1200001.js:2:31593

Error
-----

Uncaught ReferenceError: __ is not defined
    <anonymous> http://127.0.0.1:8080/opac-tmpl/bootstrap/js/global_22.1200001.js:248
    jQuery 13
        e
        t
        setTimeout handler*Deferred/then/l/<
        c
        fireWith
        fire
        c
        fireWith
        ready
        B
        EventListener.handleEvent*
        <anonymous>
        <anonymous>
global_22.1200001.js:248:6


Testing notes (using KTD):

1. Enable the SelfCheckInModule system preferences (SCOAllowCheckin and WebBasedSelfCheck are enabled by default in KTD).

2. I checked out, renewed and checked in 39999000011418 from http://127.0.0.1:8080/cgi-bin/koha/sco/sco-main.pl

3. After checking out 39999000011418 again, I checked it in from http://127.0.0.1:8080/cgi-bin/koha/sci/sci-main.pl

4. I accessed the help page from http://127.0.0.1:8080/cgi-bin/koha/sco/sco-main.pl (the help page for the self check-in page is a modal window).
Comment 3 Owen Leonard 2023-01-23 15:12:25 UTC
> However, I had these warning and error messages when accessing the help page
> from the self-checkout system

I saw this too but it should be considered a separate bug because it's unrelated to the jQueryUI assets. I have filed Bug 32701 - Self checkout help page lacks required I18N JavaScript.
Comment 4 ajestin 2023-01-23 15:16:15 UTC
I tested the same workflow than David and the file /bootstrap/lib/jquery/jquery-ui-1.13.1.min_22.1200000.js is still loaded (web developer network panel) on Self checkout system page
Comment 5 Owen Leonard 2023-01-23 16:41:31 UTC
(In reply to ajestin from comment #4)
> /bootstrap/lib/jquery/jquery-ui-1.13.1.min_22.1200000.js is still loaded

The patch doesn't change links to jQueryUI javascript (.js) only CSS (.css)
Comment 6 David Nind 2023-01-23 17:53:06 UTC
Created attachment 145591 [details] [review]
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>
Comment 7 Martin Renvoize 2023-02-01 13:49:37 UTC
Created attachment 145944 [details] [review]
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>
Comment 8 Martin Renvoize 2023-02-01 13:50:03 UTC
All working now, nice bit of cleanup.

Passing QA
Comment 9 Tomás Cohen Arazi 2023-02-03 13:33:12 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Jacob O'Mara 2023-02-06 16:28:19 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 11 Lucas Gass 2023-02-14 22:09:31 UTC
Backported to 22.05.x for upcoming 22.05.10
Comment 12 Arthur Suzuki 2023-02-17 10:32:59 UTC
depends on 30011, can't backport
Comment 13 Arthur Suzuki 2023-02-17 10:33:28 UTC
(last comment targets 21.11.x)