Summary: | Slip Print Problem in Chrome | ||
---|---|---|---|
Product: | Koha | Reporter: | David Cook <dcook> |
Component: | Templates | Assignee: | David Cook <dcook> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | fridolin.somers, gmcharlt, kyle, sandboxes, tomascohen, veron, wizzyrea |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 11014 - Slip Print Problem in Chrome
[PASSED QA] Bug 11014 - Slip Print Problem in Chrome |
Description
David Cook
2013-10-08 03:59:55 UTC
Agreed, this is problematic, I wish chrome did things in a standard way. I've tried setting IntranetSlipPrinterJS to the following: function printThenClose() { window.print(); setTimeout('window.close()', 1); } Testing (print slip, print slip but cancel) appears to work in the following browsers: Chrome 32.0.1700.107 m on Win7 Firefox 27.0.1 on Win7 IE 11.0.9600.16428 on Win7 It's ugly, but needs must when the devil drives. I'd appreciate some testing; if this works across a reasonable range of platforms and browsers, it could become the new default. (In reply to David Cook from comment #0) > Since this preview screen is non-standard, the javascript doesn't even > detect it, and it proceeds to close the window. Worse, I've observed that when this happens, the Chrome window that initiated the print popup window can simply freeze, force the user to close the tab. (In reply to Galen Charlton from comment #3) > Worse, I've observed that when this happens, the Chrome window that > initiated the print popup window can simply freeze, force the user to close > the tab. And because of that, I'm bumping up the importance to major. (In reply to Galen Charlton from comment #2) > I've tried setting IntranetSlipPrinterJS to the following: > > function printThenClose() { > window.print(); > setTimeout('window.close()', 1); > } > > Testing (print slip, print slip but cancel) appears to work in the following > browsers: > > Chrome 32.0.1700.107 m on Win7 > Firefox 27.0.1 on Win7 > IE 11.0.9600.16428 on Win7 > > It's ugly, but needs must when the devil drives. I'd appreciate some > testing; if this works across a reasonable range of platforms and browsers, > it could become the new default. This solution also works with the following criteria: Chrome 33.0.1750.117 m on Win8 Firefox 27.0.1 on Win8 IE 11.0.9600.16518 on Win8 Nice one, Galen! I have a patch for 3.14, but I'll double-check against master, and post it a bit later today... Works a treat in any case. As per Galen's suggestion in IRC, I'm going to use an INCLUDE to centralize the code so that Koha's staff client respect the system preference "IntranetSlipPrinterJS" more consistently. http://wiki.koha-community.org/wiki/Setting_up_slip_printer_to_print_silently It'll also use the timeout, which fixes printing in Chrome without affecting IE or Firefox. I'm also including a patch for the self-checkout, but it won't use the "IntranetSlipPrinterJS" system preference. Created attachment 28379 [details] [review] Bug 11014 - Slip Print Problem in Chrome Currently, slips cannot be printed in circulation, members, or the self check out when using Chrome. This patch adds a timer of 1ms which allows Chrome's custom code to prevent "window.close" occuring before the user has dealt with the print window. This patch also allows admins to use the 'IntranetSlipPrinterJS' system preference to override the slip printing code by centralizing all the slip printing code in slip-print.inc, and including this JS anywhere it's needed in the staff client. I haven't used this include in the OPAC SCO but perhaps it would make sense to do so as well (even if it isn't referred to in the syspref's name). _TEST PLAN_ 1) Using Chrome on Windows (not sure if this is an issue on other OSes), try to print a slip in the following locations: Fines Tab -> Print button koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt: Details tab -> Print button -> Print slip || Print quick slip koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt: Details tab -> Print button -> Print summary koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt: Fines tab -> Accounts tab -> Print (Manual invoice of $5 sundry) koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt: Checkout tab -> Print button koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt: Finish button koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt 2) Note that each time you try to print, a new print page is created but closed before you have a chance to print. 3) Apply the patch 4) Repeat Step 1 5) Note that the print page now doesn't close until after you've chosen to print or cancel. Patch tested with a sandbox, by Christopher Brannon <cbrannon@cdalibrary.org> Created attachment 28569 [details] [review] [PASSED QA] Bug 11014 - Slip Print Problem in Chrome Currently, slips cannot be printed in circulation, members, or the self check out when using Chrome. This patch adds a timer of 1ms which allows Chrome's custom code to prevent "window.close" occuring before the user has dealt with the print window. This patch also allows admins to use the 'IntranetSlipPrinterJS' system preference to override the slip printing code by centralizing all the slip printing code in slip-print.inc, and including this JS anywhere it's needed in the staff client. I haven't used this include in the OPAC SCO but perhaps it would make sense to do so as well (even if it isn't referred to in the syspref's name). _TEST PLAN_ 1) Using Chrome on Windows (not sure if this is an issue on other OSes), try to print a slip in the following locations: Fines Tab -> Print button koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt: Details tab -> Print button -> Print slip || Print quick slip koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tt: Details tab -> Print button -> Print summary koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt: Fines tab -> Accounts tab -> Print (Manual invoice of $5 sundry) koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt: Checkout tab -> Print button koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt: Finish button koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt 2) Note that each time you try to print, a new print page is created but closed before you have a chance to print. 3) Apply the patch 4) Repeat Step 1 5) Note that the print page now doesn't close until after you've chosen to print or cancel. Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Pushed to master. Thanks David! Pushed to 3.16.x. Pushed to 3.14.x, will be in 3.14.12. Found a similar problem with the opac cart print bug 16575 |