Description
Owen Leonard
2025-06-10 11:47:05 UTC
Created attachment 183125 [details] [review] Bug 40108: Fix print receipt option in self-checkout The self-checkout logout process, with SelfCheckReceiptPrompt enabled, asks the user if they want to print a receipt. Because of an error in time calculation the system always believed the process had timed out and wouldn't print the receipt. Before we implemented a modal dialog to ask for confirmation upon self-checkout logout, it was necessary to have a timeout function built into the process. See Bug 11498. The modal no longer blocks the page timeout function, so this time calculation is obsolete and can be removed. To test, apply the patch and go to the self-checkout module. - Make sure the SelfCheckReceiptPrompt system preference is enabled. - Log in as a user for doing self-checkout. - Click the "Finish" button. - You should see a dialog, "Would you like to print a receipt?" - Clicking "Print receipt..." should open a new window with your receipt and log you out of the self-checkout system. - Clicking "End session" should end your session without triggering a popup. - Set the SelfCheckTimeout system preference to something very low, like 10 seconds. - Perform the same test as above, but after triggering the dialog wait 10 seconds for the timeout to trigger. - The page should reload automatically and log you out. - Disable the SelfCheckReceiptPrompt system preference. - Perform the same tests to confirm that clicking the "Finish" button logs you out immediately without offering to print a slip. Sponsored-by: Athens County Public Libraries Created attachment 183128 [details] [review] Bug 40108: Fix print receipt option in self-checkout The self-checkout logout process, with SelfCheckReceiptPrompt enabled, asks the user if they want to print a receipt. Because of an error in time calculation the system always believed the process had timed out and wouldn't print the receipt. Before we implemented a modal dialog to ask for confirmation upon self-checkout logout, it was necessary to have a timeout function built into the process. See Bug 11498. The modal no longer blocks the page timeout function, so this time calculation is obsolete and can be removed. To test, apply the patch and go to the self-checkout module. - Make sure the SelfCheckReceiptPrompt system preference is enabled. - Log in as a user for doing self-checkout. - Click the "Finish" button. - You should see a dialog, "Would you like to print a receipt?" - Clicking "Print receipt..." should open a new window with your receipt and log you out of the self-checkout system. - Clicking "End session" should end your session without triggering a popup. - Set the SelfCheckTimeout system preference to something very low, like 10 seconds. - Perform the same test as above, but after triggering the dialog wait 10 seconds for the timeout to trigger. - The page should reload automatically and log you out. - Disable the SelfCheckReceiptPrompt system preference. - Perform the same tests to confirm that clicking the "Finish" button logs you out immediately without offering to print a slip. Sponsored-by: Athens County Public Libraries Created attachment 183139 [details] [review] Bug 40108: Fix print receipt option in self-checkout The self-checkout logout process, with SelfCheckReceiptPrompt enabled, asks the user if they want to print a receipt. Because of an error in time calculation the system always believed the process had timed out and wouldn't print the receipt. Before we implemented a modal dialog to ask for confirmation upon self-checkout logout, it was necessary to have a timeout function built into the process. See Bug 11498. The modal no longer blocks the page timeout function, so this time calculation is obsolete and can be removed. To test, apply the patch and go to the self-checkout module. - Make sure the SelfCheckReceiptPrompt system preference is enabled. - Log in as a user for doing self-checkout. - Click the "Finish" button. - You should see a dialog, "Would you like to print a receipt?" - Clicking "Print receipt..." should open a new window with your receipt and log you out of the self-checkout system. - Clicking "End session" should end your session without triggering a popup. - Set the SelfCheckTimeout system preference to something very low, like 10 seconds. - Perform the same test as above, but after triggering the dialog wait 10 seconds for the timeout to trigger. - The page should reload automatically and log you out. - Disable the SelfCheckReceiptPrompt system preference. - Perform the same tests to confirm that clicking the "Finish" button logs you out immediately without offering to print a slip. Sponsored-by: Athens County Public Libraries Signed-off-by: David Flater <flaterdavid@gmail.com> *** Bug 40102 has been marked as a duplicate of this bug. *** *** Bug 40158 has been marked as a duplicate of this bug. *** Created attachment 183342 [details] [review] Bug 40108: Fix print receipt option in self-checkout The self-checkout logout process, with SelfCheckReceiptPrompt enabled, asks the user if they want to print a receipt. Because of an error in time calculation the system always believed the process had timed out and wouldn't print the receipt. Before we implemented a modal dialog to ask for confirmation upon self-checkout logout, it was necessary to have a timeout function built into the process. See Bug 11498. The modal no longer blocks the page timeout function, so this time calculation is obsolete and can be removed. To test, apply the patch and go to the self-checkout module. - Make sure the SelfCheckReceiptPrompt system preference is enabled. - Log in as a user for doing self-checkout. - Click the "Finish" button. - You should see a dialog, "Would you like to print a receipt?" - Clicking "Print receipt..." should open a new window with your receipt and log you out of the self-checkout system. - Clicking "End session" should end your session without triggering a popup. - Set the SelfCheckTimeout system preference to something very low, like 10 seconds. - Perform the same test as above, but after triggering the dialog wait 10 seconds for the timeout to trigger. - The page should reload automatically and log you out. - Disable the SelfCheckReceiptPrompt system preference. - Perform the same tests to confirm that clicking the "Finish" button logs you out immediately without offering to print a slip. Sponsored-by: Athens County Public Libraries Signed-off-by: David Flater <flaterdavid@gmail.com> Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> This patch works as described and removing the obsolete code makes sense. Nice work. Thanks for the detailed test plan. Passing QA. In the meantime until this gets backported, assuming you have SelfCheckReceiptPrompt enabled you can add this js snippet to SCOUserJS to override the finish button's click handler: $(document).ready(function() { $("#logout_form").off("click"); $("#logout_form").on("click", function(e){ e.preventDefault(e); confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) { if ( result ) { 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'; } }); return true; }); }); Extra +1 from me. I ended up writing the same patch as Owen a week later 😅. Guess the title of bug 40158 was just different enough not to show as a duplicate at report time I imagine. Nice work everyone! Pushed to main for 25.11 Nice work everyone! Pushed to 25.05.x for 25.05.03 Can this be backported to 24.11? Created attachment 184017 [details] [review] Bug 40108: [24.11.x] Fix print receipt option in self-checkout The self-checkout logout process, with SelfCheckReceiptPrompt enabled, asks the user if they want to print a receipt. Because of an error in time calculation the system always believed the process had timed out and wouldn't print the receipt. Before we implemented a modal dialog to ask for confirmation upon self-checkout logout, it was necessary to have a timeout function built into the process. See Bug 11498. The modal no longer blocks the page timeout function, so this time calculation is obsolete and can be removed. To test, apply the patch and go to the self-checkout module. - Make sure the SelfCheckReceiptPrompt system preference is enabled. - Log in as a user for doing self-checkout. - Click the "Finish" button. - You should see a dialog, "Would you like to print a receipt?" - Clicking "Print receipt..." should open a new window with your receipt and log you out of the self-checkout system. - Clicking "End session" should end your session without triggering a popup. - Set the SelfCheckTimeout system preference to something very low, like 10 seconds. - Perform the same test as above, but after triggering the dialog wait 10 seconds for the timeout to trigger. - The page should reload automatically and log you out. - Disable the SelfCheckReceiptPrompt system preference. - Perform the same tests to confirm that clicking the "Finish" button logs you out immediately without offering to print a slip. Sponsored-by: Athens County Public Libraries Bug 36586 is getting reverted so might be necessary to revert this too (In reply to David Cook from comment #14) > Bug 36586 is getting reverted so might be necessary to revert this too This fix still makes sense to me without Bug 36586. In main I left this fix as is after reverting Bug 36586. Created attachment 184498 [details] [review] Bug 40108: [24.11.x] Fix print receipt option in self-checkout The self-checkout logout process, with SelfCheckReceiptPrompt enabled, asks the user if they want to print a receipt. Because of an error in time calculation the system always believed the process had timed out and wouldn't print the receipt. Before we implemented a modal dialog to ask for confirmation upon self-checkout logout, it was necessary to have a timeout function built into the process. See Bug 11498. The modal no longer blocks the page timeout function, so this time calculation is obsolete and can be removed. To test, apply the patch and go to the self-checkout module. - Make sure the SelfCheckReceiptPrompt system preference is enabled. - Log in as a user for doing self-checkout. - Click the "Finish" button. - You should see a dialog, "Would you like to print a receipt?" - Clicking "Print receipt..." should open a new window with your receipt and log you out of the self-checkout system. - Clicking "End session" should end your session without triggering a popup. - Set the SelfCheckTimeout system preference to something very low, like 10 seconds. - Perform the same test as above, but after triggering the dialog wait 10 seconds for the timeout to trigger. - The page should reload automatically and log you out. - Disable the SelfCheckReceiptPrompt system preference. - Perform the same tests to confirm that clicking the "Finish" button logs you out immediately without offering to print a slip. Sponsored-by: Athens County Public Libraries Signed-off-by: David Flater <flaterdavid@gmail.com> Might not need a sign-off, but I did test this on 24.11.x and it both maintains all functionality and passes QA. (In reply to David Flater from comment #17) > Might not need a sign-off, but I did test this on 24.11.x and it both > maintains all functionality and passes QA. Thanks a lot for this dedicated patch Pushed to 24.11.x for 24.11.08 |