[Koha-patches] [PATCH] Bug 16575 - Irregular behaviour using window.print() followed by window.location.href=

Srdjan srdjan at catalyst.net.nz
Mon May 30 06:43:50 CEST 2016


From: David Cook <dcook at prosentient.com.au>

Use print.css for OPAC basket when printing instead of using navigation.

Currently, when you click "Print" on the OPAC basket, it'll navigate to a new page
and initiate window.print() followed by a window.location.href change again.
Unfortunately, due to differences in IE, Chrome, and FF, it will
either show the print options, navigate away without showing them, or refuse
to navigate away after printing. By changing to using print.css, we don't
navigate away from the basket in the first place, so we prevent this
irregular behaviour.

_TEST PLAN_

1) Apply the patch
2) Create an OPAC basket by clicking "Add to cart" on multiple items
3) Using Chrome, IE, and Firefox (of any version), click the "Print" button
4) You should see the relevant print menu without the OPAC basket re-loading
in any way.
5) After printing is complete, you should still be on the OPAC basket pop-up

Signed-off-by: Srdjan <srdjan at catalyst.net.nz>
---
 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
index fa7e496..11702a9 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
@@ -16,7 +16,7 @@
                         <h2>Your cart</h2>
 
                         [% UNLESS ( print_basket ) %]
-                            <div id="toolbar" class="toolbar">
+                            <div id="toolbar" class="toolbar noprint">
                                 [% IF ( verbose ) %]
                                     <a href="opac-basket.pl" class="brief" onclick="showLess(); return false;">Brief display</a>
                                 [% ELSE %]
@@ -26,12 +26,12 @@
                                     <a class="send" href="opac-basket.pl" onclick="sendBasket(); return false;">Send</a>
                                 [% END %]
                                 <a class="download" href="opac-basket.pl" onclick="downloadBasket(); return false;">Download</a>
-                                <a class="print-large" href="opac-basket.pl" onclick="printBasket(); return false;">Print</a>
+                                <a class="print-large" href="opac-basket.pl" onclick="window.print(); return false;">Print</a>
                                 <a class="empty" href="opac-basket.pl" onclick="delBasket(); return false;">Empty and close</a>
                                 <a class="hide close" href="opac-basket.pl">Hide window</a>
                             </div>
 
-                            <div id="selections-toolbar" class="toolbar">
+                            <div id="selections-toolbar" class="toolbar noprint">
                                 <a id="CheckAll" href="#">Select all</a>
                                 <a id="CheckNone" href="#">Clear all</a>
                                 <span class="sep">|</span>
-- 
2.7.4


More information about the Koha-patches mailing list