From a6a7869e2139052b86114c8c5e8f3408befc3fbd Mon Sep 17 00:00:00 2001 From: Marc Veron Date: Wed, 25 Apr 2012 23:27:42 +0200 Subject: [PATCH] Bug 7563 [ENH] : Silent print slips using Firefox PlugIn jsPrintSetup and new staff client preference Content-Type: text/plain; charset="utf-8" Configure slip printers to print slips (silently) to a special printer using the Firefox PlugIn jsPrintSetUp. All other print actions are not affected. See http://jsprintsetup.mozdev.org/ for all the possibilities (e.g. change header/footer, get a list of printers, set printer etc.). The overall concept is to have a new staff client preference (IntranetSlipPrinterJS) where one can enter the necessary JavaScript. If the preference is empty, Koha falls back to te default behaviour. An example of JavaScript can be found on: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7563 modified: installer/data/mysql/sysprefs.sql modified: installer/data/mysql/updatedatabase.pl modified: koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref modified: koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt modified: members/printslip.pl --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/staff_client.pref | 5 +++++ .../prog/en/modules/circ/printslip.tt | 4 ++++ members/printslip.pl | 2 ++ 5 files changed, 19 insertions(+), 0 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..216cc63 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -362,3 +362,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 84f0437..7fc1d1c 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,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) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index b93f8fd..b6be289 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -16,6 +16,11 @@ Staff Client: class: url - on all pages in the staff interface, instead of the default. (This should be a complete URL, starting with http://.) - + - "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 type: textarea diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt index 3e60d73..11e31c9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt @@ -8,10 +8,14 @@ [% END %] diff --git a/members/printslip.pl b/members/printslip.pl index 3a499cd..71fdda2 100755 --- a/members/printslip.pl +++ b/members/printslip.pl @@ -89,4 +89,6 @@ $template->param( error => $error, ); +$template->param( IntranetSlipPrinterJS => C4::Context->preference('IntranetSlipPrinterJS' ) ); + output_html_with_http_headers $input, $cookie, $template->output; -- 1.7.2.5