As we noticed in bug 11014, different browsers handle "window.print()" differently. In the case of window.print() followed by window.location.href=, I've found in IE 11 on Windows 8.1 that the browser changes the window location before the system print dialogue even opens. If I try to mitigate that using the timer from bug 11014, it works in IE and Chrome, but it breaks in Firefox. If I try to use the onafterprint in IE and Firefox, it works in IE but it breaks in Firefox. I started wondering if we even need to be using this window.print() followed by window.location.href= and it occurred to me that we really don't. We should just be using print.css. Patch to follow soon...
Created attachment 51907 [details] [review] Bug 16575 - Irregular behaviour using window.print() followed by window.location.href= 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
At some point, it would be prudent to strip the now unnecessary "print_basket" stuff out of opac-basket.tt. I didn't include it here, as it wasn't necessary for the actual bug fix. I also didn't want to do the work of removing all that code, if QA decides that this fix is no good, so I'm happy to add a follow-up once QA is happy with this patch.
Created attachment 51908 [details] [review] [SIGNED-OFF] Bug 16575 - Irregular behaviour using window.print() followed by window.location.href= 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@catalyst.net.nz>
I think you should have included js removal with the patch, not used so should go. What's the story with the intranet basket?
(In reply to Srdjan Jankovic from comment #4) > I think you should have included js removal with the patch, not used so > should go. > What's the story with the intranet basket? Good points. It looks like the intranet has the same issue as the OPAC basket, so I should change that...
Same as Srdjan :) So please: 1/ apply the same fix for intranet 2/ remove the JS function 3/ remove the code related to the print param Additional comments: 4/ With your patch, the first column is now printed (checkbox) 5/ I only see 8 (out of 20) records printed
Thanks for looking at this Jonathan :). I don't have time to work on this right now, but I'll keep it in mind for the future.
Can't believe it's almost been 6 months. This is still on my to do list although I don't think I'll be looking at it until 2017 at the earliest.
Created attachment 75664 [details] [review] Bug 16575: Irregular behaviour using window.print() followed by window.location.href This patch updates the OPAC and staff client carts to use CSS to control print output, removing a print parameter which was passed to the script. Currently, when you click "Print" on the OPAC basket, it navigates to a new page and initiates 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 behavior. 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 6) Perform the same tests in the staff client
Created attachment 75665 [details] [review] Bug 16575: (follow-up) Compiled CSS This patch contains the compiled CSS for the OPAC print stylesheet.
Created attachment 76768 [details] [review] Bug 16575: Irregular behaviour using window.print() followed by window.location.href This patch updates the OPAC and staff client carts to use CSS to control print output, removing a print parameter which was passed to the script. Currently, when you click "Print" on the OPAC basket, it navigates to a new page and initiates 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 behavior. 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 6) Perform the same tests in the staff client Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 76769 [details] [review] Bug 16575: (follow-up) Compiled CSS This patch contains the compiled CSS for the OPAC print stylesheet. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
I redid the second patch from scratch as it did no longer apply.
> 5) After printing is complete, you should still be on the OPAC basket > pop-up The popup is still open, but I did not return to it. (Chrome, FF)
(In reply to Katrin Fischer from comment #13) > I redid the second patch from scratch as it did no longer apply. You made a mistake: Patch 2 was: From: Owen Leonard <oleonard@myacpl.org> Date: Wed, 30 May 2018 14:18:43 +0000 Subject: [PATCH] Bug 16575: (follow-up) Compiled CSS This patch contains the compiled CSS for the OPAC print stylesheet. --- koha-tmpl/opac-tmpl/bootstrap/css/print.css | 2 +- But it became (you changed ANOTHER file): From: Katrin Fischer <katrin.fischer.83@web.de> Date: Sun, 8 Jul 2018 01:21:23 +0000 Subject: [PATCH 2/2] Bug 16575: (follow-up) Compiled CSS This patch contains the compiled CSS for the OPAC print stylesheet. --- koha-tmpl/opac-tmpl/bootstrap/css/opac.css | 2 +-
Hm, what I did was skipping the second original patch as it didn't apply and running the opac-less command - strange that I came out with a changed file anyway. I would have expected an empty file. And also a bit strange that the print file was not regenerated, have to investigate. Thx for noticing!
not an empty file, but no changed in the one I actually committed... sorry for being unclear.
Created attachment 76967 [details] [review] Bug 16575: (follow-up) Compiled CSS This patch contains the compiled CSS for the OPAC print stylesheet.
I fixed the CSS.
Created attachment 76971 [details] [review] Bug 16575: Irregular behaviour using window.print() followed by window.location.href This patch updates the OPAC and staff client carts to use CSS to control print output, removing a print parameter which was passed to the script. Currently, when you click "Print" on the OPAC basket, it navigates to a new page and initiates 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 behavior. 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 6) Perform the same tests in the staff client Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 76972 [details] [review] Bug 16575: (follow-up) Compiled CSS This patch contains the compiled CSS for the OPAC print stylesheet. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(In reply to Katrin Fischer from comment #19) > I fixed the CSS. Thanks.
Awesome work all! Pushed to master for 18.11
Pushed to 18.05.x for 18.05.03