Bug 7563 - Silent print slips using Firefox PlugIn jsPrintSetup and new staff client...
authorMarc Veron <veron@veron.ch>
Fri, 29 Jun 2012 19:31:34 +0000 (21:31 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 6 Jul 2012 16:23:39 +0000 (18:23 +0200)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt
members/printslip.pl

index 6a3735d..7009155 100644 (file)
@@ -374,4 +374,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
-
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
index ef9cde7..143edf2 100755 (executable)
@@ -5466,6 +5466,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion ="XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free')");
+    print "Upgrade to $DBversion done (Add system preference IntranetSlipPrinterJS))\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index b93f8fd..b6be289 100644 (file)
@@ -15,6 +15,11 @@ Staff Client:
             - pref: intranetstylesheet
               class: url
             - on all pages in the staff interface, instead of the default. (This should be a complete URL, starting with <code>http://</code>.)
+        -
+            - "Use the following JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/:"
+            - pref: IntranetSlipPrinterJS
+              type: textarea
+              class: code
         -
             - "Include the following CSS on all pages in the staff client:"
             - pref: IntranetUserCSS
index 3e60d73..7b29d4e 100644 (file)
@@ -8,10 +8,14 @@
 [% END %]
 
 <script language="javascript">
-    function printThenClose() {
-        window.print();
-        window.close();
-    }
+[% IF ( IntranetSlipPrinterJS ) %]
+    [% IntranetSlipPrinterJS %]
+[% ELSE %]
+     function printThenClose() {
+         window.print();
+         window.close();
+     }
+[% END %]
 </script>
 </head>
 <body id="circ_printslip" class="circ" onload="printThenClose();">
index 3a499cd..71fdda2 100755 (executable)
@@ -89,4 +89,6 @@ $template->param(
     error           => $error,
 );
 
+$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS' ) );
+
 output_html_with_http_headers $input, $cookie, $template->output;