[Koha-patches] [PATCH] [Bug 6126][old_templates] Slip print doesn't work on Webkit based browsers

Tomás Cohen Arazi tomascohen at gmail.com
Tue Apr 12 12:52:33 CEST 2011


Wrap window.print();window.close(); with a function called when body has finished loading. Prevents webkit from closing before page is loaded and print dialog presented to the user.
---
 .../en/modules/members/moremember-receipt.tmpl     |    4 +++-
 .../prog/en/modules/members/printfeercpt.tmpl      |    4 +++-
 .../prog/en/modules/members/printinvoice.tmpl      |    4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tmpl
index c6535cf..9318bed 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-receipt.tmpl
@@ -5,11 +5,13 @@
  <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/print.css" />
 
 <script language="javascript">
+    function printThenClose() {
         window.print();
         window.close();
+    }
 </script>
 </head>
-<body>
+<body onload="printThenClose();">
 
 <div id="receipt">
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tmpl
index b5155b9..540c361 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tmpl
@@ -4,11 +4,13 @@
 <link rel="shortcut icon" href="<!-- TMPL_IF NAME="IntranetFavicon" --><!-- TMPL_VAR NAME="IntranetFavicon" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico<!-- /TMPL_IF -->" type="image/x-icon" />
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/printreceiptinvoice.css" />
 <script language="javascript">
+    function printThenClose() {
         window.print();
         window.close();
+    }
 </script>
 </head>
-<body>
+<body onload="printThenClose();">
 
 <div id="receipt">
 <!-- The table with the account items -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tmpl
index 62ebab1..515ae50 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tmpl
@@ -4,11 +4,13 @@
 <link rel="shortcut icon" href="<!-- TMPL_IF NAME="IntranetFavicon" --><!-- TMPL_VAR NAME="IntranetFavicon" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico<!-- /TMPL_IF -->" type="image/x-icon" />
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/printreceiptinvoice.css" />
 <script language="javascript">
+    function printThenClose() {
         window.print();
         window.close();
+    }
 </script>
 </head>
-<body>
+<body onload="printThenClose();">
 
 <div id="receipt">
 <!-- The table with the account items -->
-- 
1.7.1



More information about the Koha-patches mailing list