Bug 18405: Self checkout: Fix broken silent printing
authorMarc Véron <veron@veron.ch>
Sun, 9 Apr 2017 14:58:21 +0000 (16:58 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 8 May 2017 13:01:41 +0000 (09:01 -0400)
Fix broken 'silent printing' (without printer dialog) in self checkout.

To reproduce:
Set up silent printing to slip printers as described in:
https://wiki.koha-community.org/wiki/Setting_up_slip_printer_to_print_silently

Verify that it works for check-outs in staff client.
Verify that it does not work in Self checkout.

To test:
Apply patch
Verify that silent printing works on SCO

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/includes/slip-print.inc [new file with mode: 0644]
koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/printslip.tt

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/slip-print.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/slip-print.inc
new file mode 100644 (file)
index 0000000..689375b
--- /dev/null
@@ -0,0 +1,10 @@
+<script type="text/javascript">
+[% IF ( Koha.Preference('IntranetSlipPrinterJS') ) %]
+    [% Koha.Preference('IntranetSlipPrinterJS') %]
+[% ELSE %]
+    $( window ).load(function() {
+        window.print();
+        setTimeout('window.close()', 1);
+    });
+[% END %]
+</script>
index f9a6582..025bf53 100644 (file)
@@ -1,3 +1,4 @@
+[% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout &rsaquo; Print Receipt for [% borrowernumber %]</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -6,15 +7,16 @@
 [% IF stylesheet %]
 <link rel="stylesheet" type="text/css" href="[% stylesheet %]" />
 [% END %]
-<script type="text/javascript">
-    function printThenClose() {
-        window.print();
-        setTimeout('window.close()', 1);
-    }
-</script>
+
+<!-- JavaScript includes -->
+<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/jquery.js"></script>
+<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
+
+[% INCLUDE 'slip-print.inc' %]
+
 </head>
 
-<body id="circ_printslip" class="circ" onload="printThenClose();">
+<body id="circ_printslip" class="circ">
     <div id="receipt">
         [% IF plain %]
             <pre>