Bug 27282: Add window.onafterprint function
authorLucas Gass <lucas@bywatersolutions.com>
Fri, 18 Dec 2020 17:28:54 +0000 (17:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 21 Apr 2021 08:51:29 +0000 (10:51 +0200)
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt

index 5a00634..8b6c43f 100644 (file)
         <script>
             $( document ).ready(function() {
                 window.print();
-                setTimeout('window.close()', 1);
+                window.onafterprint = function () {
+                    window.close();
+                }
+                setTimeout('window.close()', 1000); // Hack for Chrome < 63
             });
         </script>
     [% END %]