[Koha-bugs] [Bug 7563] New: Silent print slips using Firefox PlugIn jsPrintSetup and new staff client preference
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Feb 21 00:50:29 CET 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7563
Bug #: 7563
Summary: Silent print slips using Firefox PlugIn jsPrintSetup
and new staff client preference
Classification: Unclassified
Change sponsored?: ---
Product: Koha
Version: master
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Circulation
AssignedTo: kyle.m.hall at gmail.com
ReportedBy: veron at veron.ch
QAContact: koha.sekjal at gmail.com
CC: gmcharlt at gmail.com
This is a proposition to implement silent printing for slips.
In opposition to the solution with an additional Firefox (Portable)
installation (see:
http://wiki.koha-community.org/wiki/Using_Portable_Firefox_as_a_Koha_Client),
this solution works with the standard Firefox installation (+ PlugIn
jsPrintSetup) .
jsPrintSetup e.g. allows to set printer, print silent, change header and
footer, see: http://jsprintsetup.mozdev.org/
The overall concept is to have a new staff client preference where one can
enter the necessary JavaScript.
If this preference is empty, Koha falls back to te default behaviour.
I did a proof of concept with the following steps:
--Step 1 --------------------------
Add somewhere to staff_client.pref,
e.g. near intranetstylesheet:
----------------------------------
-
- "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
----------------------------------
(Suppose this will be pootleized to have translations?)
--Step 2---------------------------
Add somewhere to moremember.pl:
----------------------------------
$template->param( intranetslipprinterjs =>
C4::Context->preference('intranetslipprinterjs' ) );
----------------------------------
--Step 3----------------------------------------------
Replace hard coded JavaScript function printThenClose()
in moremember-print.tt and moremember-receipt.tt with:
------------------------------------------------------
<script language="javascript">
[% IF ( intranetslipprinterjs ) %]
[% intranetslipprinterjs %]
[% ELSE %]
function printThenClose() {
window.print();
window.close();
}
[% END %]
</script>
--Step 4----------------------------------------------------------------------
Login to Koha, go to Home › Administration › System Preferences (Staff Client)
and edit the new field intranetslipprinterjs to print silent, set printer etc.
------------------------------------------------------------------------------
function printThenClose() {
try
{
//Try to print using jsPrintSetup Plug-In in Firefox
//If it is not installed fall back to default prnting
jsPrintSetup.clearSilentPrint();
jsPrintSetup.setOption('printSilent', 1);
//Choose printer using one or more of the following functions
//jsPrintSetup.getPrintersList...
//jsPrintSetup.setPrinter...
//Set Header and footer...
jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '');
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
jsPrintSetup.print();
window.close();
}
catch(err)
{
//Default printing if jsPrint-setup is not available
window.print();
window.close();
}
}
--Step 5---------------------------------------------
...and install jsPrintSetup PlugIn in Firefox...
-----------------------------------------------
More information about the Koha-bugs
mailing list