From 51e0e140c2d21175eb35a564cfd4c91d2a87bcc3 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 24 Jul 2002 03:16:21 +0000 Subject: [PATCH] Fixed up the Print module. Added a function printslip that takes a string as an argument. It is easier to prepare the slip and then call the print function. in circulation.pl I have moved some javascript out to the circulation-top.inc --- C4/Print.pm | 57 ++++++++++++++++++++++++++++++++++----------- circ/circulation.pl | 15 ++---------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/C4/Print.pm b/C4/Print.pm index 821b879505..2a599a9ecb 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -10,7 +10,7 @@ use vars qw($VERSION @ISA @EXPORT); $VERSION = 0.01; @ISA = qw(Exporter); -@EXPORT = qw(&remoteprint &printreserve); +@EXPORT = qw(&remoteprint &printreserve &printslip); sub remoteprint { my ($env,$items,$borrower)=@_; @@ -57,25 +57,54 @@ sub printreserve { my($env, $branchname, $bordata, $itemdata)=@_; my $file=time; my $printer = $env->{'printer'}; + if ($printer eq "" || $printer eq 'nulllp') { + open (PRINTER,">>/tmp/kohares"); + } else { + open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n"; + } + my @da = localtime(time()); + my $todaysdate = "$da[2]:$da[1] $da[3]/$da[4]/$da[5]"; + +#(1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]); + my $slip = <<"EOF"; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Date: $todaysdate; + +ITEM RESERVED: +$itemdata->{'title'} ($itemdata->{'author'}) +barcode: $itemdata->{'barcode'} + +COLLECT AT: $branchname + +BORROWER: +$bordata->{'surname'}, $bordata->{'firstname'} +card number: $bordata->{'cardnumber'} +Phone: $bordata->{'phone'} +$bordata->{'streetaddress'} +$bordata->{'suburb'} +$bordata->{'town'} +$bordata->{'emailaddress'} + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +EOF + print PRINTER $slip; + close PRINTER; + return $slip; +} + +sub printslip { + my($env, $slip)=@_; + my $printer = $env->{'printer'}; if ($printer eq "" || $printer eq 'nulllp') { open (PRINTER,">/tmp/kohares"); } else { open (PRINTER, "| lpr -P $printer") or die "Couldn't write to queue:$!\n"; - } - print PRINTER "Collect at $branchname \r\n\r\n"; - print PRINTER "$bordata->{'surname'}; $bordata->{'firstname'}\r\n"; - print PRINTER "$bordata->{'cardnumber'}\r\n"; - print PRINTER "Phone: $bordata->{'phone'}\r\n"; - print PRINTER "$bordata->{'streetaddress'}\r\n"; - print PRINTER "$bordata->{'suburb'}\r\n"; - print PRINTER "$bordata->{'town'}\r\n"; - print PRINTER "$bordata->{'emailaddress'}\r\n\r\n"; - print PRINTER "$itemdata->{'barcode'}\r\n"; - print PRINTER "$itemdata->{'title'}\r\n"; - print PRINTER "$itemdata->{'author'}"; - print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n"; + } + print PRINTER $slip; close PRINTER; } + END { } # module clean-up code here (global destructor) diff --git a/circ/circulation.pl b/circ/circulation.pl index 51cba16464..8fd849f222 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -100,8 +100,7 @@ if (my $qnumber = $query->param('questionnumber')) { } -# if the barcode is set - +# if the barcode is set my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer); my $year=$query->param('year'); @@ -450,21 +449,11 @@ my @inp=startmenu('circulation'); if ($query->param('barcode') eq '' && $query->param('charges') eq 'yes'){ my $count=@inp; for (my $i=0;$i<$count;$i++){ - $inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\"\)\;window1.focus\(\)/; + $inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\",700,600\)\;window1.focus\(\)/; } } print @inp; -print < - - -EOF -; #print startmenu('circulation'); -- 2.39.5