To recreate: 1. Have SelfCheckReceiptPrompt on 2. GO to the self checkout module 3. Login and press 'Finish' 4. Click 'Print receipt and end session' 5. No print dialogue
I am suspect of the bug 36586 patch section that reads: [% IF Koha.Preference('SelfCheckReceiptPrompt') %] var confirmStart = Date.now(); confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) { - if ( result && (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) { + if ( result && (Date.now() - confirmStart) < [% Koha.Preference('SelfCheckTimeout') | html %] ) { var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip"); location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; } else { location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; } }) - sco_init(); [% ELSE %] location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; [% END %]
Christopher, That looks like the right section: Prior to Bug 36586 there was this in the Perl file: $selfchecktimeout = C4::Context->preference('SelfCheckTimeout') * 1000; and then the following check with JS: if ( result && (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) { that line was replaced with: if ( result && (Date.now() - confirmStart) < [% Koha.Preference('SelfCheckTimeout') | html %] ) { So now this will not evaluate to true.
Created attachment 183313 [details] [review] Bug 40158: Multiply scotimeout x 1000 to restore old logic 1. Have SelfCheckReceiptPrompt on 2. Go to the self checkout module 3. Login and press 'Finish' 4. Click 'Print receipt and end session' 5. No print dialogue 6. APPLY PATCH 7. Try again, it should behave as excepeted
The patch looks like it does restore the old logic, but do we actually need the logic at all? I'll try with this patch and without that datetime handling at all.
Created attachment 183314 [details] [review] Bug 40158: Multiply scotimeout x 1000 to restore old logic 1. Have SelfCheckReceiptPrompt on 2. Go to the self checkout module 3. Login and press 'Finish' 4. Click 'Print receipt and end session' 5. No print dialogue 6. APPLY PATCH 7. Try again, it should behave as excepeted Signed-off-by: Christopher <cbrannon@cdalibrary.org>
Works as described. Thanks for fixing this so quickly!!!!!
Created attachment 183315 [details] [review] Bug 40158: [alternate] Remove unnecessary timeout check on sco slip print This change removes an unnecessary/buggy SelfCheckTimeout check when using SelfCheckReceiptPrompt slip printing. To test: 1. Have SelfCheckReceiptPrompt enabled 2. Go to the self checkout module 3. Login and press 'Finish' 4. Click 'Print receipt and end session' 5. The print screen isn't shown and the user is just logged out 6. APPLY PATCH and refresh the page 7. Login and press 'Finish' then click "Print receipt and end session" 8. You should now see a print screen Notes: Set SelfCheckTimeout to a small value like 10 to see that not choosing an option for the SelfCheckReceiptPrompt will mean you're automatically logged out by the timer. If you do choose "Print receipt and end session", the original window will redirect to the logout endpoint, but it won't completely load until after the print screen is actioned - at least in Chrome.
Christopher and Lucas, could you try out my alternate patch? If there is some quirk to it that I can't see, I'm happy to go with Lucas's patch. But overall I don't see a point in having the old logic there either.
(In reply to David Cook from comment #8) > Christopher and Lucas, could you try out my alternate patch? > > If there is some quirk to it that I can't see, I'm happy to go with Lucas's > patch. But overall I don't see a point in having the old logic there either. I've tested both and I think that they work the same? So I figure the less code the better?
Created attachment 183332 [details] [review] Bug 40158: [alternate] Remove unnecessary timeout check on sco slip print This change removes an unnecessary/buggy SelfCheckTimeout check when using SelfCheckReceiptPrompt slip printing. To test: 1. Have SelfCheckReceiptPrompt enabled 2. Go to the self checkout module 3. Login and press 'Finish' 4. Click 'Print receipt and end session' 5. The print screen isn't shown and the user is just logged out 6. APPLY PATCH and refresh the page 7. Login and press 'Finish' then click "Print receipt and end session" 8. You should now see a print screen Notes: Set SelfCheckTimeout to a small value like 10 to see that not choosing an option for the SelfCheckReceiptPrompt will mean you're automatically logged out by the timer. If you do choose "Print receipt and end session", the original window will redirect to the logout endpoint, but it won't completely load until after the print screen is actioned - at least in Chrome. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Bug 40108 has the same patch, except it also adds a semicolon to the end of the confirmModal function *** This bug has been marked as a duplicate of bug 40108 ***
Created attachment 183347 [details] [review] Bug 40158: [alternate] Remove unnecessary timeout check on sco slip print This change removes an unnecessary/buggy SelfCheckTimeout check when using SelfCheckReceiptPrompt slip printing. To test: 1. Have SelfCheckReceiptPrompt enabled 2. Go to the self checkout module 3. Login and press 'Finish' 4. Click 'Print receipt and end session' 5. The print screen isn't shown and the user is just logged out 6. APPLY PATCH and refresh the page 7. Login and press 'Finish' then click "Print receipt and end session" 8. You should now see a print screen Notes: Set SelfCheckTimeout to a small value like 10 to see that not choosing an option for the SelfCheckReceiptPrompt will mean you're automatically logged out by the timer. If you do choose "Print receipt and end session", the original window will redirect to the logout endpoint, but it won't completely load until after the print screen is actioned - at least in Chrome. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Christopher <cbrannon@cdalibrary.org>
(In reply to Brendan Lawlor from comment #11) > Bug 40108 has the same patch, except it also adds a semicolon to the end of > the confirmModal function > > *** This bug has been marked as a duplicate of bug 40108 *** Nice one, Brendan!