1 package C4::Print; #assumes C4/Print.pm
4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
23 #use C4::InterfaceCDK;
25 use vars qw($VERSION @ISA @EXPORT);
27 # set the version for version checking
31 @EXPORT = qw(&remoteprint &printreserve &printslip);
34 my ($env,$items,$borrower)=@_;
35 #open (FILE,">/tmp/olwen");
36 #print FILE "queue $env->{'queue'}";
38 #debug_msg($env,"In print");
40 my $queue = $env->{'queue'};
41 if ($queue eq "" || $queue eq 'nulllp') {
42 open (PRINTER,">/tmp/kohaiss");
44 open(PRINTER, "| lpr -P $queue") or die "Couldn't write to queue:$queue!\n";
47 #open (FILE,">/tmp/$file");
49 my $brdata = $env->{'brdata'};
50 print PRINTER "Horowhenua Library Trust\r\n";
51 # print PRINTER "$brdata->{'branchname'}\r\n";
52 print PRINTER "Phone: 368-1953\r\n";
53 print PRINTER "Fax: 367-9218\r\n";
54 print PRINTER "Email: renewals\@library.org.nz\r\n\r\n\r\n";
55 print PRINTER "$borrower->{'cardnumber'}\r\n";
56 print PRINTER "$borrower->{'title'} $borrower->{'initials'} $borrower->{'surname'}\r\n";
59 my $itemdata = $items->[$i];
60 print PRINTER "$i $itemdata->{'title'}\r\n";
61 print PRINTER "$itemdata->{'barcode'}";
63 print PRINTER "$itemdata->{'date_due'}\r\n";
66 print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
67 if ($env->{'printtype'} eq "docket"){
68 #print chr(27).chr(105);
71 #system("lpr /tmp/$file");
75 my($env, $branchname, $bordata, $itemdata)=@_;
77 my $printer = $env->{'printer'};
78 if ($printer eq "" || $printer eq 'nulllp') {
79 open (PRINTER,">>/tmp/kohares");
81 open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n";
83 my @da = localtime(time());
84 my $todaysdate = "$da[2]:$da[1] $da[3]/$da[4]/$da[5]";
86 #(1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
88 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92 $itemdata->{'title'} ($itemdata->{'author'})
93 barcode: $itemdata->{'barcode'}
95 COLLECT AT: $branchname
98 $bordata->{'surname'}, $bordata->{'firstname'}
99 card number: $bordata->{'cardnumber'}
100 Phone: $bordata->{'phone'}
101 $bordata->{'streetaddress'}
104 $bordata->{'emailaddress'}
107 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 my $printer = $env->{'printer'};
117 if ($printer eq "" || $printer eq 'nulllp') {
118 open (PRINTER,">/tmp/kohares");
120 open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n";
126 END { } # module clean-up code here (global destructor)