Bug 25791

Summary: SCO print dialog pops up twice
Product: Koha Reporter: Lucas Gass <lucas>
Component: Self checkoutAssignee: Lucas Gass <lucas>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aleisha, dcook, jonathan.druart, victor
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25597
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.04, 19.11.10
Bug Depends on: 21565    
Bug Blocks:    
Attachments: Bug 25791: Remove win.print()
Bug 25791: Remove win.print()
Bug 25791: Remove win.print()

Description Lucas Gass 2020-06-17 22:10:11 UTC
With bz25597 the SCO print dialog now pops up twice (two separate dialog boxes) when a user clicks "Print receipt and end session".

To recreate:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
Comment 1 David Cook 2020-06-18 02:33:53 UTC
What browser are you using and on which OS? 

I don't think that I've experienced this, but happy to re-test.
Comment 2 Lucas Gass 2020-07-15 22:21:05 UTC
Hey David,

This only happens to me in FF. Chrome seems to work just fine.
Comment 3 Lucas Gass 2020-07-15 22:27:05 UTC
I believe this is because of some duplication of code in sco-main.tt:

var win = window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber | html %]&amp;print=qslip");
win.print();


If we use window.open, which opens a print dialog then we do not need to also have win.print()
Comment 4 Lucas Gass 2020-07-15 22:32:07 UTC
Created attachment 106941 [details] [review]
Bug 25791: Remove win.print()

Test plan:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
6) Apply patch
7) Repeat steps 1 - 4
8) Should only get a single print dialog.
9) Test in FF/Chrome and make sure behavior is consistent
Comment 5 David Cook 2020-07-16 03:43:26 UTC
I've made a note to check this out later.
Comment 6 ByWater Sandboxes 2020-08-05 19:50:16 UTC
Created attachment 107860 [details] [review]
Bug 25791: Remove win.print()

Test plan:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
6) Apply patch
7) Repeat steps 1 - 4
8) Should only get a single print dialog.
9) Test in FF/Chrome and make sure behavior is consistent

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 7 Katrin Fischer 2020-08-23 01:00:50 UTC
Created attachment 108947 [details] [review]
Bug 25791: Remove win.print()

Test plan:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
6) Apply patch
7) Repeat steps 1 - 4
8) Should only get a single print dialog.
9) Test in FF/Chrome and make sure behavior is consistent

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2020-08-24 10:33:14 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 9 Lucas Gass 2020-09-04 18:09:12 UTC
backported to 20.05.x for 20.05.04
Comment 10 Aleisha Amohia 2020-09-10 04:10:11 UTC
backported to 19.11.x for 19.11.10
Comment 11 Victor Grousset/tuxayo 2020-09-20 18:19:05 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.