Bug 27282 - Printing broken in some versions of Chrome
Summary: Printing broken in some versions of Chrome
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Browser compatibility (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Lucas Gass (lukeg)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-18 17:27 UTC by Lucas Gass (lukeg)
Modified: 2021-12-13 21:10 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Printing in some versions of Google Chrome does not work correctly making it impossible to print. This patch alters the JavaScript which controls the print dialogues in order to make for a better a printing experience across all browsers.
Version(s) released in:
21.05.00,20.11.06,20.05.12
Circulation function:


Attachments
Bug 27282: Add window.onafterprint function (1.32 KB, patch)
2020-12-18 17:30 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 27282: Add window.onafterprint function (1.37 KB, patch)
2020-12-21 15:52 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27282: Add window.onafterprint function (1.42 KB, patch)
2020-12-23 16:02 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 27282: fix all occurrences (2.38 KB, patch)
2021-01-07 16:11 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 27282: Add window.onafterprint function (1.47 KB, patch)
2021-04-08 15:58 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27282: fix all occurrences (2.43 KB, patch)
2021-04-08 15:58 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27282: Add window.onafterprint function (1.53 KB, patch)
2021-04-16 14:23 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27282: fix all occurrences (2.50 KB, patch)
2021-04-16 14:24 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2020-12-18 17:27:21 UTC
In more recent version of Chrome if you go to /cgi-bin/koha/virtualshelves/shelves.pl and attempt to 'Print list' the dialog pops up and immediately closes. 

We fixed this problem in the OPAC with Bug 24061, the same fix is needed in the staff client on shelves.pl

Read Bug 24061 for much of the details.
Comment 1 Lucas Gass (lukeg) 2020-12-18 17:30:59 UTC
Created attachment 114535 [details] [review]
Bug 27282: Add window.onafterprint function

TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open
Comment 2 Owen Leonard 2020-12-21 15:52:58 UTC
Created attachment 114562 [details] [review]
Bug 27282: Add window.onafterprint function

TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Nick Clemens (kidclamp) 2020-12-23 16:02:30 UTC
Created attachment 114685 [details] [review]
Bug 27282: Add window.onafterprint function

TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Nick Clemens (kidclamp) 2020-12-23 16:02:51 UTC
I don't recreate, but it works before and after and this makes code consistent
Comment 5 Jonathan Druart 2021-01-04 13:06:18 UTC
There are two other occurrences, should not we fix them as well?

koha-tmpl/intranet-tmpl/prog/en/includes/slip-print.inc:        setTimeout('window.close()', 1);

koha-tmpl/opac-tmpl/bootstrap/en/includes/slip-print.inc:        setTimeout('window.close()', 1);
Comment 6 Jonathan Druart 2021-01-07 14:35:01 UTC
Waiting for an answer.
Comment 7 Lucas Gass (lukeg) 2021-01-07 16:10:00 UTC
(In reply to Jonathan Druart from comment #5)
> There are two other occurrences, should not we fix them as well?
> 
> koha-tmpl/intranet-tmpl/prog/en/includes/slip-print.inc:       
> setTimeout('window.close()', 1);
> 
> koha-tmpl/opac-tmpl/bootstrap/en/includes/slip-print.inc:       
> setTimeout('window.close()', 1);

Yes, I think we should fix it everywhere for consistency.
Comment 8 Lucas Gass (lukeg) 2021-01-07 16:11:04 UTC
Created attachment 114933 [details] [review]
Bug 27282: fix all occurrences

This patch fixes all the occurrences, staff and OPAC. The problem only happens on some versions of Chrome.
TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

-Go to cgi-bin/koha/sco/sco-main.pl in Chrome, make sure you can finish and print successfully
-In the staff client in Chrome makes sure printing works in the following areas:
    1. /cgi-bin/koha/circ/circulation.pl Print Slip and Print Quick Slip
    2. /cgi-bin/koha/members/boraccount.pl Make a payment and make sure you can print the invoice
    3. cgi-bin/koha/labels/spinelabel-home.pl Make a quick spine label in Chrome and make sure that prints.
Comment 9 Timothy Alexis Vass 2021-02-04 16:30:39 UTC
I tried to sign off but the printing worked in this version of Chrome.
Version 88.0.4324.146 (Official Build) (64-bit)
Comment 10 Lucas Gass (lukeg) 2021-02-04 17:17:45 UTC
(In reply to Timothy Alexis Vass from comment #9)
> I tried to sign off but the printing worked in this version of Chrome.
> Version 88.0.4324.146 (Official Build) (64-bit)

This was last happening for me in Chrome 78.0.3904.97
Comment 11 David Cook 2021-02-05 02:42:57 UTC
(In reply to Lucas Gass from comment #10)
> (In reply to Timothy Alexis Vass from comment #9)
> > I tried to sign off but the printing worked in this version of Chrome.
> > Version 88.0.4324.146 (Official Build) (64-bit)
> 
> This was last happening for me in Chrome 78.0.3904.97

According to https://en.wikipedia.org/wiki/Google_Chrome_version_history, Chrome 78 has been discontinued. Versions 87 and 88 are stable. 

(I've actually been playing with Chromium 90 lately too as Playwright uses it but that's a dev build. Puppeteer uses Chromium 88.)

I reckon it should be safe to target only stable versions?
Comment 12 Lucas Gass (lukeg) 2021-03-09 16:03:16 UTC
> I reckon it should be safe to target only stable versions?

In Bug 24061 we fixed this for the OPAC. For consistency sake shouldn't we add this fix everywhere?
Comment 13 David Cook 2021-03-09 23:17:00 UTC
(In reply to Lucas Gass from comment #12)
> > I reckon it should be safe to target only stable versions?
> 
> In Bug 24061 we fixed this for the OPAC. For consistency sake shouldn't we
> add this fix everywhere?

Sounds fair to me heh.
Comment 14 Lucas Gass (lukeg) 2021-03-12 21:56:58 UTC
Just confirmed that this problem is happening to a user on Chrome 89.0.4389.90
Comment 15 Owen Leonard 2021-04-08 15:58:28 UTC
Created attachment 119338 [details] [review]
Bug 27282: Add window.onafterprint function

TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 16 Owen Leonard 2021-04-08 15:58:32 UTC
Created attachment 119339 [details] [review]
Bug 27282: fix all occurrences

This patch fixes all the occurrences, staff and OPAC. The problem only happens on some versions of Chrome.
TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

-Go to cgi-bin/koha/sco/sco-main.pl in Chrome, make sure you can finish and print successfully
-In the staff client in Chrome makes sure printing works in the following areas:
    1. /cgi-bin/koha/circ/circulation.pl Print Slip and Print Quick Slip
    2. /cgi-bin/koha/members/boraccount.pl Make a payment and make sure you can print the invoice
    3. cgi-bin/koha/labels/spinelabel-home.pl Make a quick spine label in Chrome and make sure that prints.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 17 Martin Renvoize (ashimema) 2021-04-16 14:23:59 UTC
Created attachment 119752 [details] [review]
Bug 27282: Add window.onafterprint function

TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 18 Martin Renvoize (ashimema) 2021-04-16 14:24:03 UTC
Created attachment 119753 [details] [review]
Bug 27282: fix all occurrences

This patch fixes all the occurrences, staff and OPAC. The problem only happens on some versions of Chrome.
TO TEST:
-set up a new list with a few items
-go to /cgi-bin/koha/virtualshelves/shelves.pl and view that list.
-Click 'Print List' in Chrome.
-The tab opens but immediately closes itself.
-Apply patch and clear cache
-Try again, the print dialouge remains open

-Go to cgi-bin/koha/sco/sco-main.pl in Chrome, make sure you can finish and print successfully
-In the staff client in Chrome makes sure printing works in the following areas:
    1. /cgi-bin/koha/circ/circulation.pl Print Slip and Print Quick Slip
    2. /cgi-bin/koha/members/boraccount.pl Make a payment and make sure you can print the invoice
    3. cgi-bin/koha/labels/spinelabel-home.pl Make a quick spine label in Chrome and make sure that prints.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 19 Jonathan Druart 2021-04-21 08:46:53 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 20 Fridolin Somers 2021-04-29 13:00:19 UTC
Pushed to 20.11.x for 20.11.06
Comment 21 Victor Grousset/tuxayo 2021-05-24 17:00:48 UTC
note: it was pushed to 20.05.x for 20.05.12
Comment 22 Victor Grousset/tuxayo 2021-05-24 17:01:00 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.