From 6a6857550af236efe42ff01486d557a10448f09b Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 7 Oct 2024 15:50:39 +0000 Subject: [PATCH] Bug 38072: [alternate] Fix regression in modal print Test plan 1) Enable cash registers and point of sale preferences 2) Add a debit type and mark it as 'Can be sold' 3) Add a cash register 4) Use 'Point of sale' to sell one of the above item for cash against the register you just created. 5) Navigate to the register and 'cashup' 6) Click the 'summary' link to display a modal 7) User the 'Print' option in the modal and confirm you face a print dialog and can print --- koha-tmpl/intranet-tmpl/prog/js/modal_printer.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/modal_printer.js b/koha-tmpl/intranet-tmpl/prog/js/modal_printer.js index b93b82e62c2..b199a6699a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modal_printer.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modal_printer.js @@ -38,16 +38,17 @@ $(document).ready(function() { text-align: left; } - `) + `); win.document.write( title ); win.document.write( contents ); win.document.close(); - win.focus(); - win.print(); - win.onafterprint = function () { + win.addEventListener( 'afterprint', function () { + win.addEventListener( 'focus', function () { + win.close(); + }); win.close(); - } - setTimeout('window.close()', 1000); //Hack from Chrome < 63 + }); + win.print(); } // Set focused on printable modals on open and autoprint if required -- 2.39.2